ninjs 0.13.6 → 0.13.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (275) hide show
  1. data/VERSION +1 -1
  2. data/ninjs.gemspec +5 -290
  3. metadata +52 -345
  4. data/.bundle/config +0 -2
  5. data/CNAME +0 -1
  6. data/Gemfile +0 -16
  7. data/Gemfile.lock +0 -36
  8. data/LICENSE +0 -29
  9. data/README.md +0 -348
  10. data/bin/ninjs +0 -218
  11. data/lib/ninjs.rb +0 -10
  12. data/lib/ninjs/command.rb +0 -91
  13. data/lib/ninjs/configuration.rb +0 -72
  14. data/lib/ninjs/dependencies.rb +0 -16
  15. data/lib/ninjs/generator.rb +0 -57
  16. data/lib/ninjs/helpers.rb +0 -17
  17. data/lib/ninjs/manifest.rb +0 -9
  18. data/lib/ninjs/notification.rb +0 -37
  19. data/lib/ninjs/project.rb +0 -233
  20. data/repository/jquery/1.1.4.js +0 -2508
  21. data/repository/jquery/1.2.6.js +0 -32
  22. data/repository/jquery/1.3.2.js +0 -19
  23. data/repository/jquery/1.4.2.js +0 -154
  24. data/repository/jquery/1.4.3.js +0 -166
  25. data/repository/jquery/1.4.4.js +0 -167
  26. data/repository/jquery/1.5.js +0 -16
  27. data/repository/jquery/fancybox/1.3.1.js +0 -1079
  28. data/repository/jquery/fancybox/assets/1.3.1/css/fancybox.css +0 -363
  29. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/blank.gif +0 -0
  30. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_close.png +0 -0
  31. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_loading.png +0 -0
  32. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_nav_left.png +0 -0
  33. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_nav_right.png +0 -0
  34. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_e.png +0 -0
  35. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_n.png +0 -0
  36. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_ne.png +0 -0
  37. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_nw.png +0 -0
  38. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_s.png +0 -0
  39. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_se.png +0 -0
  40. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_sw.png +0 -0
  41. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_w.png +0 -0
  42. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_title_left.png +0 -0
  43. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_title_main.png +0 -0
  44. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_title_over.png +0 -0
  45. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_title_right.png +0 -0
  46. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancybox-x.png +0 -0
  47. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancybox-y.png +0 -0
  48. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancybox.png +0 -0
  49. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/jquery.easing-1.3.pack.js +0 -72
  50. data/repository/jquery/fancybox/latest.js +0 -1
  51. data/repository/jquery/latest.js +0 -1
  52. data/repository/jquery/mobile/1.0a3.js +0 -123
  53. data/repository/jquery/mobile/1.0a3/assets/css/jquery.mobile.css +0 -1652
  54. data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/ajax-loader.png +0 -0
  55. data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/form-check-off.png +0 -0
  56. data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/form-check-on.png +0 -0
  57. data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/form-radio-off.png +0 -0
  58. data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/form-radio-on.png +0 -0
  59. data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/icon-search-black.png +0 -0
  60. data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/icons-18-black.png +0 -0
  61. data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/icons-18-white.png +0 -0
  62. data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/icons-36-black.png +0 -0
  63. data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/icons-36-white.png +0 -0
  64. data/repository/jquery/mobile/latest.js +0 -1
  65. data/repository/jquery/mousewheel/3.0.2.js +0 -11
  66. data/repository/jquery/mousewheel/latest.js +0 -1
  67. data/repository/jquery/ui/1.8.7.js +0 -783
  68. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.accordion.css +0 -19
  69. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.all.css +0 -11
  70. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.autocomplete.css +0 -53
  71. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.base.css +0 -11
  72. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.button.css +0 -38
  73. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.core.css +0 -41
  74. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.datepicker.css +0 -68
  75. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.dialog.css +0 -21
  76. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.progressbar.css +0 -11
  77. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.resizable.css +0 -20
  78. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.selectable.css +0 -10
  79. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.slider.css +0 -24
  80. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.tabs.css +0 -18
  81. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.theme.css +0 -252
  82. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  83. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-bg_flat_75_ffffff_40x100.png +0 -0
  84. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  85. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-bg_glass_65_ffffff_1x400.png +0 -0
  86. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-bg_glass_75_dadada_1x400.png +0 -0
  87. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  88. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  89. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  90. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-icons_222222_256x240.png +0 -0
  91. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-icons_2e83ff_256x240.png +0 -0
  92. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-icons_454545_256x240.png +0 -0
  93. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-icons_888888_256x240.png +0 -0
  94. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-icons_cd0a0a_256x240.png +0 -0
  95. data/repository/jquery/ui/latest.js +0 -1
  96. data/repository/json2.js +0 -482
  97. data/repository/modernizr/1.5.js +0 -28
  98. data/repository/modernizr/latest.js +0 -1
  99. data/repository/ninjs/core/.core.pdoc.yaml +0 -0
  100. data/repository/ninjs/core/.existence.pdoc.yaml +0 -12
  101. data/repository/ninjs/core/.extend.pdoc.yaml +0 -0
  102. data/repository/ninjs/core/.nin.pdoc.yaml +0 -0
  103. data/repository/ninjs/core/application.js +0 -47
  104. data/repository/ninjs/core/existence.js +0 -277
  105. data/repository/ninjs/core/extend.js +0 -77
  106. data/repository/ninjs/core/module.js +0 -135
  107. data/repository/ninjs/core/nin.js +0 -4
  108. data/repository/ninjs/docs/Data/ClassHierarchy.nd +0 -0
  109. data/repository/ninjs/docs/Data/ConfigFileInfo.nd +0 -0
  110. data/repository/ninjs/docs/Data/FileInfo.nd +0 -16
  111. data/repository/ninjs/docs/Data/ImageFileInfo.nd +0 -0
  112. data/repository/ninjs/docs/Data/ImageReferenceTable.nd +0 -0
  113. data/repository/ninjs/docs/Data/IndexInfo.nd +0 -0
  114. data/repository/ninjs/docs/Data/PreviousMenuState.nd +0 -0
  115. data/repository/ninjs/docs/Data/PreviousSettings.nd +0 -0
  116. data/repository/ninjs/docs/Data/SymbolTable.nd +0 -0
  117. data/repository/ninjs/docs/Languages.txt +0 -113
  118. data/repository/ninjs/docs/Menu.txt +0 -63
  119. data/repository/ninjs/docs/Topics.txt +0 -81
  120. data/repository/ninjs/docs/files/core/application-js.html +0 -44
  121. data/repository/ninjs/docs/files/core/existence-js.html +0 -60
  122. data/repository/ninjs/docs/files/core/extend-js.html +0 -55
  123. data/repository/ninjs/docs/files/core/module-js.html +0 -80
  124. data/repository/ninjs/docs/files/core/nin-js.html +0 -38
  125. data/repository/ninjs/docs/index.html +0 -1
  126. data/repository/ninjs/docs/index/Classes.html +0 -33
  127. data/repository/ninjs/docs/index/Files.html +0 -45
  128. data/repository/ninjs/docs/index/Functions.html +0 -65
  129. data/repository/ninjs/docs/index/General.html +0 -85
  130. data/repository/ninjs/docs/index/Variables.html +0 -45
  131. data/repository/ninjs/docs/javascript/main.js +0 -841
  132. data/repository/ninjs/docs/javascript/prettify.js +0 -1526
  133. data/repository/ninjs/docs/javascript/searchdata.js +0 -152
  134. data/repository/ninjs/docs/search/ClassesN.html +0 -20
  135. data/repository/ninjs/docs/search/FilesA.html +0 -20
  136. data/repository/ninjs/docs/search/FilesE.html +0 -20
  137. data/repository/ninjs/docs/search/FilesM.html +0 -20
  138. data/repository/ninjs/docs/search/FilesN.html +0 -20
  139. data/repository/ninjs/docs/search/FunctionsA.html +0 -20
  140. data/repository/ninjs/docs/search/FunctionsC.html +0 -20
  141. data/repository/ninjs/docs/search/FunctionsE.html +0 -20
  142. data/repository/ninjs/docs/search/FunctionsI.html +0 -20
  143. data/repository/ninjs/docs/search/FunctionsM.html +0 -20
  144. data/repository/ninjs/docs/search/FunctionsR.html +0 -20
  145. data/repository/ninjs/docs/search/FunctionsS.html +0 -20
  146. data/repository/ninjs/docs/search/FunctionsSymbols.html +0 -20
  147. data/repository/ninjs/docs/search/FunctionsU.html +0 -20
  148. data/repository/ninjs/docs/search/GeneralA.html +0 -20
  149. data/repository/ninjs/docs/search/GeneralC.html +0 -20
  150. data/repository/ninjs/docs/search/GeneralD.html +0 -20
  151. data/repository/ninjs/docs/search/GeneralE.html +0 -20
  152. data/repository/ninjs/docs/search/GeneralF.html +0 -20
  153. data/repository/ninjs/docs/search/GeneralI.html +0 -20
  154. data/repository/ninjs/docs/search/GeneralM.html +0 -20
  155. data/repository/ninjs/docs/search/GeneralN.html +0 -20
  156. data/repository/ninjs/docs/search/GeneralR.html +0 -20
  157. data/repository/ninjs/docs/search/GeneralS.html +0 -20
  158. data/repository/ninjs/docs/search/GeneralSymbols.html +0 -20
  159. data/repository/ninjs/docs/search/GeneralT.html +0 -20
  160. data/repository/ninjs/docs/search/GeneralU.html +0 -20
  161. data/repository/ninjs/docs/search/GeneralV.html +0 -20
  162. data/repository/ninjs/docs/search/NoResults.html +0 -15
  163. data/repository/ninjs/docs/search/VariablesD.html +0 -20
  164. data/repository/ninjs/docs/search/VariablesN.html +0 -20
  165. data/repository/ninjs/docs/search/VariablesR.html +0 -20
  166. data/repository/ninjs/docs/search/VariablesT.html +0 -20
  167. data/repository/ninjs/docs/styles/main.css +0 -828
  168. data/repository/ninjs/extensions/jquery.elements.js +0 -60
  169. data/repository/ninjs/tests/index.html +0 -21
  170. data/repository/ninjs/tests/ninjs.test.js +0 -188
  171. data/repository/ninjs/tests/ninjs.utilities.test.js +0 -137
  172. data/repository/ninjs/tests/qunit/qunit.css +0 -197
  173. data/repository/ninjs/tests/qunit/qunit.js +0 -1415
  174. data/repository/ninjs/utilities/all.js +0 -5
  175. data/repository/ninjs/utilities/array.js +0 -29
  176. data/repository/ninjs/utilities/cookie.js +0 -0
  177. data/repository/ninjs/utilities/css.js +0 -51
  178. data/repository/ninjs/utilities/number.js +0 -11
  179. data/repository/ninjs/utilities/string.js +0 -61
  180. data/repository/nullconsole.js +0 -7
  181. data/repository/qunit/assets/css/qunit.css +0 -196
  182. data/repository/qunit/qunit.js +0 -1374
  183. data/repository/selectivizr/1.0.js +0 -5
  184. data/repository/selectivizr/latest.js +0 -1
  185. data/repository/syntaxhighlighter/all.js +0 -11
  186. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCore.css +0 -226
  187. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreDefault.css +0 -328
  188. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreDjango.css +0 -331
  189. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreEclipse.css +0 -339
  190. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreEmacs.css +0 -324
  191. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreFadeToGrey.css +0 -328
  192. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreMDUltra.css +0 -324
  193. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreMidnight.css +0 -324
  194. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreRDark.css +0 -324
  195. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeDefault.css +0 -117
  196. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeDjango.css +0 -120
  197. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeEclipse.css +0 -128
  198. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeEmacs.css +0 -113
  199. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeFadeToGrey.css +0 -117
  200. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeMDUltra.css +0 -113
  201. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeMidnight.css +0 -113
  202. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeRDark.css +0 -113
  203. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCore.scss +0 -216
  204. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreDefault.scss +0 -2
  205. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreDjango.scss +0 -2
  206. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreEclipse.scss +0 -2
  207. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreEmacs.scss +0 -2
  208. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreFadeToGrey.scss +0 -2
  209. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreMDUltra.scss +0 -2
  210. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreMidnight.scss +0 -2
  211. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreRDark.scss +0 -2
  212. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeDefault.scss +0 -7
  213. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeDjango.scss +0 -36
  214. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeEclipse.scss +0 -48
  215. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeEmacs.scss +0 -32
  216. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeFadeToGrey.scss +0 -36
  217. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeMDUltra.scss +0 -32
  218. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeMidnight.scss +0 -32
  219. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeRDark.scss +0 -32
  220. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_theme_template.scss +0 -120
  221. data/repository/syntaxhighlighter/shAutoloader.js +0 -17
  222. data/repository/syntaxhighlighter/shBrushAS3.js +0 -59
  223. data/repository/syntaxhighlighter/shBrushAppleScript.js +0 -75
  224. data/repository/syntaxhighlighter/shBrushBash.js +0 -59
  225. data/repository/syntaxhighlighter/shBrushCSharp.js +0 -65
  226. data/repository/syntaxhighlighter/shBrushColdFusion.js +0 -100
  227. data/repository/syntaxhighlighter/shBrushCpp.js +0 -97
  228. data/repository/syntaxhighlighter/shBrushCss.js +0 -91
  229. data/repository/syntaxhighlighter/shBrushDelphi.js +0 -55
  230. data/repository/syntaxhighlighter/shBrushDiff.js +0 -41
  231. data/repository/syntaxhighlighter/shBrushErlang.js +0 -52
  232. data/repository/syntaxhighlighter/shBrushGroovy.js +0 -67
  233. data/repository/syntaxhighlighter/shBrushJScript.js +0 -52
  234. data/repository/syntaxhighlighter/shBrushJava.js +0 -57
  235. data/repository/syntaxhighlighter/shBrushJavaFX.js +0 -58
  236. data/repository/syntaxhighlighter/shBrushPerl.js +0 -72
  237. data/repository/syntaxhighlighter/shBrushPhp.js +0 -88
  238. data/repository/syntaxhighlighter/shBrushPlain.js +0 -33
  239. data/repository/syntaxhighlighter/shBrushPowerShell.js +0 -74
  240. data/repository/syntaxhighlighter/shBrushPython.js +0 -64
  241. data/repository/syntaxhighlighter/shBrushRuby.js +0 -55
  242. data/repository/syntaxhighlighter/shBrushSass.js +0 -94
  243. data/repository/syntaxhighlighter/shBrushScala.js +0 -51
  244. data/repository/syntaxhighlighter/shBrushSql.js +0 -66
  245. data/repository/syntaxhighlighter/shBrushVb.js +0 -56
  246. data/repository/syntaxhighlighter/shBrushXml.js +0 -69
  247. data/repository/syntaxhighlighter/shCore.js +0 -17
  248. data/repository/syntaxhighlighter/shLegacy.js +0 -17
  249. data/spec/fixtures/global.js +0 -7
  250. data/spec/fixtures/global.module.js +0 -7
  251. data/spec/fixtures/myapplication.js +0 -576
  252. data/spec/fixtures/nin.js +0 -573
  253. data/spec/fixtures/ninjs.conf +0 -6
  254. data/spec/fixtures/test.elements.js +0 -4
  255. data/spec/fixtures/test.js +0 -15
  256. data/spec/fixtures/test.model.js +0 -3
  257. data/spec/fixtures/test.module.js +0 -10
  258. data/spec/fixtures/updated.myapplication.js +0 -27
  259. data/spec/fixtures/utilities.js +0 -162
  260. data/spec/helpers_spec.rb +0 -11
  261. data/spec/integration_spec.rb +0 -257
  262. data/spec/manifest_spec.rb +0 -8
  263. data/spec/ninjs_spec.rb +0 -36
  264. data/spec/notification_spec.rb +0 -27
  265. data/spec/spec_helper.rb +0 -5
  266. data/tmp/ff9e83aa019b712b90200b8d1b8fa0c7e14576af.json +0 -1
  267. data/tmp/metric_fu/_data/20110305.yml +0 -1548
  268. data/tmp/metric_fu/output/bluff-min.js +0 -1
  269. data/tmp/metric_fu/output/excanvas.js +0 -35
  270. data/tmp/metric_fu/output/js-class.js +0 -1
  271. data/tmp/metric_fu/output/lib_ninjs_dependencies.rb.html +0 -34
  272. data/tmp/metric_fu/output/lib_ninjs_helpers.rb.html +0 -34
  273. data/tmp/metric_fu/output/lib_ninjs_manifest.rb.html +0 -27
  274. data/tmp/metric_fu/output/rails_best_practices.js +0 -11
  275. data/tmp/metric_fu/scratch/rcov/rcov.txt +0 -1
@@ -1,5 +0,0 @@
1
- //= require "array"
2
- //= require "string"
3
- //= require "number"
4
- //= require "css"
5
- //= require "cookie"
@@ -1,29 +0,0 @@
1
- Array.method('is_empty', function() {
2
- return is_empty(this);
3
- });
4
-
5
- Array.method('not_empty', function() {
6
- return is_not_empty(this);
7
- });
8
-
9
- Array.method('each', function(callback) {
10
- if(is_undefined(callback)) {
11
- throw new SyntaxError("Array.each(callback): callback is undefined");
12
- }
13
-
14
- for (var i = 0; i < this.length; i++) {
15
- var args = [this[i], i];
16
- callback.apply(this, args);
17
- }
18
- });
19
-
20
- Array.method('contains', function(suspect) {
21
- var matches = [];
22
- this.each(function(value, index) {
23
- if(value === suspect) {
24
- matches.push(index);
25
- }
26
- });
27
-
28
- return matches.not_empty() ? matches : false;
29
- });
File without changes
@@ -1,51 +0,0 @@
1
- var CSS = function() {};
2
-
3
- CSS.rgb2hex = function(r,g,b) {
4
- pattern = /(\d{1,3})\,\s?(\d{1,3})\,\s?(\d{1,3})/gi;
5
- var rgb;
6
- if (is_typeof(String, r)) {
7
- rgb = r.match(pattern);
8
- rgb = rgb[0].split(',');
9
- }
10
- else {
11
- rgb = false;
12
- }
13
-
14
- if (rgb) {
15
- r = parseInt(rgb[0], 10);
16
- g = parseInt(rgb[1], 10);
17
- b = parseInt(rgb[2], 10);
18
- }
19
- else {
20
- r = parseInt(r, 10);
21
- g = parseInt(g, 10);
22
- b = parseInt(b, 10);
23
- }
24
- return '#' + r.to_hex() + g.to_hex() + b.to_hex();
25
- };
26
-
27
- CSS.hex2rgb = function(hex) {
28
- hex = hex.replace('#', '');
29
-
30
- var rgb = [];
31
-
32
- rgb[0] = parseInt(hex.substring(0,2), 16);
33
- rgb[1] = parseInt(hex.substring(2,4), 16);
34
- rgb[2] = parseInt(hex.substring(4,6), 16);
35
-
36
- rgb.red = rgb[0];
37
- rgb.green = rgb[1];
38
- rgb.blue = rgb[2];
39
-
40
- rgb.to_s = function() {
41
- return 'rgb(' + rgb.red +', ' + rgb.green + ', ' + rgb.blue + ')';
42
- };
43
-
44
- rgb.each = function(callback) {
45
- for (var i = 0; i < 3; i++) {
46
- callback.call(this, rgb[i]);
47
- }
48
- };
49
-
50
- return rgb;
51
- };
@@ -1,11 +0,0 @@
1
- Number.method('to_hex', function() {
2
- if (this === 0) {
3
- return "00";
4
- }
5
-
6
- var chars = "0123456789ABCDEF";
7
- var n = Math.max(0, this);
8
- n = Math.min(n, 255);
9
- n = Math.round(n);
10
- return chars.charAt((n - n % 16)/16) + chars.charAt(n % 16);
11
- });
@@ -1,61 +0,0 @@
1
- String.method('is_empty', function() {
2
- return (this.length < 1) ? true : false;
3
- });
4
-
5
- String.method('not_empty', function() {
6
- return (this.length < 1) ? false : true;
7
- });
8
-
9
- String.method('is_numeric', function() {
10
- var pattern = /^(\.|-)?\d+(?:\.\d*)?(?:e[+\-]?\d+)?$/i;
11
- return pattern.test(this);
12
- });
13
-
14
- String.method('trim', function() {
15
- return this.replace(/^\s+|\s+$/g, "");
16
- });
17
-
18
- String.method('ltrim', function() {
19
- return this.replace(/^\s+/,"");
20
- });
21
-
22
- String.method('rtrim', function() {
23
- return this.replace(/\s+$/,"");
24
- });
25
-
26
- String.method('each', function(callback) {
27
- if(is_undefined(callback)) {
28
- throw new SyntaxError("String.each(callback): callback is undefined");
29
- }
30
-
31
- for (var i = 0; i < this.length; i++) {
32
- var args = [this.charAt(i), i];
33
- callback.apply(this, args);
34
- }
35
- });
36
-
37
- String.method('capitalize', function() {
38
- return this.substr(0, 1).toUpperCase() + this.substr(1);
39
- });
40
-
41
- String.method('reverse', function() {
42
- return this.split('').reverse().join('');
43
- });
44
-
45
- String.method('to_n', function() {
46
- return parseFloat(this);
47
- });
48
-
49
- String.method('pluck', function(needle) {
50
- var pattern = new RegExp(needle, 'g');
51
- return this.replace(pattern, '');
52
- });
53
-
54
- String.method('single_space', function() {
55
- var no_hard_spaces = this.replace(/\&nbsp\;/g, ' ');
56
- return no_hard_spaces.replace(/\s+/g, ' ');
57
- });
58
-
59
- String.method('compress', function() {
60
- return this.replace(/\s+/g, '');
61
- });
@@ -1,7 +0,0 @@
1
- if(typeof window.console === 'undefined') {
2
- window.console = {
3
- log: function(message) {
4
- // document.writeln(message)
5
- }
6
- };
7
- }
@@ -1,196 +0,0 @@
1
- /** Font Family and Sizes */
2
-
3
- #qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult {
4
- font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;
5
- }
6
-
7
- #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; }
8
- #qunit-tests { font-size: smaller; }
9
-
10
-
11
- /** Resets */
12
-
13
- #qunit-tests, #qunit-tests ol, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult {
14
- margin: 0;
15
- padding: 0;
16
- }
17
-
18
-
19
- /** Header */
20
-
21
- #qunit-header {
22
- padding: 0.5em 0 0.5em 1em;
23
-
24
- color: #8699a4;
25
- background-color: #0d3349;
26
-
27
- font-size: 1.5em;
28
- line-height: 1em;
29
- font-weight: normal;
30
-
31
- border-radius: 15px 15px 0 0;
32
- -moz-border-radius: 15px 15px 0 0;
33
- -webkit-border-top-right-radius: 15px;
34
- -webkit-border-top-left-radius: 15px;
35
- }
36
-
37
- #qunit-header a {
38
- text-decoration: none;
39
- color: #c2ccd1;
40
- }
41
-
42
- #qunit-header a:hover,
43
- #qunit-header a:focus {
44
- color: #fff;
45
- }
46
-
47
- #qunit-banner {
48
- height: 5px;
49
- }
50
-
51
- #qunit-testrunner-toolbar {
52
- padding: 0em 0 0.5em 2em;
53
- }
54
-
55
- #qunit-userAgent {
56
- padding: 0.5em 0 0.5em 2.5em;
57
- background-color: #2b81af;
58
- color: #fff;
59
- text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
60
- }
61
-
62
-
63
- /** Tests: Pass/Fail */
64
-
65
- #qunit-tests {
66
- list-style-position: inside;
67
- }
68
-
69
- #qunit-tests li {
70
- padding: 0.4em 0.5em 0.4em 2.5em;
71
- border-bottom: 1px solid #fff;
72
- list-style-position: inside;
73
- }
74
-
75
- #qunit-tests li strong {
76
- cursor: pointer;
77
- }
78
-
79
- #qunit-tests ol {
80
- margin-top: 0.5em;
81
- padding: 0.5em;
82
-
83
- background-color: #fff;
84
-
85
- border-radius: 15px;
86
- -moz-border-radius: 15px;
87
- -webkit-border-radius: 15px;
88
-
89
- box-shadow: inset 0px 2px 13px #999;
90
- -moz-box-shadow: inset 0px 2px 13px #999;
91
- -webkit-box-shadow: inset 0px 2px 13px #999;
92
- }
93
-
94
- #qunit-tests table {
95
- border-collapse: collapse;
96
- margin-top: .2em;
97
- }
98
-
99
- #qunit-tests th {
100
- text-align: right;
101
- vertical-align: top;
102
- padding: 0 .5em 0 0;
103
- }
104
-
105
- #qunit-tests td {
106
- vertical-align: top;
107
- }
108
-
109
- #qunit-tests pre {
110
- margin: 0;
111
- white-space: pre-wrap;
112
- word-wrap: break-word;
113
- }
114
-
115
- #qunit-tests del {
116
- background-color: #e0f2be;
117
- color: #374e0c;
118
- text-decoration: none;
119
- }
120
-
121
- #qunit-tests ins {
122
- background-color: #ffcaca;
123
- color: #500;
124
- text-decoration: none;
125
- }
126
-
127
- /*** Test Counts */
128
-
129
- #qunit-tests b.counts { color: black; }
130
- #qunit-tests b.passed { color: #5E740B; }
131
- #qunit-tests b.failed { color: #710909; }
132
-
133
- #qunit-tests li li {
134
- margin: 0.5em;
135
- padding: 0.4em 0.5em 0.4em 0.5em;
136
- background-color: #fff;
137
- border-bottom: none;
138
- list-style-position: inside;
139
- }
140
-
141
- /*** Passing Styles */
142
-
143
- #qunit-tests li li.pass {
144
- color: #5E740B;
145
- background-color: #fff;
146
- border-left: 26px solid #C6E746;
147
- }
148
-
149
- #qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; }
150
- #qunit-tests .pass .test-name { color: #366097; }
151
-
152
- #qunit-tests .pass .test-actual,
153
- #qunit-tests .pass .test-expected { color: #999999; }
154
-
155
- #qunit-banner.qunit-pass { background-color: #C6E746; }
156
-
157
- /*** Failing Styles */
158
-
159
- #qunit-tests li li.fail {
160
- color: #710909;
161
- background-color: #fff;
162
- border-left: 26px solid #EE5757;
163
- }
164
-
165
- #qunit-tests .fail { color: #000000; background-color: #EE5757; }
166
- #qunit-tests .fail .test-name,
167
- #qunit-tests .fail .module-name { color: #000000; }
168
-
169
- #qunit-tests .fail .test-actual { color: #EE5757; }
170
- #qunit-tests .fail .test-expected { color: green; }
171
-
172
- #qunit-banner.qunit-fail,
173
- #qunit-testrunner-toolbar { background-color: #EE5757; }
174
-
175
-
176
- /** Footer */
177
-
178
- #qunit-testresult {
179
- padding: 0.5em 0.5em 0.5em 2.5em;
180
-
181
- color: #2b81af;
182
- background-color: #D2E0E6;
183
-
184
- border-radius: 0 0 15px 15px;
185
- -moz-border-radius: 0 0 15px 15px;
186
- -webkit-border-bottom-right-radius: 15px;
187
- -webkit-border-bottom-left-radius: 15px;
188
- }
189
-
190
- /** Fixture */
191
-
192
- #qunit-fixture {
193
- position: absolute;
194
- top: -10000px;
195
- left: -10000px;
196
- }
@@ -1,1374 +0,0 @@
1
- /*
2
- * QUnit - A JavaScript Unit Testing Framework
3
- *
4
- * http://docs.jquery.com/QUnit
5
- *
6
- * Copyright (c) 2011 John Resig, Jörn Zaefferer
7
- * Dual licensed under the MIT (MIT-LICENSE.txt)
8
- * or GPL (GPL-LICENSE.txt) licenses.
9
- */
10
-
11
- (function(window) {
12
-
13
- var defined = {
14
- setTimeout: typeof window.setTimeout !== "undefined",
15
- sessionStorage: (function() {
16
- try {
17
- return !!sessionStorage.getItem;
18
- } catch(e){
19
- return false;
20
- }
21
- })()
22
- }
23
-
24
- var testId = 0;
25
-
26
- var Test = function(name, testName, expected, testEnvironmentArg, async, callback) {
27
- this.name = name;
28
- this.testName = testName;
29
- this.expected = expected;
30
- this.testEnvironmentArg = testEnvironmentArg;
31
- this.async = async;
32
- this.callback = callback;
33
- this.assertions = [];
34
- };
35
- Test.prototype = {
36
- init: function() {
37
- var tests = id("qunit-tests");
38
- if (tests) {
39
- var b = document.createElement("strong");
40
- b.innerHTML = "Running " + this.name;
41
- var li = document.createElement("li");
42
- li.appendChild( b );
43
- li.id = this.id = "test-output" + testId++;
44
- tests.appendChild( li );
45
- }
46
- },
47
- setup: function() {
48
- if (this.module != config.previousModule) {
49
- if ( config.previousModule ) {
50
- QUnit.moduleDone( config.previousModule, config.moduleStats.bad, config.moduleStats.all );
51
- }
52
- config.previousModule = this.module;
53
- config.moduleStats = { all: 0, bad: 0 };
54
- QUnit.moduleStart( this.module, this.moduleTestEnvironment );
55
- }
56
-
57
- config.current = this;
58
- this.testEnvironment = extend({
59
- setup: function() {},
60
- teardown: function() {}
61
- }, this.moduleTestEnvironment);
62
- if (this.testEnvironmentArg) {
63
- extend(this.testEnvironment, this.testEnvironmentArg);
64
- }
65
-
66
- QUnit.testStart( this.testName, this.testEnvironment );
67
-
68
- // allow utility functions to access the current test environment
69
- // TODO why??
70
- QUnit.current_testEnvironment = this.testEnvironment;
71
-
72
- try {
73
- if ( !config.pollution ) {
74
- saveGlobal();
75
- }
76
-
77
- this.testEnvironment.setup.call(this.testEnvironment);
78
- } catch(e) {
79
- // TODO use testName instead of name for no-markup message?
80
- QUnit.ok( false, "Setup failed on " + this.name + ": " + e.message );
81
- }
82
- },
83
- run: function() {
84
- if ( this.async ) {
85
- QUnit.stop();
86
- }
87
-
88
- try {
89
- this.callback.call(this.testEnvironment);
90
- } catch(e) {
91
- // TODO use testName instead of name for no-markup message?
92
- fail("Test " + this.name + " died, exception and test follows", e, this.callback);
93
- QUnit.ok( false, "Died on test #" + (this.assertions.length + 1) + ": " + e.message + " - " + QUnit.jsDump.parse(e) );
94
- // else next test will carry the responsibility
95
- saveGlobal();
96
-
97
- // Restart the tests if they're blocking
98
- if ( config.blocking ) {
99
- start();
100
- }
101
- }
102
- },
103
- teardown: function() {
104
- try {
105
- checkPollution();
106
- this.testEnvironment.teardown.call(this.testEnvironment);
107
- } catch(e) {
108
- // TODO use testName instead of name for no-markup message?
109
- QUnit.ok( false, "Teardown failed on " + this.name + ": " + e.message );
110
- }
111
- },
112
- finish: function() {
113
- if ( this.expected && this.expected != this.assertions.length ) {
114
- QUnit.ok( false, "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run" );
115
- }
116
-
117
- var good = 0, bad = 0,
118
- tests = id("qunit-tests");
119
-
120
- config.stats.all += this.assertions.length;
121
- config.moduleStats.all += this.assertions.length;
122
-
123
- if ( tests ) {
124
- var ol = document.createElement("ol");
125
-
126
- for ( var i = 0; i < this.assertions.length; i++ ) {
127
- var assertion = this.assertions[i];
128
-
129
- var li = document.createElement("li");
130
- li.className = assertion.result ? "pass" : "fail";
131
- li.innerHTML = assertion.message || (assertion.result ? "okay" : "failed");
132
- ol.appendChild( li );
133
-
134
- if ( assertion.result ) {
135
- good++;
136
- } else {
137
- bad++;
138
- config.stats.bad++;
139
- config.moduleStats.bad++;
140
- }
141
- }
142
-
143
- // store result when possible
144
- defined.sessionStorage && sessionStorage.setItem("qunit-" + this.testName, bad);
145
-
146
- if (bad == 0) {
147
- ol.style.display = "none";
148
- }
149
-
150
- var b = document.createElement("strong");
151
- b.innerHTML = this.name + " <b class='counts'>(<b class='failed'>" + bad + "</b>, <b class='passed'>" + good + "</b>, " + this.assertions.length + ")</b>";
152
-
153
- addEvent(b, "click", function() {
154
- var next = b.nextSibling, display = next.style.display;
155
- next.style.display = display === "none" ? "block" : "none";
156
- });
157
-
158
- addEvent(b, "dblclick", function(e) {
159
- var target = e && e.target ? e.target : window.event.srcElement;
160
- if ( target.nodeName.toLowerCase() == "span" || target.nodeName.toLowerCase() == "b" ) {
161
- target = target.parentNode;
162
- }
163
- if ( window.location && target.nodeName.toLowerCase() === "strong" ) {
164
- window.location.search = "?" + encodeURIComponent(getText([target]).replace(/\(.+\)$/, "").replace(/(^\s*|\s*$)/g, ""));
165
- }
166
- });
167
-
168
- var li = id(this.id);
169
- li.className = bad ? "fail" : "pass";
170
- li.style.display = resultDisplayStyle(!bad);
171
- li.removeChild( li.firstChild );
172
- li.appendChild( b );
173
- li.appendChild( ol );
174
-
175
- if ( bad ) {
176
- var toolbar = id("qunit-testrunner-toolbar");
177
- if ( toolbar ) {
178
- toolbar.style.display = "block";
179
- id("qunit-filter-pass").disabled = null;
180
- }
181
- }
182
-
183
- } else {
184
- for ( var i = 0; i < this.assertions.length; i++ ) {
185
- if ( !this.assertions[i].result ) {
186
- bad++;
187
- config.stats.bad++;
188
- config.moduleStats.bad++;
189
- }
190
- }
191
- }
192
-
193
- try {
194
- QUnit.reset();
195
- } catch(e) {
196
- // TODO use testName instead of name for no-markup message?
197
- fail("reset() failed, following Test " + this.name + ", exception and reset fn follows", e, QUnit.reset);
198
- }
199
-
200
- QUnit.testDone( this.testName, bad, this.assertions.length );
201
- },
202
-
203
- queue: function() {
204
- var test = this;
205
- synchronize(function() {
206
- test.init();
207
- });
208
- function run() {
209
- // each of these can by async
210
- synchronize(function() {
211
- test.setup();
212
- });
213
- synchronize(function() {
214
- test.run();
215
- });
216
- synchronize(function() {
217
- test.teardown();
218
- });
219
- synchronize(function() {
220
- test.finish();
221
- });
222
- }
223
- // defer when previous test run passed, if storage is available
224
- var bad = defined.sessionStorage && +sessionStorage.getItem("qunit-" + this.testName);
225
- if (bad) {
226
- run();
227
- } else {
228
- synchronize(run);
229
- };
230
- }
231
-
232
- }
233
-
234
- var QUnit = {
235
-
236
- // call on start of module test to prepend name to all tests
237
- module: function(name, testEnvironment) {
238
- config.currentModule = name;
239
- config.currentModuleTestEnviroment = testEnvironment;
240
- },
241
-
242
- asyncTest: function(testName, expected, callback) {
243
- if ( arguments.length === 2 ) {
244
- callback = expected;
245
- expected = 0;
246
- }
247
-
248
- QUnit.test(testName, expected, callback, true);
249
- },
250
-
251
- test: function(testName, expected, callback, async) {
252
- var name = '<span class="test-name">' + testName + '</span>', testEnvironmentArg;
253
-
254
- if ( arguments.length === 2 ) {
255
- callback = expected;
256
- expected = null;
257
- }
258
- // is 2nd argument a testEnvironment?
259
- if ( expected && typeof expected === 'object') {
260
- testEnvironmentArg = expected;
261
- expected = null;
262
- }
263
-
264
- if ( config.currentModule ) {
265
- name = '<span class="module-name">' + config.currentModule + "</span>: " + name;
266
- }
267
-
268
- if ( !validTest(config.currentModule + ": " + testName) ) {
269
- return;
270
- }
271
-
272
- var test = new Test(name, testName, expected, testEnvironmentArg, async, callback);
273
- test.module = config.currentModule;
274
- test.moduleTestEnvironment = config.currentModuleTestEnviroment;
275
- test.queue();
276
- },
277
-
278
- /**
279
- * Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through.
280
- */
281
- expect: function(asserts) {
282
- config.current.expected = asserts;
283
- },
284
-
285
- /**
286
- * Asserts true.
287
- * @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" );
288
- */
289
- ok: function(a, msg) {
290
- a = !!a;
291
- var details = {
292
- result: a,
293
- message: msg
294
- };
295
- msg = escapeHtml(msg);
296
- QUnit.log(a, msg, details);
297
- config.current.assertions.push({
298
- result: a,
299
- message: msg
300
- });
301
- },
302
-
303
- /**
304
- * Checks that the first two arguments are equal, with an optional message.
305
- * Prints out both actual and expected values.
306
- *
307
- * Prefered to ok( actual == expected, message )
308
- *
309
- * @example equal( format("Received {0} bytes.", 2), "Received 2 bytes." );
310
- *
311
- * @param Object actual
312
- * @param Object expected
313
- * @param String message (optional)
314
- */
315
- equal: function(actual, expected, message) {
316
- QUnit.push(expected == actual, actual, expected, message);
317
- },
318
-
319
- notEqual: function(actual, expected, message) {
320
- QUnit.push(expected != actual, actual, expected, message);
321
- },
322
-
323
- deepEqual: function(actual, expected, message) {
324
- QUnit.push(QUnit.equiv(actual, expected), actual, expected, message);
325
- },
326
-
327
- notDeepEqual: function(actual, expected, message) {
328
- QUnit.push(!QUnit.equiv(actual, expected), actual, expected, message);
329
- },
330
-
331
- strictEqual: function(actual, expected, message) {
332
- QUnit.push(expected === actual, actual, expected, message);
333
- },
334
-
335
- notStrictEqual: function(actual, expected, message) {
336
- QUnit.push(expected !== actual, actual, expected, message);
337
- },
338
-
339
- raises: function(block, expected, message) {
340
- var actual, ok = false;
341
-
342
- if (typeof expected === 'string') {
343
- message = expected;
344
- expected = null;
345
- }
346
-
347
- try {
348
- block();
349
- } catch (e) {
350
- actual = e;
351
- }
352
-
353
- if (actual) {
354
- // we don't want to validate thrown error
355
- if (!expected) {
356
- ok = true;
357
- // expected is a regexp
358
- } else if (QUnit.objectType(expected) === "regexp") {
359
- ok = expected.test(actual);
360
- // expected is a constructor
361
- } else if (actual instanceof expected) {
362
- ok = true;
363
- // expected is a validation function which returns true is validation passed
364
- } else if (expected.call({}, actual) === true) {
365
- ok = true;
366
- }
367
- }
368
-
369
- QUnit.ok(ok, message);
370
- },
371
-
372
- start: function() {
373
- config.semaphore--;
374
- if (config.semaphore > 0) {
375
- // don't start until equal number of stop-calls
376
- return;
377
- }
378
- if (config.semaphore < 0) {
379
- // ignore if start is called more often then stop
380
- config.semaphore = 0;
381
- }
382
- // A slight delay, to avoid any current callbacks
383
- if ( defined.setTimeout ) {
384
- window.setTimeout(function() {
385
- if ( config.timeout ) {
386
- clearTimeout(config.timeout);
387
- }
388
-
389
- config.blocking = false;
390
- process();
391
- }, 13);
392
- } else {
393
- config.blocking = false;
394
- process();
395
- }
396
- },
397
-
398
- stop: function(timeout) {
399
- config.semaphore++;
400
- config.blocking = true;
401
-
402
- if ( timeout && defined.setTimeout ) {
403
- clearTimeout(config.timeout);
404
- config.timeout = window.setTimeout(function() {
405
- QUnit.ok( false, "Test timed out" );
406
- QUnit.start();
407
- }, timeout);
408
- }
409
- }
410
-
411
- };
412
-
413
- // Backwards compatibility, deprecated
414
- QUnit.equals = QUnit.equal;
415
- QUnit.same = QUnit.deepEqual;
416
-
417
- // Maintain internal state
418
- var config = {
419
- // The queue of tests to run
420
- queue: [],
421
-
422
- // block until document ready
423
- blocking: true
424
- };
425
-
426
- // Load paramaters
427
- (function() {
428
- var location = window.location || { search: "", protocol: "file:" },
429
- GETParams = location.search.slice(1).split('&');
430
-
431
- for ( var i = 0; i < GETParams.length; i++ ) {
432
- GETParams[i] = decodeURIComponent( GETParams[i] );
433
- if ( GETParams[i] === "noglobals" ) {
434
- GETParams.splice( i, 1 );
435
- i--;
436
- config.noglobals = true;
437
- } else if ( GETParams[i].search('=') > -1 ) {
438
- GETParams.splice( i, 1 );
439
- i--;
440
- }
441
- }
442
-
443
- // restrict modules/tests by get parameters
444
- config.filters = GETParams;
445
-
446
- // Figure out if we're running the tests from a server or not
447
- QUnit.isLocal = !!(location.protocol === 'file:');
448
- })();
449
-
450
- // Expose the API as global variables, unless an 'exports'
451
- // object is_defined, in that case we assume we're in CommonJS
452
- if ( typeof exports === "undefined" || typeof require === "undefined" ) {
453
- extend(window, QUnit);
454
- window.QUnit = QUnit;
455
- } else {
456
- extend(exports, QUnit);
457
- exports.QUnit = QUnit;
458
- }
459
-
460
- // define these after exposing globals to keep them in these QUnit namespace only
461
- extend(QUnit, {
462
- config: config,
463
-
464
- // Initialize the configuration options
465
- init: function() {
466
- extend(config, {
467
- stats: { all: 0, bad: 0 },
468
- moduleStats: { all: 0, bad: 0 },
469
- started: +new Date,
470
- updateRate: 1000,
471
- blocking: false,
472
- autostart: true,
473
- autorun: false,
474
- filters: [],
475
- queue: [],
476
- semaphore: 0
477
- });
478
-
479
- var tests = id("qunit-tests"),
480
- banner = id("qunit-banner"),
481
- result = id("qunit-testresult");
482
-
483
- if ( tests ) {
484
- tests.innerHTML = "";
485
- }
486
-
487
- if ( banner ) {
488
- banner.className = "";
489
- }
490
-
491
- if ( result ) {
492
- result.parentNode.removeChild( result );
493
- }
494
- },
495
-
496
- /**
497
- * Resets the test setup. Useful for tests that modify the DOM.
498
- *
499
- * If jQuery is available, uses jQuery's html(), otherwise just innerHTML.
500
- */
501
- reset: function() {
502
- if ( window.jQuery ) {
503
- jQuery( "#main, #qunit-fixture" ).html( config.fixture );
504
- } else {
505
- var main = id( 'main' ) || id( 'qunit-fixture' );
506
- if ( main ) {
507
- main.innerHTML = config.fixture;
508
- }
509
- }
510
- },
511
-
512
- /**
513
- * Trigger an event on an element.
514
- *
515
- * @example triggerEvent( document.body, "click" );
516
- *
517
- * @param DOMElement elem
518
- * @param String type
519
- */
520
- triggerEvent: function( elem, type, event ) {
521
- if ( document.createEvent ) {
522
- event = document.createEvent("MouseEvents");
523
- event.initMouseEvent(type, true, true, elem.ownerDocument.defaultView,
524
- 0, 0, 0, 0, 0, false, false, false, false, 0, null);
525
- elem.dispatchEvent( event );
526
-
527
- } else if ( elem.fireEvent ) {
528
- elem.fireEvent("on"+type);
529
- }
530
- },
531
-
532
- // Safe object type checking
533
- is: function( type, obj ) {
534
- return QUnit.objectType( obj ) == type;
535
- },
536
-
537
- objectType: function( obj ) {
538
- if (typeof obj === "undefined") {
539
- return "undefined";
540
-
541
- // consider: typeof null === object
542
- }
543
- if (obj === null) {
544
- return "null";
545
- }
546
-
547
- var type = Object.prototype.toString.call( obj )
548
- .match(/^\[object\s(.*)\]$/)[1] || '';
549
-
550
- switch (type) {
551
- case 'Number':
552
- if (isNaN(obj)) {
553
- return "nan";
554
- } else {
555
- return "number";
556
- }
557
- case 'String':
558
- case 'Boolean':
559
- case 'Array':
560
- case 'Date':
561
- case 'RegExp':
562
- case 'Function':
563
- return type.toLowerCase();
564
- }
565
- if (typeof obj === "object") {
566
- return "object";
567
- }
568
- return undefined;
569
- },
570
-
571
- push: function(result, actual, expected, message) {
572
- var details = {
573
- result: result,
574
- message: message,
575
- actual: actual,
576
- expected: expected
577
- };
578
-
579
- message = escapeHtml(message) || (result ? "okay" : "failed");
580
- message = '<span class="test-message">' + message + "</span>";
581
- expected = escapeHtml(QUnit.jsDump.parse(expected));
582
- actual = escapeHtml(QUnit.jsDump.parse(actual));
583
- var output = message + '<table><tr class="test-expected"><th>Expected: </th><td><pre>' + expected + '</pre></td></tr>';
584
- if (actual != expected) {
585
- output += '<tr class="test-actual"><th>Result: </th><td><pre>' + actual + '</pre></td></tr>';
586
- output += '<tr class="test-diff"><th>Diff: </th><td><pre>' + QUnit.diff(expected, actual) +'</pre></td></tr>';
587
- }
588
- if (!result) {
589
- var source = sourceFromStacktrace();
590
- if (source) {
591
- details.source = source;
592
- output += '<tr class="test-source"><th>Source: </th><td><pre>' + source +'</pre></td></tr>';
593
- }
594
- }
595
- output += "</table>";
596
-
597
- QUnit.log(result, message, details);
598
-
599
- config.current.assertions.push({
600
- result: !!result,
601
- message: output
602
- });
603
- },
604
-
605
- // Logging callbacks
606
- begin: function() {},
607
- done: function(failures, total) {},
608
- log: function(result, message) {},
609
- testStart: function(name, testEnvironment) {},
610
- testDone: function(name, failures, total) {},
611
- moduleStart: function(name, testEnvironment) {},
612
- moduleDone: function(name, failures, total) {}
613
- });
614
-
615
- if ( typeof document === "undefined" || document.readyState === "complete" ) {
616
- config.autorun = true;
617
- }
618
-
619
- addEvent(window, "load", function() {
620
- QUnit.begin();
621
-
622
- // Initialize the config, saving the execution queue
623
- var oldconfig = extend({}, config);
624
- QUnit.init();
625
- extend(config, oldconfig);
626
-
627
- config.blocking = false;
628
-
629
- var userAgent = id("qunit-userAgent");
630
- if ( userAgent ) {
631
- userAgent.innerHTML = navigator.userAgent;
632
- }
633
- var banner = id("qunit-header");
634
- if ( banner ) {
635
- var paramsIndex = location.href.lastIndexOf(location.search);
636
- if ( paramsIndex > -1 ) {
637
- var mainPageLocation = location.href.slice(0, paramsIndex);
638
- if ( mainPageLocation == location.href ) {
639
- banner.innerHTML = '<a href=""> ' + banner.innerHTML + '</a> ';
640
- } else {
641
- var testName = decodeURIComponent(location.search.slice(1));
642
- banner.innerHTML = '<a href="' + mainPageLocation + '">' + banner.innerHTML + '</a> &#8250; <a href="">' + testName + '</a>';
643
- }
644
- }
645
- }
646
-
647
- var toolbar = id("qunit-testrunner-toolbar");
648
- if ( toolbar ) {
649
- toolbar.style.display = "none";
650
-
651
- var filter = document.createElement("input");
652
- filter.type = "checkbox";
653
- filter.id = "qunit-filter-pass";
654
- filter.disabled = true;
655
- addEvent( filter, "click", function() {
656
- var li = document.getElementsByTagName("li");
657
- for ( var i = 0; i < li.length; i++ ) {
658
- if ( li[i].className.indexOf("pass") > -1 ) {
659
- li[i].style.display = filter.checked ? "none" : "";
660
- }
661
- }
662
- });
663
- toolbar.appendChild( filter );
664
-
665
- var label = document.createElement("label");
666
- label.setAttribute("for", "qunit-filter-pass");
667
- label.innerHTML = "Hide passed tests";
668
- toolbar.appendChild( label );
669
- }
670
-
671
- var main = id('main') || id('qunit-fixture');
672
- if ( main ) {
673
- config.fixture = main.innerHTML;
674
- }
675
-
676
- if (config.autostart) {
677
- QUnit.start();
678
- }
679
- });
680
-
681
- function done() {
682
- config.autorun = true;
683
-
684
- // Log the last module results
685
- if ( config.currentModule ) {
686
- QUnit.moduleDone( config.currentModule, config.moduleStats.bad, config.moduleStats.all );
687
- }
688
-
689
- var banner = id("qunit-banner"),
690
- tests = id("qunit-tests"),
691
- html = ['Tests completed in ',
692
- +new Date - config.started, ' milliseconds.<br/>',
693
- '<span class="passed">', config.stats.all - config.stats.bad, '</span> tests of <span class="total">', config.stats.all, '</span> passed, <span class="failed">', config.stats.bad,'</span> failed.'].join('');
694
-
695
- if ( banner ) {
696
- banner.className = (config.stats.bad ? "qunit-fail" : "qunit-pass");
697
- }
698
-
699
- if ( tests ) {
700
- var result = id("qunit-testresult");
701
-
702
- if ( !result ) {
703
- result = document.createElement("p");
704
- result.id = "qunit-testresult";
705
- result.className = "result";
706
- tests.parentNode.insertBefore( result, tests.nextSibling );
707
- }
708
-
709
- result.innerHTML = html;
710
- }
711
-
712
- QUnit.done( config.stats.bad, config.stats.all );
713
- }
714
-
715
- function validTest( name ) {
716
- var i = config.filters.length,
717
- run = false;
718
-
719
- if ( !i ) {
720
- return true;
721
- }
722
-
723
- while ( i-- ) {
724
- var filter = config.filters[i],
725
- not = filter.charAt(0) == '!';
726
-
727
- if ( not ) {
728
- filter = filter.slice(1);
729
- }
730
-
731
- if ( name.indexOf(filter) !== -1 ) {
732
- return !not;
733
- }
734
-
735
- if ( not ) {
736
- run = true;
737
- }
738
- }
739
-
740
- return run;
741
- }
742
-
743
- // so far supports only Firefox, Chrome and Opera (buggy)
744
- // could be extended in the future to use something like https://github.com/csnover/TraceKit
745
- function sourceFromStacktrace() {
746
- try {
747
- throw new Error();
748
- } catch ( e ) {
749
- if (e.stacktrace) {
750
- // Opera
751
- return e.stacktrace.split("\n")[6];
752
- } else if (e.stack) {
753
- // Firefox, Chrome
754
- return e.stack.split("\n")[4];
755
- }
756
- }
757
- }
758
-
759
- function resultDisplayStyle(passed) {
760
- return passed && id("qunit-filter-pass") && id("qunit-filter-pass").checked ? 'none' : '';
761
- }
762
-
763
- function escapeHtml(s) {
764
- if (!s) {
765
- return "";
766
- }
767
- s = s + "";
768
- return s.replace(/[\&"<>\\]/g, function(s) {
769
- switch(s) {
770
- case "&": return "&amp;";
771
- case "\\": return "\\\\";
772
- case '"': return '\"';
773
- case "<": return "&lt;";
774
- case ">": return "&gt;";
775
- default: return s;
776
- }
777
- });
778
- }
779
-
780
- function synchronize( callback ) {
781
- config.queue.push( callback );
782
-
783
- if ( config.autorun && !config.blocking ) {
784
- process();
785
- }
786
- }
787
-
788
- function process() {
789
- var start = (new Date()).getTime();
790
-
791
- while ( config.queue.length && !config.blocking ) {
792
- if ( config.updateRate <= 0 || (((new Date()).getTime() - start) < config.updateRate) ) {
793
- config.queue.shift()();
794
- } else {
795
- window.setTimeout( process, 13 );
796
- break;
797
- }
798
- }
799
- if (!config.blocking && !config.queue.length) {
800
- done();
801
- }
802
- }
803
-
804
- function saveGlobal() {
805
- config.pollution = [];
806
-
807
- if ( config.noglobals ) {
808
- for ( var key in window ) {
809
- config.pollution.push( key );
810
- }
811
- }
812
- }
813
-
814
- function checkPollution( name ) {
815
- var old = config.pollution;
816
- saveGlobal();
817
-
818
- var newGlobals = diff( old, config.pollution );
819
- if ( newGlobals.length > 0 ) {
820
- ok( false, "Introduced global variable(s): " + newGlobals.join(", ") );
821
- config.current.expected++;
822
- }
823
-
824
- var deletedGlobals = diff( config.pollution, old );
825
- if ( deletedGlobals.length > 0 ) {
826
- ok( false, "Deleted global variable(s): " + deletedGlobals.join(", ") );
827
- config.current.expected++;
828
- }
829
- }
830
-
831
- // returns a new Array with the elements that are in a but not in b
832
- function diff( a, b ) {
833
- var result = a.slice();
834
- for ( var i = 0; i < result.length; i++ ) {
835
- for ( var j = 0; j < b.length; j++ ) {
836
- if ( result[i] === b[j] ) {
837
- result.splice(i, 1);
838
- i--;
839
- break;
840
- }
841
- }
842
- }
843
- return result;
844
- }
845
-
846
- function fail(message, exception, callback) {
847
- if ( typeof console !== "undefined" && console.error && console.warn ) {
848
- console.error(message);
849
- console.error(exception);
850
- console.warn(callback.toString());
851
-
852
- } else if ( window.opera && opera.postError ) {
853
- opera.postError(message, exception, callback.toString);
854
- }
855
- }
856
-
857
- function extend(a, b) {
858
- for ( var prop in b ) {
859
- a[prop] = b[prop];
860
- }
861
-
862
- return a;
863
- }
864
-
865
- function addEvent(elem, type, fn) {
866
- if ( elem.addEventListener ) {
867
- elem.addEventListener( type, fn, false );
868
- } else if ( elem.attachEvent ) {
869
- elem.attachEvent( "on" + type, fn );
870
- } else {
871
- fn();
872
- }
873
- }
874
-
875
- function id(name) {
876
- return !!(typeof document !== "undefined" && document && document.getElementById) &&
877
- document.getElementById( name );
878
- }
879
-
880
- // Test for equality any JavaScript type.
881
- // Discussions and reference: http://philrathe.com/articles/equiv
882
- // Test suites: http://philrathe.com/tests/equiv
883
- // Author: Philippe Rathé <prathe@gmail.com>
884
- QUnit.equiv = function () {
885
-
886
- var innerEquiv; // the real equiv function
887
- var callers = []; // stack to decide between skip/abort functions
888
- var parents = []; // stack to avoiding loops from circular referencing
889
-
890
- // Call the o related callback with the given arguments.
891
- function bindCallbacks(o, callbacks, args) {
892
- var prop = QUnit.objectType(o);
893
- if (prop) {
894
- if (QUnit.objectType(callbacks[prop]) === "function") {
895
- return callbacks[prop].apply(callbacks, args);
896
- } else {
897
- return callbacks[prop]; // or undefined
898
- }
899
- }
900
- }
901
-
902
- var callbacks = function () {
903
-
904
- // for string, boolean, number and null
905
- function useStrictEquality(b, a) {
906
- if (b instanceof a.constructor || a instanceof b.constructor) {
907
- // to catch short annotaion VS 'new' annotation of a declaration
908
- // e.g. var i = 1;
909
- // var j = new Number(1);
910
- return a == b;
911
- } else {
912
- return a === b;
913
- }
914
- }
915
-
916
- return {
917
- "string": useStrictEquality,
918
- "boolean": useStrictEquality,
919
- "number": useStrictEquality,
920
- "null": useStrictEquality,
921
- "undefined": useStrictEquality,
922
-
923
- "nan": function (b) {
924
- return isNaN(b);
925
- },
926
-
927
- "date": function (b, a) {
928
- return QUnit.objectType(b) === "date" && a.valueOf() === b.valueOf();
929
- },
930
-
931
- "regexp": function (b, a) {
932
- return QUnit.objectType(b) === "regexp" &&
933
- a.source === b.source && // the regex itself
934
- a.global === b.global && // and its modifers (gmi) ...
935
- a.ignoreCase === b.ignoreCase &&
936
- a.multiline === b.multiline;
937
- },
938
-
939
- // - skip when the property is a method of an instance (OOP)
940
- // - abort otherwise,
941
- // initial === would have catch identical references anyway
942
- "function": function () {
943
- var caller = callers[callers.length - 1];
944
- return caller !== Object &&
945
- typeof caller !== "undefined";
946
- },
947
-
948
- "array": function (b, a) {
949
- var i, j, loop;
950
- var len;
951
-
952
- // b could be an object literal here
953
- if ( ! (QUnit.objectType(b) === "array")) {
954
- return false;
955
- }
956
-
957
- len = a.length;
958
- if (len !== b.length) { // safe and faster
959
- return false;
960
- }
961
-
962
- //track reference to avoid circular references
963
- parents.push(a);
964
- for (i = 0; i < len; i++) {
965
- loop = false;
966
- for(j=0;j<parents.length;j++){
967
- if(parents[j] === a[i]){
968
- loop = true;//dont rewalk array
969
- }
970
- }
971
- if (!loop && ! innerEquiv(a[i], b[i])) {
972
- parents.pop();
973
- return false;
974
- }
975
- }
976
- parents.pop();
977
- return true;
978
- },
979
-
980
- "object": function (b, a) {
981
- var i, j, loop;
982
- var eq = true; // unless we can proove it
983
- var aProperties = [], bProperties = []; // collection of strings
984
-
985
- // comparing constructors is more strict than using instanceof
986
- if ( a.constructor !== b.constructor) {
987
- return false;
988
- }
989
-
990
- // stack constructor before traversing properties
991
- callers.push(a.constructor);
992
- //track reference to avoid circular references
993
- parents.push(a);
994
-
995
- for (i in a) { // be strict: don't ensures hasOwnProperty and go deep
996
- loop = false;
997
- for(j=0;j<parents.length;j++){
998
- if(parents[j] === a[i])
999
- loop = true; //don't go down the same path twice
1000
- }
1001
- aProperties.push(i); // collect a's properties
1002
-
1003
- if (!loop && ! innerEquiv(a[i], b[i])) {
1004
- eq = false;
1005
- break;
1006
- }
1007
- }
1008
-
1009
- callers.pop(); // unstack, we are done
1010
- parents.pop();
1011
-
1012
- for (i in b) {
1013
- bProperties.push(i); // collect b's properties
1014
- }
1015
-
1016
- // Ensures identical properties name
1017
- return eq && innerEquiv(aProperties.sort(), bProperties.sort());
1018
- }
1019
- };
1020
- }();
1021
-
1022
- innerEquiv = function () { // can take multiple arguments
1023
- var args = Array.prototype.slice.apply(arguments);
1024
- if (args.length < 2) {
1025
- return true; // end transition
1026
- }
1027
-
1028
- return (function (a, b) {
1029
- if (a === b) {
1030
- return true; // catch the most you can
1031
- } else if (a === null || b === null || typeof a === "undefined" || typeof b === "undefined" || QUnit.objectType(a) !== QUnit.objectType(b)) {
1032
- return false; // don't lose time with error prone cases
1033
- } else {
1034
- return bindCallbacks(a, callbacks, [b, a]);
1035
- }
1036
-
1037
- // apply transition with (1..n) arguments
1038
- })(args[0], args[1]) && arguments.callee.apply(this, args.splice(1, args.length -1));
1039
- };
1040
-
1041
- return innerEquiv;
1042
-
1043
- }();
1044
-
1045
- /**
1046
- * jsDump
1047
- * Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
1048
- * Licensed under BSD (http://www.opensource.org/licenses/bsd-license.php)
1049
- * Date: 5/15/2008
1050
- * @projectDescription Advanced and extensible data dumping for Javascript.
1051
- * @version 1.0.0
1052
- * @author Ariel Flesler
1053
- * @link {http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html}
1054
- */
1055
- QUnit.jsDump = (function() {
1056
- function quote( str ) {
1057
- return '"' + str.toString().replace(/"/g, '\\"') + '"';
1058
- };
1059
- function literal( o ) {
1060
- return o + '';
1061
- };
1062
- function join( pre, arr, post ) {
1063
- var s = jsDump.separator(),
1064
- base = jsDump.indent(),
1065
- inner = jsDump.indent(1);
1066
- if ( arr.join )
1067
- arr = arr.join( ',' + s + inner );
1068
- if ( !arr )
1069
- return pre + post;
1070
- return [ pre, inner + arr, base + post ].join(s);
1071
- };
1072
- function array( arr ) {
1073
- var i = arr.length, ret = Array(i);
1074
- this.up();
1075
- while ( i-- )
1076
- ret[i] = this.parse( arr[i] );
1077
- this.down();
1078
- return join( '[', ret, ']' );
1079
- };
1080
-
1081
- var reName = /^function (\w+)/;
1082
-
1083
- var jsDump = {
1084
- parse:function( obj, type ) { //type is used mostly internally, you can fix a (custom)type in advance
1085
- var parser = this.parsers[ type || this.typeOf(obj) ];
1086
- type = typeof parser;
1087
-
1088
- return type == 'function' ? parser.call( this, obj ) :
1089
- type == 'string' ? parser :
1090
- this.parsers.error;
1091
- },
1092
- typeOf:function( obj ) {
1093
- var type;
1094
- if ( obj === null ) {
1095
- type = "null";
1096
- } else if (typeof obj === "undefined") {
1097
- type = "undefined";
1098
- } else if (QUnit.is("RegExp", obj)) {
1099
- type = "regexp";
1100
- } else if (QUnit.is("Date", obj)) {
1101
- type = "date";
1102
- } else if (QUnit.is("Function", obj)) {
1103
- type = "function";
1104
- } else if (typeof obj.setInterval !== undefined && typeof obj.document !== "undefined" && typeof obj.nodeType === "undefined") {
1105
- type = "window";
1106
- } else if (obj.nodeType === 9) {
1107
- type = "document";
1108
- } else if (obj.nodeType) {
1109
- type = "node";
1110
- } else if (typeof obj === "object" && typeof obj.length === "number" && obj.length >= 0) {
1111
- type = "array";
1112
- } else {
1113
- type = typeof obj;
1114
- }
1115
- return type;
1116
- },
1117
- separator:function() {
1118
- return this.multiline ? this.HTML ? '<br />' : '\n' : this.HTML ? '&nbsp;' : ' ';
1119
- },
1120
- indent:function( extra ) {// extra can be a number, shortcut for increasing-calling-decreasing
1121
- if ( !this.multiline )
1122
- return '';
1123
- var chr = this.indentChar;
1124
- if ( this.HTML )
1125
- chr = chr.replace(/\t/g,' ').replace(/ /g,'&nbsp;');
1126
- return Array( this._depth_ + (extra||0) ).join(chr);
1127
- },
1128
- up:function( a ) {
1129
- this._depth_ += a || 1;
1130
- },
1131
- down:function( a ) {
1132
- this._depth_ -= a || 1;
1133
- },
1134
- setParser:function( name, parser ) {
1135
- this.parsers[name] = parser;
1136
- },
1137
- // The next 3 are exposed so you can use them
1138
- quote:quote,
1139
- literal:literal,
1140
- join:join,
1141
- //
1142
- _depth_: 1,
1143
- // This is the list of parsers, to modify them, use jsDump.setParser
1144
- parsers:{
1145
- window: '[Window]',
1146
- document: '[Document]',
1147
- error:'[ERROR]', //when no parser is found, shouldn't happen
1148
- unknown: '[Unknown]',
1149
- 'null':'null',
1150
- undefined:'undefined',
1151
- 'function':function( fn ) {
1152
- var ret = 'function',
1153
- name = 'name' in fn ? fn.name : (reName.exec(fn)||[])[1];//functions never have name in IE
1154
- if ( name )
1155
- ret += ' ' + name;
1156
- ret += '(';
1157
-
1158
- ret = [ ret, QUnit.jsDump.parse( fn, 'functionArgs' ), '){'].join('');
1159
- return join( ret, QUnit.jsDump.parse(fn,'functionCode'), '}' );
1160
- },
1161
- array: array,
1162
- nodelist: array,
1163
- arguments: array,
1164
- object:function( map ) {
1165
- var ret = [ ];
1166
- QUnit.jsDump.up();
1167
- for ( var key in map )
1168
- ret.push( QUnit.jsDump.parse(key,'key') + ': ' + QUnit.jsDump.parse(map[key]) );
1169
- QUnit.jsDump.down();
1170
- return join( '{', ret, '}' );
1171
- },
1172
- node:function( node ) {
1173
- var open = QUnit.jsDump.HTML ? '&lt;' : '<',
1174
- close = QUnit.jsDump.HTML ? '&gt;' : '>';
1175
-
1176
- var tag = node.nodeName.toLowerCase(),
1177
- ret = open + tag;
1178
-
1179
- for ( var a in QUnit.jsDump.DOMAttrs ) {
1180
- var val = node[QUnit.jsDump.DOMAttrs[a]];
1181
- if ( val )
1182
- ret += ' ' + a + '=' + QUnit.jsDump.parse( val, 'attribute' );
1183
- }
1184
- return ret + close + open + '/' + tag + close;
1185
- },
1186
- functionArgs:function( fn ) {//function calls it internally, it's the arguments part of the function
1187
- var l = fn.length;
1188
- if ( !l ) return '';
1189
-
1190
- var args = Array(l);
1191
- while ( l-- )
1192
- args[l] = String.fromCharCode(97+l);//97 is 'a'
1193
- return ' ' + args.join(', ') + ' ';
1194
- },
1195
- key:quote, //object calls it internally, the key part of an item in a map
1196
- functionCode:'[code]', //function calls it internally, it's the content of the function
1197
- attribute:quote, //node calls it internally, it's an html attribute value
1198
- string:quote,
1199
- date:quote,
1200
- regexp:literal, //regex
1201
- number:literal,
1202
- 'boolean':literal
1203
- },
1204
- DOMAttrs:{//attributes to dump from nodes, name=>realName
1205
- id:'id',
1206
- name:'name',
1207
- 'class':'className'
1208
- },
1209
- HTML:false,//if true, entities are escaped ( <, >, \t, space and \n )
1210
- indentChar:' ',//indentation unit
1211
- multiline:true //if true, items in a collection, are separated by a \n, else just a space.
1212
- };
1213
-
1214
- return jsDump;
1215
- })();
1216
-
1217
- // from Sizzle.js
1218
- function getText( elems ) {
1219
- var ret = "", elem;
1220
-
1221
- for ( var i = 0; elems[i]; i++ ) {
1222
- elem = elems[i];
1223
-
1224
- // Get the text from text nodes and CDATA nodes
1225
- if ( elem.nodeType === 3 || elem.nodeType === 4 ) {
1226
- ret += elem.nodeValue;
1227
-
1228
- // Traverse everything else, except comment nodes
1229
- } else if ( elem.nodeType !== 8 ) {
1230
- ret += getText( elem.childNodes );
1231
- }
1232
- }
1233
-
1234
- return ret;
1235
- };
1236
-
1237
- /*
1238
- * Javascript Diff Algorithm
1239
- * By John Resig (http://ejohn.org/)
1240
- * Modified by Chu Alan "sprite"
1241
- *
1242
- * Released under the MIT license.
1243
- *
1244
- * More Info:
1245
- * http://ejohn.org/projects/javascript-diff-algorithm/
1246
- *
1247
- * Usage: QUnit.diff(expected, actual)
1248
- *
1249
- * QUnit.diff("the quick brown fox jumped over", "the quick fox jumps over") == "the quick <del>brown </del> fox <del>jumped </del><ins>jumps </ins> over"
1250
- */
1251
- QUnit.diff = (function() {
1252
- function diff(o, n){
1253
- var ns = new Object();
1254
- var os = new Object();
1255
-
1256
- for (var i = 0; i < n.length; i++) {
1257
- if (ns[n[i]] == null)
1258
- ns[n[i]] = {
1259
- rows: new Array(),
1260
- o: null
1261
- };
1262
- ns[n[i]].rows.push(i);
1263
- }
1264
-
1265
- for (var i = 0; i < o.length; i++) {
1266
- if (os[o[i]] == null)
1267
- os[o[i]] = {
1268
- rows: new Array(),
1269
- n: null
1270
- };
1271
- os[o[i]].rows.push(i);
1272
- }
1273
-
1274
- for (var i in ns) {
1275
- if (ns[i].rows.length == 1 && typeof(os[i]) != "undefined" && os[i].rows.length == 1) {
1276
- n[ns[i].rows[0]] = {
1277
- text: n[ns[i].rows[0]],
1278
- row: os[i].rows[0]
1279
- };
1280
- o[os[i].rows[0]] = {
1281
- text: o[os[i].rows[0]],
1282
- row: ns[i].rows[0]
1283
- };
1284
- }
1285
- }
1286
-
1287
- for (var i = 0; i < n.length - 1; i++) {
1288
- if (n[i].text != null && n[i + 1].text == null && n[i].row + 1 < o.length && o[n[i].row + 1].text == null &&
1289
- n[i + 1] == o[n[i].row + 1]) {
1290
- n[i + 1] = {
1291
- text: n[i + 1],
1292
- row: n[i].row + 1
1293
- };
1294
- o[n[i].row + 1] = {
1295
- text: o[n[i].row + 1],
1296
- row: i + 1
1297
- };
1298
- }
1299
- }
1300
-
1301
- for (var i = n.length - 1; i > 0; i--) {
1302
- if (n[i].text != null && n[i - 1].text == null && n[i].row > 0 && o[n[i].row - 1].text == null &&
1303
- n[i - 1] == o[n[i].row - 1]) {
1304
- n[i - 1] = {
1305
- text: n[i - 1],
1306
- row: n[i].row - 1
1307
- };
1308
- o[n[i].row - 1] = {
1309
- text: o[n[i].row - 1],
1310
- row: i - 1
1311
- };
1312
- }
1313
- }
1314
-
1315
- return {
1316
- o: o,
1317
- n: n
1318
- };
1319
- }
1320
-
1321
- return function(o, n){
1322
- o = o.replace(/\s+$/, '');
1323
- n = n.replace(/\s+$/, '');
1324
- var out = diff(o == "" ? [] : o.split(/\s+/), n == "" ? [] : n.split(/\s+/));
1325
-
1326
- var str = "";
1327
-
1328
- var oSpace = o.match(/\s+/g);
1329
- if (oSpace == null) {
1330
- oSpace = [" "];
1331
- }
1332
- else {
1333
- oSpace.push(" ");
1334
- }
1335
- var nSpace = n.match(/\s+/g);
1336
- if (nSpace == null) {
1337
- nSpace = [" "];
1338
- }
1339
- else {
1340
- nSpace.push(" ");
1341
- }
1342
-
1343
- if (out.n.length == 0) {
1344
- for (var i = 0; i < out.o.length; i++) {
1345
- str += '<del>' + out.o[i] + oSpace[i] + "</del>";
1346
- }
1347
- }
1348
- else {
1349
- if (out.n[0].text == null) {
1350
- for (n = 0; n < out.o.length && out.o[n].text == null; n++) {
1351
- str += '<del>' + out.o[n] + oSpace[n] + "</del>";
1352
- }
1353
- }
1354
-
1355
- for (var i = 0; i < out.n.length; i++) {
1356
- if (out.n[i].text == null) {
1357
- str += '<ins>' + out.n[i] + nSpace[i] + "</ins>";
1358
- }
1359
- else {
1360
- var pre = "";
1361
-
1362
- for (n = out.n[i].row + 1; n < out.o.length && out.o[n].text == null; n++) {
1363
- pre += '<del>' + out.o[n] + oSpace[n] + "</del>";
1364
- }
1365
- str += " " + out.n[i].text + nSpace[i] + pre;
1366
- }
1367
- }
1368
- }
1369
-
1370
- return str;
1371
- };
1372
- })();
1373
-
1374
- })(this);