Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Work in progress

  • Loading branch information...
commit 5bdfd32381dc30866bced7d22969170c1e4f5fbb 1 parent 2bdab31
Raynos authored
Showing with 18,732 additions and 1,941 deletions.
  1. +26 −4 build.js
  2. +7 −1,425 lib/DOM-shim-ie8.js
  3. +7 −415 lib/DOM-shim.js
  4. +7 −0 node_modules/express/.npmignore
  5. +770 −0 node_modules/express/History.md
  6. +22 −0 node_modules/express/LICENSE
  7. +29 −0 node_modules/express/Makefile
  8. +145 −0 node_modules/express/Readme.md
  9. +428 −0 node_modules/express/bin/express
  10. +2 −0  node_modules/express/index.js
  11. +79 −0 node_modules/express/lib/express.js
  12. +583 −0 node_modules/express/lib/http.js
  13. +52 −0 node_modules/express/lib/https.js
  14. +321 −0 node_modules/express/lib/request.js
  15. +460 −0 node_modules/express/lib/response.js
  16. +53 −0 node_modules/express/lib/router/collection.js
  17. +398 −0 node_modules/express/lib/router/index.js
  18. +70 −0 node_modules/express/lib/router/methods.js
  19. +88 −0 node_modules/express/lib/router/route.js
  20. +152 −0 node_modules/express/lib/utils.js
  21. +457 −0 node_modules/express/lib/view.js
  22. +40 −0 node_modules/express/lib/view/partial.js
  23. +210 −0 node_modules/express/lib/view/view.js
  24. +11 −0 node_modules/express/node_modules/connect/.npmignore
  25. +24 −0 node_modules/express/node_modules/connect/LICENSE
  26. +2 −0  node_modules/express/node_modules/connect/index.js
  27. +81 −0 node_modules/express/node_modules/connect/lib/cache.js
  28. +106 −0 node_modules/express/node_modules/connect/lib/connect.js
  29. +217 −0 node_modules/express/node_modules/connect/lib/http.js
  30. +47 −0 node_modules/express/node_modules/connect/lib/https.js
  31. +46 −0 node_modules/express/node_modules/connect/lib/index.js
  32. +93 −0 node_modules/express/node_modules/connect/lib/middleware/basicAuth.js
  33. +189 −0 node_modules/express/node_modules/connect/lib/middleware/bodyParser.js
  34. +163 −0 node_modules/express/node_modules/connect/lib/middleware/compiler.js
  35. +46 −0 node_modules/express/node_modules/connect/lib/middleware/cookieParser.js
  36. +105 −0 node_modules/express/node_modules/connect/lib/middleware/csrf.js
  37. +222 −0 node_modules/express/node_modules/connect/lib/middleware/directory.js
  38. +100 −0 node_modules/express/node_modules/connect/lib/middleware/errorHandler.js
  39. +76 −0 node_modules/express/node_modules/connect/lib/middleware/favicon.js
  40. +82 −0 node_modules/express/node_modules/connect/lib/middleware/limit.js
  41. +299 −0 node_modules/express/node_modules/connect/lib/middleware/logger.js
  42. +38 −0 node_modules/express/node_modules/connect/lib/middleware/methodOverride.js
  43. +100 −0 node_modules/express/node_modules/connect/lib/middleware/profiler.js
  44. +40 −0 node_modules/express/node_modules/connect/lib/middleware/query.js
  45. +34 −0 node_modules/express/node_modules/connect/lib/middleware/responseTime.js
  46. +379 −0 node_modules/express/node_modules/connect/lib/middleware/router.js
  47. +346 −0 node_modules/express/node_modules/connect/lib/middleware/session.js
  48. +126 −0 node_modules/express/node_modules/connect/lib/middleware/session/cookie.js
  49. +131 −0 node_modules/express/node_modules/connect/lib/middleware/session/memory.js
  50. +137 −0 node_modules/express/node_modules/connect/lib/middleware/session/session.js
  51. +87 −0 node_modules/express/node_modules/connect/lib/middleware/session/store.js
  52. +225 −0 node_modules/express/node_modules/connect/lib/middleware/static.js
  53. +175 −0 node_modules/express/node_modules/connect/lib/middleware/staticCache.js
  54. +44 −0 node_modules/express/node_modules/connect/lib/middleware/vhost.js
  55. +79 −0 node_modules/express/node_modules/connect/lib/patch.js
  56. +75 −0 node_modules/express/node_modules/connect/lib/public/directory.html
  57. +13 −0 node_modules/express/node_modules/connect/lib/public/error.html
  58. BIN  node_modules/express/node_modules/connect/lib/public/favicon.ico
  59. BIN  node_modules/express/node_modules/connect/lib/public/icons/page.png
  60. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_add.png
  61. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_attach.png
  62. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_code.png
  63. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_copy.png
  64. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_delete.png
  65. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_edit.png
  66. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_error.png
  67. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_excel.png
  68. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_find.png
  69. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_gear.png
  70. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_go.png
  71. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_green.png
  72. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_key.png
  73. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_lightning.png
  74. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_link.png
  75. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_paintbrush.png
  76. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_paste.png
  77. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_red.png
  78. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_refresh.png
  79. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_save.png
  80. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white.png
  81. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_acrobat.png
  82. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_actionscript.png
  83. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_add.png
  84. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_c.png
  85. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_camera.png
  86. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_cd.png
  87. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_code.png
  88. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_code_red.png
  89. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_coldfusion.png
  90. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_compressed.png
  91. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_copy.png
  92. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_cplusplus.png
  93. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_csharp.png
  94. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_cup.png
  95. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_database.png
  96. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_delete.png
  97. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_dvd.png
  98. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_edit.png
  99. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_error.png
  100. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_excel.png
  101. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_find.png
  102. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_flash.png
  103. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_freehand.png
  104. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_gear.png
  105. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_get.png
  106. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_go.png
  107. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_h.png
  108. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_horizontal.png
  109. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_key.png
  110. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_lightning.png
  111. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_link.png
  112. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_magnify.png
  113. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_medal.png
  114. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_office.png
  115. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_paint.png
  116. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_paintbrush.png
  117. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_paste.png
  118. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_php.png
  119. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_picture.png
  120. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_powerpoint.png
  121. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_put.png
  122. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_ruby.png
  123. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_stack.png
  124. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_star.png
  125. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_swoosh.png
  126. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_text.png
  127. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_text_width.png
  128. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_tux.png
  129. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_vector.png
  130. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_visualstudio.png
  131. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_width.png
  132. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_word.png
  133. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_world.png
  134. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_wrench.png
  135. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_white_zip.png
  136. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_word.png
  137. BIN  node_modules/express/node_modules/connect/lib/public/icons/page_world.png
  138. +141 −0 node_modules/express/node_modules/connect/lib/public/style.css
  139. +451 −0 node_modules/express/node_modules/connect/lib/utils.js
  140. +4 −0 node_modules/express/node_modules/connect/node_modules/formidable/.gitignore
  141. +4 −0 node_modules/express/node_modules/connect/node_modules/formidable/.npmignore
  142. +4 −0 node_modules/express/node_modules/connect/node_modules/formidable/.travis.yml
  143. +14 −0 node_modules/express/node_modules/connect/node_modules/formidable/Makefile
  144. +286 −0 node_modules/express/node_modules/connect/node_modules/formidable/Readme.md
  145. +3 −0  node_modules/express/node_modules/connect/node_modules/formidable/TODO
  146. +70 −0 node_modules/express/node_modules/connect/node_modules/formidable/benchmark/bench-multipart-parser.js
  147. +43 −0 node_modules/express/node_modules/connect/node_modules/formidable/example/post.js
  148. +48 −0 node_modules/express/node_modules/connect/node_modules/formidable/example/upload.js
  149. +1 −0  node_modules/express/node_modules/connect/node_modules/formidable/index.js
  150. +61 −0 node_modules/express/node_modules/connect/node_modules/formidable/lib/file.js
  151. +377 −0 node_modules/express/node_modules/connect/node_modules/formidable/lib/incoming_form.js
  152. +3 −0  node_modules/express/node_modules/connect/node_modules/formidable/lib/index.js
  153. +312 −0 node_modules/express/node_modules/connect/node_modules/formidable/lib/multipart_parser.js
  154. +25 −0 node_modules/express/node_modules/connect/node_modules/formidable/lib/querystring_parser.js
  155. +6 −0 node_modules/express/node_modules/connect/node_modules/formidable/lib/util.js
  156. +22 −0 node_modules/express/node_modules/connect/node_modules/formidable/package.json
  157. +19 −0 node_modules/express/node_modules/connect/node_modules/formidable/test/common.js
  158. +1 −0  node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt
  159. +1 −0  node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt
  160. +13 −0 node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/no-filename/generic.http
  161. +3 −0  ...es/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md
  162. +26 −0 ...node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-chrome-13.http
  163. +24 −0 ...de_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-firefox-3.6.http
  164. +23 −0 .../node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-safari-5.http
  165. +24 −0 .../node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-chrome-12.http
  166. +22 −0 ...press/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-ie-7.http
  167. +22 −0 ...press/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-ie-8.http
  168. +22 −0 ...s/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-safari-5.http
  169. +3 −0  node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js
  170. +21 −0 node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js
  171. +72 −0 node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/multipart.js
  172. +89 −0 node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js
  173. +24 −0 node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/common.js
  174. +80 −0 ...dules/express/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js
  175. +104 −0 node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js
  176. +715 −0 node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js
  177. +50 −0 node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-multipart-parser.js
  178. +45 −0 ..._modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-querystring-parser.js
  179. +72 −0 ..._modules/express/node_modules/connect/node_modules/formidable/test/legacy/system/test-multi-video-upload.js
  180. +2 −0  node_modules/express/node_modules/connect/node_modules/formidable/test/run.js
  181. +63 −0 node_modules/express/node_modules/connect/node_modules/formidable/test/unit/test-incoming-form.js
  182. +47 −0 node_modules/express/node_modules/connect/node_modules/formidable/tool/record.js
  183. +25 −0 node_modules/express/node_modules/connect/package.json
  184. +19 −0 node_modules/express/node_modules/mime/LICENSE
  185. +50 −0 node_modules/express/node_modules/mime/README.md
  186. +92 −0 node_modules/express/node_modules/mime/mime.js
  187. +22 −0 node_modules/express/node_modules/mime/package.json
  188. +79 −0 node_modules/express/node_modules/mime/test.js
  189. +1,479 −0 node_modules/express/node_modules/mime/types/mime.types
  190. +43 −0 node_modules/express/node_modules/mime/types/node.types
  191. +2 −0  node_modules/express/node_modules/mkdirp/.gitignore
  192. +2 −0  node_modules/express/node_modules/mkdirp/.gitignore.orig
  193. +5 −0 node_modules/express/node_modules/mkdirp/.gitignore.rej
  194. +21 −0 node_modules/express/node_modules/mkdirp/LICENSE
  195. +21 −0 node_modules/express/node_modules/mkdirp/README.markdown
  196. +6 −0 node_modules/express/node_modules/mkdirp/examples/pow.js
  197. +6 −0 node_modules/express/node_modules/mkdirp/examples/pow.js.orig
  198. +19 −0 node_modules/express/node_modules/mkdirp/examples/pow.js.rej
  199. +20 −0 node_modules/express/node_modules/mkdirp/index.js
  200. +23 −0 node_modules/express/node_modules/mkdirp/package.json
  201. +28 −0 node_modules/express/node_modules/mkdirp/test/mkdirp.js
  202. +41 −0 node_modules/express/node_modules/mkdirp/test/race.js
  203. +32 −0 node_modules/express/node_modules/mkdirp/test/rel.js
  204. +1 −0  node_modules/express/node_modules/qs/.gitignore
  205. +6 −0 node_modules/express/node_modules/qs/.gitmodules
  206. +63 −0 node_modules/express/node_modules/qs/History.md
  207. +5 −0 node_modules/express/node_modules/qs/Makefile
  208. +47 −0 node_modules/express/node_modules/qs/Readme.md
  209. +17 −0 node_modules/express/node_modules/qs/benchmark.js
  210. +48 −0 node_modules/express/node_modules/qs/examples.js
  211. +2 −0  node_modules/express/node_modules/qs/index.js
  212. +262 −0 node_modules/express/node_modules/qs/lib/querystring.js
  213. +16 −0 node_modules/express/node_modules/qs/package.json
  214. +2 −0  node_modules/express/node_modules/qs/test/mocha.opts
  215. +155 −0 node_modules/express/node_modules/qs/test/parse.js
  216. +95 −0 node_modules/express/node_modules/qs/test/stringify.js
  217. +39 −0 node_modules/express/package.json
  218. +35 −0 node_modules/express/testing/foo/app.js
  219. +9 −0 node_modules/express/testing/foo/package.json
  220. +8 −0 node_modules/express/testing/foo/public/stylesheets/style.css
  221. +10 −0 node_modules/express/testing/foo/routes/index.js
  222. +2 −0  node_modules/express/testing/foo/views/index.jade
  223. +6 −0 node_modules/express/testing/foo/views/layout.jade
  224. +43 −0 node_modules/express/testing/index.js
  225. +2,971 −0 node_modules/express/testing/public/test.txt
  226. +1 −0  node_modules/express/testing/views/page.html
  227. +3 −0  node_modules/express/testing/views/page.jade
  228. +1 −0  node_modules/express/testing/views/test.md
  229. +1 −0  node_modules/express/testing/views/user/index.jade
  230. +1 −0  node_modules/express/testing/views/user/list.jade
  231. +2 −1  package.json
  232. +15 −0 server.js
  233. +7 −0 src/all/bugs/CustomEvent.js
  234. +5 −0 src/all/bugs/Element.js
  235. +34 −0 src/all/bugs/Event.js
  236. +0 −29 src/all/{bugs.js → bugs/Node.js}
  237. +0 −3  src/all/interfaces/EventTarget.js
  238. +0 −7 src/all/interfaces/index.js
  239. +7 −0 src/ie8/bugs/CustomEvent.js
  240. +7 −0 src/ie8/bugs/DOMException.js
  241. +7 −0 src/ie8/bugs/DOMImplementation.js
  242. +36 −0 src/ie8/bugs/Document.js
  243. +7 −0 src/ie8/bugs/Element.js
  244. +7 −0 src/ie8/bugs/Event.js
  245. +7 −0 src/ie8/bugs/EventTarget.js
  246. +3 −35 src/ie8/{bugs.js → bugs/Node.js}
  247. +4 −0 src/ie8/interfaces/CustomEvent.js
  248. +29 −0 src/ie8/interfaces/Event.js
  249. +17 −4 src/ie8/interfaces/EventTarget.js
  250. +0 −10 src/ie8/interfaces/index.js
  251. +5 −5 src/main.js
  252. +307 −0 test/DOM-shim-ie8.js
  253. +307 −0 test/DOM-shim.js
  254. +3 −0  test/test-suites/XMLHttpRequest.js
  255. +3 −3 test/test.html
  256. +3 −0  test/xhr-suites/XMLHttpRequest.js
  257. +9 −0 test/xhr-suites/main.js
  258. +28 −0 test/xhr-test.html
  259. +183 −0 test/xhr-tests.js
View
30 build.js
@@ -38,21 +38,43 @@ function build() {
modul8("./test/test-suites/main.js")
.compile("./test/tests.js");
+ modul8("./test/xhr-suites/main.js")
+ .compile("./test/xhr-tests.js");
+
modul8("./src/main.js")
.domains({
- shims: './src/all/',
+ interfaces: './src/all/interfaces',
+ bugs: './src/all/bugs',
all: './src/all/',
utils: './src/utils/'
})
- .compile("./lib/DOM-shim.js");
+ .data()
+ .add('shims', [
+ 'CustomEvent', 'Element', 'Event', 'Node'
+ ])
+ .compile("./lib/DOM-shim.js")
+ .compile("./test/DOM-shim.js");
modul8("./src/main.js")
.domains({
- shims: './src/ie8/',
+ interfaces: './src/ie8/interfaces',
+ bugs: './src/ie8/bugs',
all: './src/all/',
utils: './src/utils/'
})
- .compile('./lib/DOM-shim-ie8.js');
+ .data()
+ .add('shims', [
+ 'CustomEvent',
+ 'Document',
+ 'DOMException',
+ 'DOMImplementaton',
+ 'Element',
+ 'Event',
+ 'EventTarget',
+ 'Node'
+ ])
+ .compile('./lib/DOM-shim-ie8.js')
+ .compile("./test/DOM-shim-ie8.js");
} catch (e) {
console.log("compiler error", e);
View
1,432 lib/DOM-shim-ie8.js
@@ -1,11 +1,12 @@
(function(){
window.M8 = {data:{}};
+M8.data.shims = ["CustomEvent","Document","DOMException","DOMImplementaton","Element","Event","EventTarget","Node"];
(function(){
/**
* modul8 v0.13.0
*/
-var config = {"namespace":"M8","domains":["app","shims","all","utils"],"arbiters":{},"logging":1}
+var config = {"namespace":"M8","domains":["app","interfaces","bugs","all","utils"],"arbiters":{},"logging":1}
, ns = window[config.namespace]
, domains = config.domains
, arbiters = []
@@ -157,1426 +158,7 @@ ns.external = function(name, exported) {
// shared code
-M8.define('index','utils',function(require, module, exports){
-var hasOwnProperty = Object.prototype.hasOwnProperty;
-
-
-var HTMLNames = [
- "HTMLDocument", "HTMLLinkElement", "HTMLElement", "HTMLHtmlElement",
- "HTMLDivElement", "HTMLAnchorElement", "HTMLSelectElement",
- "HTMLOptionElement", "HTMLInputElement", "HTMLHeadElement",
- "HTMLSpanElement", "XULElement", "HTMLBodyElement", "HTMLTableElement",
- "HTMLTableCellElement", "HTMLTextAreaElement", "HTMLScriptElement",
- "HTMLAudioElement", "HTMLMediaElement", "HTMLParagraphElement",
- "HTMLButtonElement", "HTMLLIElement", "HTMLUListElement",
- "HTMLFormElement", "HTMLHeadingElement", "HTMLImageElement",
- "HTMLStyleElement", "HTMLTableRowElement", "HTMLTableSectionElement",
- "HTMLBRElement"
-];
-
-module.exports = {
- addShimToInterface: addShimToInterface,
- throwDOMException: throwDOMException,
- clone: clone,
- recursivelyWalk: recursivelyWalk,
- HTMLNames: HTMLNames
-};
-
-function recursivelyWalk(nodes, cb) {
- for (var i = 0, len = nodes.length; i < len; i++) {
- var node = nodes[i];
- var ret = cb(node);
- if (ret) {
- return ret;
- }
- if (node.childNodes && node.childNodes.length) {
- var ret = recursivelyWalk(node.childNodes, cb);
- if (ret) {
- return ret;
- }
- }
- }
-}
-
-function throwDOMException(code) {
- var ex = Object.create(DOMException.prototype);
- ex.code = code;
- throw ex;
-}
-
-function addShimToInterface(shim, proto, constructor) {
- Object.keys(shim).forEach(function _eachShimProperty(name) {
- if (name === "constants") {
- var constants = shim[name];
- Object.keys(constants).forEach(function _eachConstant(name) {
- if (!hasOwnProperty.call(constructor, name)) {
- constructor[name] = constants[name];
- }
- });
- return;
- }
-
- if (!hasOwnProperty.call(proto, name)) {
- var pd = shim[name];
- if (pd.value) {
- pd.writable = false;
- } else {
-
- }
- pd.configurable = true;
- pd.enumerable = false;
- Object.defineProperty(proto, name, pd);
- }
- });
-}
-
-function clone(node, document, deep) {
- document = document || node.ownerDocument;
- var copy;
- if (node.nodeType === Node.ELEMENT_NODE) {
- var namespace = node.nodeName;
- if (node.prefix) {
- namespace = node.prefix + ":" + namespace;
- }
- copy = document.createElementNS(node.namespaceURI, namespace);
- for (var i = 0, len = node.attributes.length; i < len; i++) {
- var attr = node.attributes[i];
- copy.setAttribute(attr.name, attr.value);
- }
- } else if (node.nodeType === Node.DOCUMENT_NODE) {
- copy = document.implementation.createDocument("", "", null);
- } else if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
- copy = document.createDocumentFragment();
- } else if (node.nodeType === Node.DOCUMENT_TYPE_NODE) {
- copy = document.implementation.createDocumentType(node.name, node.publicId, node.systemId);
- } else if (node.nodeType === Node.COMMENT_NODE) {
- copy = document.createComment(node.data);
- } else if (node.nodeType === Node.TEXT_NODE) {
- copy = document.createTextNode(node.data);
- } else if (node.nodeType === Node.PROCESSING_INSTRUCTION_NODE) {
- copy = document.createProcessingInstruction(node.target, node.data);
- }
- // TODO: other cloning steps from other specifications
- if (deep) {
- var children = node.childNodes;
- for (var i = 0, len = children.length; i < len; i++) {
- copy.appendChild(children[i].cloneNode(node, document, deep));
- }
- }
- return copy;
-}
-});
-M8.define('interfaces/DOMTokenList','all',function(require, module, exports){
-var utils = require("utils::index");
-
-var throwDOMException = utils.throwDOMException;
-
-module.exports = {
- constructor: DOMTokenList,
- item: item,
- contains: contains,
- add: add,
- remove: remove,
- toggle: toggle,
- toString: _toString
-};
-
-module.exports.constructor.prototype = module.exports;
-
-function DOMTokenList(getter, setter) {
- this._getString = getter;
- this._setString = setter;
- fixIndex(this, getter().split(" "));
-}
-
-function fixIndex(clist, list) {
- for (var i = 0, len = list.length; i < len; i++) {
- clist[i] = list[i];
- }
- delete clist[len];
-}
-
-function handleErrors(token) {
- if (token === "" || token === undefined) {
- throwDOMException(DOMException.SYNTAX_ERR);
- }
- // TODO: test real space chacters
- if (token.indexOf(" ") > -1) {
- throwDOMException(DOMException.INVALID_CHARACTER_ERR);
- }
-}
-
-function getList(clist) {
- var str = clist._getString();
- if (str === "") {
- return [];
- } else {
- return str.split(" ");
- }
-}
-
-function item(index) {
- if (index >= this.length) {
- return null;
- }
- return this._getString().split(" ")[index];
-}
-
-function contains(token) {
- handleErrors(token);
- var list = getList(this);
- return list.indexOf(token) > -1;
-}
-
-function add(token) {
- handleErrors(token);
- var list = getList(this);
- if (list.indexOf(token) > -1) {
- return;
- }
- list.push(token);
- this._setString(list.join(" ").trim());
- fixIndex(this, list);
-}
-
-function remove(token) {
- handleErrors(token);
- var list = getList(this);
- var index = list.indexOf(token);
- if (index > -1) {
- list.splice(index, 1);
- this._setString(list.join(" ").trim());
- }
- fixIndex(this, list);
-}
-
-function toggle(token) {
- if (this.contains(token)) {
- this.remove(token);
- return false;
- } else {
- this.add(token);
- return true;
- }
-}
-
-function _toString() {
- return this._getString();
-}
-});
-M8.define('interfaces/Element','all',function(require, module, exports){
-var DOMTokenList = require("all::interfaces/DOMTokenList").constructor;
-
-module.exports = {
- parentElement: {
- get: getParentElement
- },
- classList: {
- get: getClassList
- }
-}
-
-function getParentElement() {
- var parent = this.parentNode;
- if (parent == null) {
- return null;
- }
- if (parent.nodeType === Node.ELEMENT_NODE) {
- return parent;
- }
- return null;
-}
-
-function getClassList() {
- var el = this;
-
- if (this._classList) {
- return this._classList;
- } else {
- var dtlist = new DOMTokenList(
- function _getClassName() {
- return el.className || "";
- },
- function _setClassName(v) {
- el.className = v;
- }
- );
- this._classList = dtlist;
- return dtlist;
- }
-}
-});
-M8.define('pd','utils',function(require, module, exports){
-!(function (exports) {
- "use strict";
-
- /*
- pd will return all the own propertydescriptors of the object
-
- @param Object obj - object to get pds from.
-
- @return Object - A hash of key/propertyDescriptors
- */
- function pd(obj) {
- var keys = Object.getOwnPropertyNames(obj);
- var o = {};
- keys.forEach(function _each(key) {
- var pd = Object.getOwnPropertyDescriptor(obj, key);
- o[key] = pd;
- });
- return o;
- }
-
- function operateOnThis(method) {
- return function _onThis() {
- var args = [].slice.call(arguments);
- return method.apply(null, [this].concat(args));
- }
- }
-
- /*
- Will extend native objects with utility methods
-
- @param Boolean prototypes - flag to indicate whether you want to extend
- prototypes as well
- */
- function extendNatives(prototypes) {
- prototypes === true && (prototypes = ["make", "beget", "extend"]);
-
- if (!Object.getOwnPropertyDescriptors) {
- Object.defineProperty(Object, "getOwnPropertyDescriptors", {
- value: pd,
- configurable: true
- });
- }
- if (!Object.extend) {
- Object.defineProperty(Object, "extend", {
- value: pd.extend,
- configurable: true
- });
- }
- if (!Object.make) {
- Object.defineProperty(Object, "make", {
- value: pd.make,
- configurable: true
- });
- }
- if (!Object.beget) {
- Object.defineProperty(Object, "beget", {
- value: beget,
- configurable: true
- })
- }
- if (!Object.prototype.beget && prototypes.indexOf("beget") !== -1) {
- Object.defineProperty(Object.prototype, "beget", {
- value: operateOnThis(beget),
- configurable: true
- });
- }
- if (!Object.prototype.make && prototypes.indexOf("make") !== -1) {
- Object.defineProperty(Object.prototype, "make", {
- value: operateOnThis(make),
- configurable: true
- });
- }
- if (!Object.prototype.extend && prototypes.indexOf("extend") !== -1) {
- Object.defineProperty(Object.prototype, "extend", {
- value: operateOnThis(extend),
- configurable: true
- });
- }
- if (!Object.Name) {
- Object.defineProperty(Object, "Name", {
- value: Name,
- configurable: true
- });
- }
- return pd;
- }
-
- /*
- Extend will extend the firat parameter with any other parameters
- passed in. Only the own property names will be extended into
- the object
-
- @param Object target - target to be extended
- @arguments Array [target, ...] - the rest of the objects passed
- in will extended into the target
-
- @return Object - the target
- */
- function extend(target) {
- var objs = Array.prototype.slice.call(arguments, 1);
- objs.forEach(function (obj) {
- var props = Object.getOwnPropertyNames(obj);
- props.forEach(function (key) {
- target[key] = obj[key];
- });
- });
- return target;
- }
-
- /*
- beget will generate a new object from the proto, any other arguments
- will be passed to proto.constructor
-
- @param Object proto - the prototype to use for the new object
- @arguments Array [proto, ...] - the rest of the arguments will
- be passed into proto.constructor
-
- @return Object - the newly created object
- */
- function beget(proto) {
- var o = Object.create(proto);
- var args = Array.prototype.slice.call(arguments, 1);
- proto.constructor && proto.constructor.apply(o, args);
- return o;
- }
-
- /*
- make will call Object.create with the proto and pd(props)
-
- @param Object proto - the prototype to inherit from
- @arguments Array [proto, ...] - the rest of the arguments will
- be mixed into the object, i.e. the object will be extend
- with the objects
-
- @return Object - the new object
- */
- function make (proto) {
- var o = Object.create(proto);
- var args = [].slice.call(arguments, 1);
- args.unshift(o);
- extend.apply(null, args);
- return o;
- }
-
- /*
- defines a namespace object. This hides a "privates" object on object
- under the "key" namespace
-
- @param Object object - object to hide a privates object on
- @param Object namespace - key to hide it under
-
- @author Gozala : https://gist.github.com/1269991
-
- @return Object privates
- */
- function defineNamespace(object, namespace) {
- var privates = Object.create(object),
- base = object.valueOf;
-
- Object.defineProperty(object, 'valueOf', {
- value: function valueOf(value) {
- if (value !== namespace || this !== object) {
- return base.apply(this, arguments);
- } else {
- return privates;
- }
- }
- });
-
- return privates;
- }
-
- /*
- Constructs a Name function, when given an object it will return a
- privates object.
-
- @author Gozala : https://gist.github.com/1269991
-
- @return Function name
- */
- function Name() {
- var namespace = {};
-
- return function name(object) {
- var privates = object.valueOf(namespace);
- if (privates !== object) {
- return privates;
- } else {
- return defineNamespace(object, namespace);
- }
- };
- }
-
- var Base = {
- extend: operateOnThis(extend),
- make: operateOnThis(make),
- beget: operateOnThis(beget)
- }
-
- extend(pd, {
- make: make,
- extend: extend,
- beget: beget,
- extendNatives: extendNatives,
- Name: Name,
- Base: Base
- });
-
- exports(pd);
-
-})(function (data) {
- if (typeof module !== "undefined") {
- module.exports = data;
- } else {
- window.pd = data;
- }
-});
-});
-M8.define('interfaces/Node','all',function(require, module, exports){
-module.exports = {
- contains: {
- value: contains
- },
- interface: window.Element
-}
-
-function contains(other) {
- var comparison = this.compareDocumentPosition(other);
- if (comparison === 0 ||
- comparison & Node.DOCUMENT_POSITION_CONTAINED_BY
- ) {
- return true;
- }
- return false;
-}
-});
-M8.define('interfaces/Event','all',function(require, module, exports){
-module.exports = {
- constructor: constructor
-};
-
-function constructor(type, dict) {
- var e = document.createEvent("Events");
- dict = dict || {};
- dict.bubbles = dict.bubbles || false;
- dict.catchable = dict.catchable || false;
- e.initEvent(type, dict.bubbles, dict.catchable);
- return e;
-}
-});
-M8.define('dataManager','utils',function(require, module, exports){
-var uuid = 0,
- domShimString = "__domShim__";
-
-var dataManager = {
- _stores: {},
- getStore: function _getStore(el) {
- var id = el[domShimString ];
- if (id === undefined) {
- return this._createStore(el);
- }
- return this._stores[domShimString + id];
- },
- _createStore: function _createStore(el) {
- var store = {};
- this._stores[domShimString + uuid] = store;
- el[domShimString ] = uuid;
- uuid++;
- return store;
- }
-};
-
-module.exports = dataManager;
-
-
-});
-M8.define('interfaces/Event','shims',function(require, module, exports){
-var pd = require("utils::pd"),
- Event = require("all::interfaces/Event");
-
-module.exports = pd.extend(Event, {
- constants: {
- CAPTURING_PHASE: 1,
- AT_TARGET: 2,
- BUBBLING_PHASE: 3
- },
- initEvent: {
- value: initEvent
- }
-});
-
-function initEvent(type, bubbles, cancelable) {
- this.type = type;
- this.isTrusted = false;
- this.target = null;
- this.bubbles = bubbles;
- this.cancelable = cancelable;
-}
-});
-M8.define('interfaces/DOMException','shims',function(require, module, exports){
-module.exports = {
- constants: {
- INDEX_SIZE_ERR: 1,
- DOMSTRING_SIZE_ERR: 2, // historical
- HIERARCHY_REQUEST_ERR: 3,
- WRONG_DOCUMENT_ERR: 4,
- INVALID_CHARACTER_ERR: 5,
- NO_DATA_ALLOWED_ERR: 6, // historical
- NO_MODIFICATION_ALLOWED_ERR: 7,
- NOT_FOUND_ERR: 8,
- NOT_SUPPORTED_ERR: 9,
- INUSE_ATTRIBUTE_ERR: 10, // historical
- INVALID_STATE_ERR: 11,
- SYNTAX_ERR: 12,
- INVALID_MODIFICATION_ERR: 13,
- NAMESPACE_ERR: 14,
- INVALID_ACCESS_ERR: 15,
- VALIDATION_ERR: 16, // historical
- TYPE_MISMATCH_ERR: 17,
- SECURITY_ERR: 18,
- NETWORK_ERR: 19,
- ABORT_ERR: 20,
- URL_MISMATCH_ERR: 21,
- QUOTA_EXCEEDED_ERR: 22,
- TIMEOUT_ERR: 23,
- INVALID_NODE_TYPE_ERR: 24,
- DATA_CLONE_ERR: 25
- },
- interface: function () { },
- prototype: {}
-}
-});
-M8.define('interfaces/DOMImplementation','shims',function(require, module, exports){
-module.exports = {
- createDocumentType: {
- value: createDocumentType
- }
-};
-
-function createDocumentType(qualifiedName, publicId, systemId) {
- var o = {};
- o.name = qualifiedName;
- o.publicId = publicId;
- o.systemId = systemId;
- o.ownerDocument = document;
- o.nodeType = Node.DOCUMENT_TYPE_NODE;
- o.nodeName = qualifiedName;
- return o;
-}
-});
-M8.define('interfaces/Element','shims',function(require, module, exports){
-var Element = require("all::interfaces/Element"),
- recursivelyWalk = require("utils::index").recursivelyWalk,
- pd = require("utils::pd");
-
-module.exports = pd.extend(Element, {
- getElementsByClassName: {
- value: getElementsByClassName
- },
- childElementCount: {
- get: getChildElementCount
- },
- firstElementChild: {
- get: getFirstElementChild
- },
- lastElementChild: {
- get: getLastElementChild
- },
- nextElementSibling: {
- get: getNextElementSibling
- },
- previousElementSibling: {
- get: getPreviousElementSibling
- }
-});
-
-function getChildElementCount() {
- return this.children.length;
-}
-
-function getFirstElementChild() {
- var nodes = this.childNodes;
- for (var i = 0, len = nodes.length; i < len; i++) {
- var node = nodes[i];
- if (node.nodeType === Node.ELEMENT_NODE) {
- return node;
- }
- }
- return null;
-}
-
-function getLastElementChild() {
- var nodes = this.childNodes;
- for (var i = nodes.length - 1; i >= 0; i--) {
- var node = nodes[i];
- if (node.nodeType === Node.ELEMENT_NODE) {
- return node;
- }
- }
- return null;
-}
-
-function getNextElementSibling() {
- var el = this;
- do {
- var el = el.nextSibling;
- if (el && el.nodeType === Node.ELEMENT_NODE) {
- return el;
- }
- } while (el !== null);
-
- return null;
-}
-
-function getPreviousElementSibling() {
- var el = this;
- do {
- el = el.previousSibling;
- if (el && el.nodeType === Node.ELEMENT_NODE) {
- return el;
- }
- } while (el !== null);
-
- return null;
-}
-
-
-// TODO: use real algorithm
-function getElementsByClassName(clas) {
- var ar = [];
- recursivelyWalk(this.childNodes, function (el) {
- if (el.classList && el.classList.contains(clas)) {
- ar.push(el);
- }
- });
- return ar;
-};
-});
-M8.define('bugs','all',function(require, module, exports){
-var utils = require("utils::index");
-
-module.exports = run;
-
-function run() {
-
-// IE9 thinks the argument is not optional
-// FF thinks the argument is not optional
-// Opera agress that its not optional
-(function () {
- var e = document.createElement("div");
- try {
- document.importNode(e);
- } catch (e) {
- var importNode = document.importNode;
- delete document.importNode;
- document.importNode = function _importNode(node, bool) {
- if (bool === undefined) {
- bool = true;
- }
- return importNode.call(this, node, bool);
- }
- }
-})();
-
-// Firefox fails on .cloneNode thinking argument is not optional
-// Opera agress that its not optional.
-(function () {
- var el = document.createElement("p");
-
- try {
- el.cloneNode();
- } catch (e) {
- [
- Node.prototype,
- Comment.prototype,
- Element.prototype,
- ProcessingInstruction.prototype,
- Document.prototype,
- DocumentType.prototype,
- DocumentFragment.prototype
- ].forEach(fixNodeOnProto);
-
- utils.HTMLNames.forEach(forAllHTMLInterfaces)
- }
-
- function forAllHTMLInterfaces(name) {
- window[name] && fixNodeOnProto(window[name].prototype);
- }
-
- function fixNodeOnProto(proto) {
- var cloneNode = proto.cloneNode;
- delete proto.cloneNode;
- proto.cloneNode = function _cloneNode(bool) {
- if (bool === undefined) {
- bool = true;
- }
- return cloneNode.call(this, bool);
- };
- }
-})();
-
-// Opera is funny about the "optional" parameter on addEventListener
-(function () {
- var count = 0;
- var handler = function () {
- count++;
- }
- document.addEventListener("click", handler);
- var ev = new Event("click");
- document.dispatchEvent(ev);
- if (count === 0) {
- // fix opera
- var oldListener = EventTarget.prototype.addEventListener;
- EventTarget.prototype.addEventListener = function (ev, cb, optional) {
- optional = optional || false;
- return oldListener.call(this, ev, cb, optional);
- };
- // fix removeEventListener aswell
- var oldRemover = EventTarget.prototype.removeEventListener;
- EventTarget.prototype.removeEventListener = function (ev, cb, optional) {
- optional = optional || false;
- return oldRemover.call(this, ev, cb, optional);
- };
- // punch window.
- window.addEventListener = EventTarget.prototype.addEventListener;
- window.removeEventListener = EventTarget.prototype.removeEventListener;
- }
- document.removeEventListener("click", handler);
-})();
-
-}
-});
-M8.define('interfaces/Document','shims',function(require, module, exports){
-var throwDOMException = require("utils::index").throwDOMException,
- recursivelyWalk = require("utils::index").recursivelyWalk,
- clone = require("utils::index").clone;
-
-module.exports = {
- adoptNode: {
- value: adoptNode
- },
- createElementNS: {
- value: createElementNS
- },
- createEvent: {
- value: createEvent
- },
- doctype: {
- get: getDocType
- },
- importNode: {
- value: importNode
- },
- interface: function () { },
- prototype: document
-};
-
-function createEvent(interface) {
- if (this.createEventObject) {
- return this.createEventObject();
- }
-}
-
-function importNode(node, deep) {
- if (node.nodeType === Node.DOCUMENT_NODE) {
- throwDOMException(DOMException.NOT_SUPPORTED_ERR);
- }
- if (deep === undefined) {
- deep = true;
- }
- return clone(node, this, deep);
-}
-
-function getDocType() {
- var docType = this.childNodes[0];
- // TODO: remove assumption that DOCTYPE is the first node
- Object.defineProperty(docType, "nodeType", {
- get: function () { return Node.DOCUMENT_TYPE_NODE; }
- });
- return docType;
-}
-
-function createElementNS(namespace, name) {
- var prefix, localName;
-
- if (namespace === "") {
- namespace = null;
- }
- // TODO: check the Name production
- // TODO: check the QName production
- if (name.indexOf(":") > -1) {
- var split = name.split(":");
- prefix = split[0];
- localName = split[1];
- } else {
- prefix = null;
- localName = name;
- }
- if (prefix === "" || prefix === "undefined") {
- prefix = null;
- }
- if ((prefix !== null && namespace === null) ||
- (
- prefix === "xml" &&
- namespace !== "http://www.w3.org/XML/1998/namespace"
- ) ||
- (
- (name === "xmlns" || prefix === "xmlns") &&
- namespace !== "http://www.w3.org/2000/xmlns/"
- ) ||
- (
- namespace === "http://www.w3.org/2000/xmlns/" &&
- (name !== "xmlns" && prefix !== "xmlns")
- )
- ) {
- throwDOMException(DOMException.NAMESPACE_ERR);
- }
- var el = this.createElement(localName);
- el.namespaceURI = namespace;
- el.prefix = prefix;
- return el;
-}
-
-function adopt(node, doc) {
- if (node.nodeType === Node.ELEMENT_NODE) {
- // TODO: base URL change
- }
- if (node.parentNode !== null) {
- node.parentNode.removeChild(node);
- }
- recursivelyWalk([node], function (node) {
- node.ownerDocument = doc;
- });
-}
-
-function adoptNode(node) {
- if (node.nodeType === Node.DOCUMENT_NODE) {
- throwDOMException(DOMException.NOT_SUPPORTED_ERR);
- }
- adopt(node, this);
- return node;
-}
-});
-M8.define('interfaces/EventTarget','shims',function(require, module, exports){
-var dataManager = require("utils::dataManager"),
- throwDOMException = require("utils::index").throwDOMException,
- push = [].push;
-
-module.exports = {
- addEventListener: {
- value: addEventListener
- },
- dispatchEvent: {
- value: dispatchEvent
- },
- removeEventListener: {
- value: removeEventListener
- },
- interface: window.Element
-};
-
-function addEventListener(type, listener, capture) {
- if (listener === null) return;
-
- var that = this;
-
- capture = capture || false;
-
- var store = dataManager.getStore(this);
-
- var eventsString;
- if (capture) {
- eventsString = "captureEvents";
- } else {
- eventsString = "bubbleEvents";
- }
-
- if (!store[eventsString]) {
- store[eventsString] = {};
- }
-
- var events = store[eventsString];
-
- if (!events[type]) {
- events[type] = {};
- events[type].listeners = [];
- }
-
- var typeObject = events[type];
-
- var listenerArray = typeObject.listeners;
- if (listenerArray.indexOf(listener) === -1) {
- listenerArray.push(listener);
- } else {
- return;
- }
-
- if (this.attachEvent) {
- try {
- this.attachEvent("on" + type, handler);
-
- if (!typeObject.ieHandlers) {
- typeObject.ieHandlers = [];
- }
-
- var index = listenerArray.length - 1;
-
- typeObject.ieHandlers[index] = handler;
-
- } catch (e) {
- /* don't care. can't attach so can't be fired */
- }
- }
-
- function handler() {
- var ev = document.createEvent("event");
- ev.initEvent(type, true, true);
- that.dispatchEvent(ev);
- }
-}
-
-function removeEventListener(type, listener, capture) {
- capture = capture || false;
-
- var store = dataManager.getStore(this);
-
- var eventsString;
- if (capture) {
- eventsString = "captureEvents";
- } else {
- eventsString = "bubbleEvents";
- }
-
- var events = store[eventsString];
-
- if (!events) return;
-
- var typeObject = events[type];
-
- if (!typeObject) return;
-
- var listenerArray = typeObject.listeners;
-
- var index = listenerArray.indexOf(listener);
- listenerArray.splice(index, 1);
-
- if (this.detachEvent) {
- try {
- var ieHandlers = typeObject.ieHandlers;
-
- var handler = ieHandlers[index];
-
- this.detachEvent("on" + type, handler);
-
- ieHandlers.splice(index, 1);
- } catch (e) {
- /* don't care. Can't detach what hasn't been attached */
- }
-
- }
-}
-
-function dispatchEvent(event) {
- if (event._dispatch === true || event._initialized === true) {
- throwDOMException(DOMException.INVALID_STATE_ERR);
- }
-
- event.isTrusted = false;
-
- dispatch(this, event);
-}
-
-function dispatch(elem, event) {
- var invokeListenerForEvent = invokeListeners.bind(null, event);
-
- event._dispatch = true;
-
- event.target = elem;
-
- if (elem.parentNode) {
- var eventPath = [];
- var parent = elem.parentNode;
- while (parent) {
- eventPath.unshift(parent);
- parent = parent.parentNode;
- }
-
- event.eventPhase = Event.CAPTURING_PHASE;
-
- eventPath.forEach(invokeListenerForEvent);
-
- event.eventPhase = Event.AT_TARGET;
-
- invokeListenerForEvent(event.target);
-
- if (event.bubbles) {
- eventPath = eventPath.reverse();
- event.eventPhase = Event.BUBBLING_PHASE;
- eventPath.forEach(invokeListenerForEvent);
- }
- } else {
- invokeListenerForEvent(event.target);
- }
-
- event._dispatch = false;
-
- event.eventPhase = Event.AT_TARGET;
-
- event.currentTarget = null;
-
- return !event._canceled;
-}
-
-function invokeListeners(event, elem) {
- var store = dataManager.getStore(elem);
-
- event.currentTarget = elem;
-
- var listeners = [];
- if (event.eventPhase !== Event.CAPTURING_PHASE) {
- var events = store["bubbleEvents"];
- if (events) {
- var typeObject = events[event.type];
- if (typeObject) {
- var listenerArray = typeObject.listeners
-
- push.apply(listeners, listenerArray);
- }
- }
- }
- if (event.eventPhase !== Event.BUBBLING_PHASE) {
- var events = store["captureEvents"];
- if (events) {
- var typeObject = events[event.type];
-
- if (typeObject) {
- var listenerArray = typeObject.listeners
-
- push.apply(listeners, listenerArray);
- }
- }
- }
-
- listeners.some(invokeListener);
-
- function invokeListener(listener) {
- if (event._stopImmediatePropagation) {
- return true;
- }
- // DOM4 ED says currentTarget, DOM4 WD says target
- listener.call(event.currentTarget, event);
- }
-}
-});
-M8.define('interfaces/CustomEvent','all',function(require, module, exports){
-module.exports = {
- constructor: constructor,
- interface: window.Event
-};
-
-function constructor(type, dict) {
- var e = document.createEvent("CustomEvent");
- dict = dict || {};
- dict.detail = dict.detail || null;
- dict.bubbles = dict.bubbles || false;
- dict.catchable = dict.catchable || false;
- if (e.initCustomEvent) {
- e.initCustomEvent(type, dict.bubbles, dict.catchable, dict.detail);
- } else {
- e.initEvent(type, dict.bubbles, dict.catchable);
- e.detail = dict.detail;
- }
- return e;
-}
-});
-M8.define('interfaces/Node','shims',function(require, module, exports){
-var nodeShim = require("all::interfaces/Node"),
- recursivelyWalk = require("utils::index").recursivelyWalk,
- pd = require("utils::pd");
-
-module.exports = pd.extend(nodeShim, {
- constants: {
- "ELEMENT_NODE": 1,
- "ATTRIBUTE_NODE": 2,
- "TEXT_NODE": 3,
- "CDATA_SECTION_NODE": 4,
- "ENTITY_REFERENCE_NODE": 5,
- "ENTITY_NODE": 6,
- "PROCESSING_INSTRUCTION_NODE": 7,
- "COMMENT_NODE": 8,
- "DOCUMENT_NODE": 9,
- "DOCUMENT_TYPE_NODE": 10,
- "DOCUMENT_FRAGMENT_NODE": 11,
- "NOTATION_NODE": 12,
- "DOCUMENT_POSITION_DISCONNECTED": 0x01,
- "DOCUMENT_POSITION_PRECEDING": 0x02,
- "DOCUMENT_POSITION_FOLLOWING": 0x04,
- "DOCUMENT_POSITION_CONTAINS": 0x08,
- "DOCUMENT_POSITION_CONTAINED_BY": 0x10,
- "DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC": 0x20
- },
- contains: {
- value: contains
- },
- compareDocumentPosition: {
- value: compareDocumentPosition
- },
- isEqualNode: {
- value: isEqualNode
- },
- textContent: {
- get: getTextContent,
- set: setTextContent
- }
-});
-
-function contains(other) {
- return recursivelyWalk(this.childNodes, function (node) {
- if (node === other) return true;
- }) || false;
-}
-
-function isEqualNode(node) {
- if (node === null) {
- return false;
- }
- if (node.nodeType !== this.nodeType) {
- return false;
- }
- if (node.nodeType === Node.DOCUMENT_TYPE_NODE) {
- if (this.name !== node.name ||
- this.publicId !== node.publicId ||
- this.systemId !== node.systemId
- ) {
- return false;
- }
- }
- if (node.nodeType === Node.ELEMENT_NODE) {
- if (this.namespaceURI != node.namespaceURI ||
- this.prefix != node.prefix ||
- this.localName != node.localName
- ) {
- return false;
- }
- for (var i = 0, len = this.attributes.length; i < len; i++) {
- var attr = this.attributes[length];
- var nodeAttr = node.getAttributeNS(attr.namespaceURI, attr.localName);
- if (nodeAttr === null || nodeAttr.value !== attr.value) {
- return false;
- }
- }
- }
- if (node.nodeType === Node.PROCESSING_INSTRUCTION_NODE) {
- if (this.target !== node.target || this.data !== node.data) {
- return false;
- }
- }
- if (node.nodeType === Node.TEXT_NODE || node.nodeType === Node.COMMENT_NODE) {
- if (this.data !== node.data) {
- return false;
- }
- }
- if (node.childNodes.length !== this.childNodes.length) {
- return false;
- }
- for (var i = 0, len = node.childNodes.length; i < len; i++) {
- var isEqual = node.childNodes[i].isEqualNode(this.childNodes[i]);
- if (isEqual === false) {
- return false;
- }
- }
- return true;
-}
-
-function getTextContent() {
- if ('innerText' in this) {
- return this.innerText;
- }
- if ('data' in this && this.appendData) {
- return this.data;
- }
-}
-
-function setTextContent(value) {
- if ('innerText' in this) {
- this.innerText = value;
- return;
- }
- if ('data' in this && this.replaceData) {
- this.replaceData(0, this.length, value);
- return;
- }
-}
-
-function testNodeForComparePosition(node, other) {
- if (node === other) {
- return true;
- }
-}
-
-function compareDocumentPosition(other) {
- function identifyWhichIsFirst(node) {
- if (node === other) {
- return "other";
- } else if (node === reference) {
- return "reference";
- }
- }
-
- var reference = this,
- referenceTop = this,
- otherTop = other;
-
- if (this === other) {
- return 0;
- }
- while (referenceTop.parentNode) {
- referenceTop = referenceTop.parentNode;
- }
- while (otherTop.parentNode) {
- otherTop = otherTop.parentNode;
- }
-
- if (referenceTop !== otherTop) {
- return Node.DOCUMENT_POSITION_DISCONNECTED;
- }
-
- var children = reference.childNodes;
- var ret = recursivelyWalk(
- children,
- testNodeForComparePosition.bind(null, other)
- );
- if (ret) {
- return Node.DOCUMENT_POSITION_CONTAINED_BY +
- Node.DOCUMENT_POSITION_FOLLOWING;
- }
-
- var children = other.childNodes;
- var ret = recursivelyWalk(
- children,
- testNodeForComparePosition.bind(null, reference)
- );
- if (ret) {
- return Node.DOCUMENT_POSITION_CONTAINS +
- Node.DOCUMENT_POSITION_PRECEDING;
- }
-
- var ret = recursivelyWalk(
- [referenceTop],
- identifyWhichIsFirst
- );
- if (ret === "other") {
- return Node.DOCUMENT_POSITION_PRECEDING;
- } else {
- return Node.DOCUMENT_POSITION_FOLLOWING;
- }
-}
-});
-M8.define('interfaces/index','shims',function(require, module, exports){
-module.exports = {
- CustomEvent: require("all::interfaces/CustomEvent"),
- DOMException: require("shims::interfaces/DOMException"),
- DOMImplementation: require("shims::interfaces/DOMImplementation"),
- Element: require("shims::interfaces/Element"),
- Event: require("shims::interfaces/Event"),
- Document: require("shims::interfaces/Document"),
- EventTarget: require("shims::interfaces/EventTarget"),
- Node: require("shims::interfaces/Node")
-};
-});
-M8.define('bugs','shims',function(require, module, exports){
-var utils = require("utils::index"),
- documentShim = require("shims::interfaces/Document"),
- nodeShim = require("shims::interfaces/Node"),
- elementShim = require("shims::interfaces/Element"),
- eventTargetShim = require("shims::interfaces/EventTarget");
-
-module.exports = run;
-
-function run() {
-
-// IE8 Document does not inherit EventTarget
-(function () {
- if (!document.addEventListener) {
- utils.addShimToInterface(eventTargetShim, document);
- }
-})();
-
-// IE8 window.addEventListener does not exist
-(function () {
- if (!window.addEventListener) {
- window.addEventListener = document.addEventListener.bind(document);
- }
- if (!window.removeEventListener) {
- window.removeEventListener = document.removeEventListener.bind(document);
- }
- if (!window.dispatchEvent) {
- window.dispatchEvent = document.dispatchEvent.bind(document);
- }
-})();
-
-
-// IE8 hurr durr doctype is null
-(function () {
- if (document.doctype === null) {
- Object.defineProperty(document, "doctype", documentShim.doctype);
- }
-})();
-
-// IE8 hates you and your f*ing text nodes
-// I mean text node and document fragment and document no inherit from node
-(function () {
- if (!document.createTextNode().contains) {
- utils.addShimToInterface(nodeShim, Text.prototype, Text);
- }
-
- if (!document.createDocumentFragment().contains) {
- utils.addShimToInterface(nodeShim, HTMLDocument.prototype, HTMLDocument);
- }
-
- if (!document.getElementsByClassName) {
- document.getElementsByClassName = elementShim.getElementsByClassName.value;
- }
-})();
-
-// IE8 can't write to ownerDocument
-(function () {
- var el = document.createElement("div");
- try {
- el.ownerDocument = 42;
- } catch (e) {
- var pd = Object.getOwnPropertyDescriptor(Element.prototype, "ownerDocument");
- var ownerDocument = pd.get;
- Object.defineProperty(Element.prototype, "ownerDocument", {
- get: function () {
- if (this._ownerDocument) {
- return this._ownerDocument;
- } else {
- return ownerDocument.call(this);
- }
- },
- set: function (v) {
- this._ownerDocument = v;
- },
- configurable: true
- });
- }
-})();
-
-// IE - contains fails if argument is textnode
-(function () {
- var txt = document.createTextNode("temp"),
- el = document.createElement("p");
-
- el.appendChild(txt);
-
- try {
- el.contains(txt);
- } catch (e) {
- // The contains method fails on text nodes in IE8
- // swap the contains method for our contains method
- Node.prototype.contains = nodeShim.contains.value;
- }
-})();
-
-require("all::bugs")();
-
-}
-});
// app code - safety wrap
@@ -1692,11 +274,11 @@ function clone(node, document, deep) {
}
});
M8.define('main','app',function(require, module, exports){
-var shims = require("shims::interfaces"),
+var shims = require("data::shims"),
utils = require("utils");
-Object.keys(shims).forEach(function _eachShim(name) {
- var shim = shims[name];
+shims.forEach(function _eachShim(name) {
+ var shim = require("interfaces::" + name);
var constructor = window[name];
if (!constructor) {
constructor = window[name] = shim.interface;
@@ -1717,9 +299,9 @@ Object.keys(shims).forEach(function _eachShim(name) {
}
utils.addShimToInterface(shim, proto, constructor);
-});
-require("shims::bugs")();
+ require("bugs::" + name)();
+});
});
})();
})();
View
422 lib/DOM-shim.js
@@ -1,11 +1,12 @@
(function(){
window.M8 = {data:{}};
+M8.data.shims = ["CustomEvent","Element","Event","Node"];
(function(){
/**
* modul8 v0.13.0
*/
-var config = {"namespace":"M8","domains":["app","shims","all","utils"],"arbiters":{},"logging":1}
+var config = {"namespace":"M8","domains":["app","interfaces","bugs","all","utils"],"arbiters":{},"logging":1}
, ns = window[config.namespace]
, domains = config.domains
, arbiters = []
@@ -157,416 +158,7 @@ ns.external = function(name, exported) {
// shared code
-M8.define('index','utils',function(require, module, exports){
-var hasOwnProperty = Object.prototype.hasOwnProperty;
-
-
-var HTMLNames = [
- "HTMLDocument", "HTMLLinkElement", "HTMLElement", "HTMLHtmlElement",
- "HTMLDivElement", "HTMLAnchorElement", "HTMLSelectElement",
- "HTMLOptionElement", "HTMLInputElement", "HTMLHeadElement",
- "HTMLSpanElement", "XULElement", "HTMLBodyElement", "HTMLTableElement",
- "HTMLTableCellElement", "HTMLTextAreaElement", "HTMLScriptElement",
- "HTMLAudioElement", "HTMLMediaElement", "HTMLParagraphElement",
- "HTMLButtonElement", "HTMLLIElement", "HTMLUListElement",
- "HTMLFormElement", "HTMLHeadingElement", "HTMLImageElement",
- "HTMLStyleElement", "HTMLTableRowElement", "HTMLTableSectionElement",
- "HTMLBRElement"
-];
-
-module.exports = {
- addShimToInterface: addShimToInterface,
- throwDOMException: throwDOMException,
- clone: clone,
- recursivelyWalk: recursivelyWalk,
- HTMLNames: HTMLNames
-};
-
-function recursivelyWalk(nodes, cb) {
- for (var i = 0, len = nodes.length; i < len; i++) {
- var node = nodes[i];
- var ret = cb(node);
- if (ret) {
- return ret;
- }
- if (node.childNodes && node.childNodes.length) {
- var ret = recursivelyWalk(node.childNodes, cb);
- if (ret) {
- return ret;
- }
- }
- }
-}
-function throwDOMException(code) {
- var ex = Object.create(DOMException.prototype);
- ex.code = code;
- throw ex;
-}
-
-function addShimToInterface(shim, proto, constructor) {
- Object.keys(shim).forEach(function _eachShimProperty(name) {
- if (name === "constants") {
- var constants = shim[name];
- Object.keys(constants).forEach(function _eachConstant(name) {
- if (!hasOwnProperty.call(constructor, name)) {
- constructor[name] = constants[name];
- }
- });
- return;
- }
-
- if (!hasOwnProperty.call(proto, name)) {
- var pd = shim[name];
- if (pd.value) {
- pd.writable = false;
- } else {
-
- }
- pd.configurable = true;
- pd.enumerable = false;
- Object.defineProperty(proto, name, pd);
- }
- });
-}
-
-function clone(node, document, deep) {
- document = document || node.ownerDocument;
- var copy;
- if (node.nodeType === Node.ELEMENT_NODE) {
- var namespace = node.nodeName;
- if (node.prefix) {
- namespace = node.prefix + ":" + namespace;
- }
- copy = document.createElementNS(node.namespaceURI, namespace);
- for (var i = 0, len = node.attributes.length; i < len; i++) {
- var attr = node.attributes[i];
- copy.setAttribute(attr.name, attr.value);
- }
- } else if (node.nodeType === Node.DOCUMENT_NODE) {
- copy = document.implementation.createDocument("", "", null);
- } else if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
- copy = document.createDocumentFragment();
- } else if (node.nodeType === Node.DOCUMENT_TYPE_NODE) {
- copy = document.implementation.createDocumentType(node.name, node.publicId, node.systemId);
- } else if (node.nodeType === Node.COMMENT_NODE) {
- copy = document.createComment(node.data);
- } else if (node.nodeType === Node.TEXT_NODE) {
- copy = document.createTextNode(node.data);
- } else if (node.nodeType === Node.PROCESSING_INSTRUCTION_NODE) {
- copy = document.createProcessingInstruction(node.target, node.data);
- }
- // TODO: other cloning steps from other specifications
- if (deep) {
- var children = node.childNodes;
- for (var i = 0, len = children.length; i < len; i++) {
- copy.appendChild(children[i].cloneNode(node, document, deep));
- }
- }
- return copy;
-}
-});
-M8.define('interfaces/DOMTokenList','all',function(require, module, exports){
-var utils = require("utils::index");
-
-var throwDOMException = utils.throwDOMException;
-
-module.exports = {
- constructor: DOMTokenList,
- item: item,
- contains: contains,
- add: add,
- remove: remove,
- toggle: toggle,
- toString: _toString
-};
-
-module.exports.constructor.prototype = module.exports;
-
-function DOMTokenList(getter, setter) {
- this._getString = getter;
- this._setString = setter;
- fixIndex(this, getter().split(" "));
-}
-
-function fixIndex(clist, list) {
- for (var i = 0, len = list.length; i < len; i++) {
- clist[i] = list[i];
- }
- delete clist[len];
-}
-
-function handleErrors(token) {
- if (token === "" || token === undefined) {
- throwDOMException(DOMException.SYNTAX_ERR);
- }
- // TODO: test real space chacters
- if (token.indexOf(" ") > -1) {
- throwDOMException(DOMException.INVALID_CHARACTER_ERR);
- }
-}
-
-function getList(clist) {
- var str = clist._getString();
- if (str === "") {
- return [];
- } else {
- return str.split(" ");
- }
-}
-
-function item(index) {
- if (index >= this.length) {
- return null;
- }
- return this._getString().split(" ")[index];
-}
-
-function contains(token) {
- handleErrors(token);
- var list = getList(this);
- return list.indexOf(token) > -1;
-}
-
-function add(token) {
- handleErrors(token);
- var list = getList(this);
- if (list.indexOf(token) > -1) {
- return;
- }
- list.push(token);
- this._setString(list.join(" ").trim());
- fixIndex(this, list);
-}
-
-function remove(token) {
- handleErrors(token);
- var list = getList(this);
- var index = list.indexOf(token);
- if (index > -1) {
- list.splice(index, 1);
- this._setString(list.join(" ").trim());
- }
- fixIndex(this, list);
-}
-
-function toggle(token) {
- if (this.contains(token)) {
- this.remove(token);
- return false;
- } else {
- this.add(token);
- return true;
- }
-}
-
-function _toString() {
- return this._getString();
-}
-});
-M8.define('interfaces/CustomEvent','shims',function(require, module, exports){
-module.exports = {
- constructor: constructor,
- interface: window.Event
-};
-
-function constructor(type, dict) {
- var e = document.createEvent("CustomEvent");
- dict = dict || {};
- dict.detail = dict.detail || null;
- dict.bubbles = dict.bubbles || false;
- dict.catchable = dict.catchable || false;
- if (e.initCustomEvent) {
- e.initCustomEvent(type, dict.bubbles, dict.catchable, dict.detail);
- } else {
- e.initEvent(type, dict.bubbles, dict.catchable);
- e.detail = dict.detail;
- }
- return e;
-}
-});
-M8.define('interfaces/Element','shims',function(require, module, exports){
-var DOMTokenList = require("all::interfaces/DOMTokenList").constructor;
-
-module.exports = {
- parentElement: {
- get: getParentElement
- },
- classList: {
- get: getClassList
- }
-}
-
-function getParentElement() {
- var parent = this.parentNode;
- if (parent == null) {
- return null;
- }
- if (parent.nodeType === Node.ELEMENT_NODE) {
- return parent;
- }
- return null;
-}
-
-function getClassList() {
- var el = this;
-
- if (this._classList) {
- return this._classList;
- } else {
- var dtlist = new DOMTokenList(
- function _getClassName() {
- return el.className || "";
- },
- function _setClassName(v) {
- el.className = v;
- }
- );
- this._classList = dtlist;
- return dtlist;
- }
-}
-});
-M8.define('interfaces/Event','shims',function(require, module, exports){
-module.exports = {
- constructor: constructor
-};
-
-function constructor(type, dict) {
- var e = document.createEvent("Events");
- dict = dict || {};
- dict.bubbles = dict.bubbles || false;
- dict.catchable = dict.catchable || false;
- e.initEvent(type, dict.bubbles, dict.catchable);
- return e;
-}
-});
-M8.define('interfaces/EventTarget','shims',function(require, module, exports){
-module.exports = {
- interface: window.Node || window.Element
-}
-});
-M8.define('interfaces/Node','shims',function(require, module, exports){
-module.exports = {
- contains: {
- value: contains
- },
- interface: window.Element
-}
-
-function contains(other) {
- var comparison = this.compareDocumentPosition(other);
- if (comparison === 0 ||
- comparison & Node.DOCUMENT_POSITION_CONTAINED_BY
- ) {
- return true;
- }
- return false;
-}
-});
-M8.define('interfaces/index','shims',function(require, module, exports){
-module.exports = {
- CustomEvent: require("./CustomEvent"),
- Element: require("./Element"),
- Event: require("./Event"),
- EventTarget: require("./EventTarget"),
- Node: require("./Node")
-};
-});
-M8.define('bugs','shims',function(require, module, exports){
-var utils = require("utils::index");
-
-module.exports = run;
-
-function run() {
-
-// IE9 thinks the argument is not optional
-// FF thinks the argument is not optional
-// Opera agress that its not optional
-(function () {
- var e = document.createElement("div");
- try {
- document.importNode(e);
- } catch (e) {
- var importNode = document.importNode;
- delete document.importNode;
- document.importNode = function _importNode(node, bool) {
- if (bool === undefined) {
- bool = true;
- }
- return importNode.call(this, node, bool);
- }
- }
-})();
-
-// Firefox fails on .cloneNode thinking argument is not optional
-// Opera agress that its not optional.
-(function () {
- var el = document.createElement("p");
-
- try {
- el.cloneNode();
- } catch (e) {
- [
- Node.prototype,
- Comment.prototype,
- Element.prototype,
- ProcessingInstruction.prototype,
- Document.prototype,
- DocumentType.prototype,
- DocumentFragment.prototype
- ].forEach(fixNodeOnProto);
-
- utils.HTMLNames.forEach(forAllHTMLInterfaces)
- }
-
- function forAllHTMLInterfaces(name) {
- window[name] && fixNodeOnProto(window[name].prototype);
- }
-
- function fixNodeOnProto(proto) {
- var cloneNode = proto.cloneNode;
- delete proto.cloneNode;
- proto.cloneNode = function _cloneNode(bool) {
- if (bool === undefined) {
- bool = true;
- }
- return cloneNode.call(this, bool);
- };
- }
-})();
-
-// Opera is funny about the "optional" parameter on addEventListener
-(function () {
- var count = 0;
- var handler = function () {
- count++;
- }
- document.addEventListener("click", handler);
- var ev = new Event("click");
- document.dispatchEvent(ev);
- if (count === 0) {
- // fix opera
- var oldListener = EventTarget.prototype.addEventListener;
- EventTarget.prototype.addEventListener = function (ev, cb, optional) {
- optional = optional || false;
- return oldListener.call(this, ev, cb, optional);
- };
- // fix removeEventListener aswell
- var oldRemover = EventTarget.prototype.removeEventListener;
- EventTarget.prototype.removeEventListener = function (ev, cb, optional) {
- optional = optional || false;
- return oldRemover.call(this, ev, cb, optional);
- };
- // punch window.
- window.addEventListener = EventTarget.prototype.addEventListener;
- window.removeEventListener = EventTarget.prototype.removeEventListener;
- }
- document.removeEventListener("click", handler);
-})();
-
-}
-});
// app code - safety wrap
@@ -682,11 +274,11 @@ function clone(node, document, deep) {
}
});
M8.define('main','app',function(require, module, exports){
-var shims = require("shims::interfaces"),
+var shims = require("data::shims"),
utils = require("utils");
-Object.keys(shims).forEach(function _eachShim(name) {
- var shim = shims[name];
+shims.forEach(function _eachShim(name) {
+ var shim = require("interfaces::" + name);
var constructor = window[name];
if (!constructor) {
constructor = window[name] = shim.interface;
@@ -707,9 +299,9 @@ Object.keys(shims).forEach(function _eachShim(name) {
}
utils.addShimToInterface(shim, proto, constructor);
-});
-require("shims::bugs")();
+ require("bugs::" + name)();
+});
});
})();
})();
View
7 node_modules/express/.npmignore
@@ -0,0 +1,7 @@
+.git*
+docs/
+examples/
+support/
+test/
+testing.js
+.DS_Store
View
770 node_modules/express/History.md