smparkes-envjs 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (186) hide show
  1. data/bin/envjsrb +157 -73
  2. data/bin/jquery-1.3.2-test.js +11 -4
  3. data/lib/envjs/env.js +935 -11028
  4. data/lib/envjs/net/cgi.rb +94 -0
  5. data/lib/envjs/net/file.rb +4 -4
  6. data/lib/envjs/runtime.rb +80 -24
  7. data/test/call-load-test.js +0 -2
  8. data/test/firebug/errorIcon.png +0 -0
  9. data/test/firebug/firebug.css +209 -0
  10. data/test/firebug/firebug.html +23 -0
  11. data/test/firebug/firebug.js +672 -0
  12. data/test/firebug/firebugx.js +10 -0
  13. data/test/firebug/infoIcon.png +0 -0
  14. data/test/firebug/warningIcon.png +0 -0
  15. data/test/fixtures/html/events.html +171 -0
  16. data/test/fixtures/html/iframe1.html +46 -0
  17. data/test/fixtures/html/iframe1a.html +46 -0
  18. data/test/fixtures/html/iframe2.html +45 -0
  19. data/test/fixtures/html/iframe3.html +28 -0
  20. data/test/fixtures/html/iframeN.html +57 -0
  21. data/test/fixtures/html/malformed.html +181 -0
  22. data/test/fixtures/html/scope.html +81 -0
  23. data/test/fixtures/html/trivial.html +19 -0
  24. data/test/fixtures/html/with_js.html +26 -0
  25. data/test/fixtures/images/icon-blue.png +0 -0
  26. data/test/fixtures/js/external_script.js +1 -0
  27. data/test/fixtures/js/script.js +1 -0
  28. data/test/fixtures/js/script_error.js +2 -0
  29. data/test/html/malformed.html +1 -0
  30. data/test/index.html +21 -19
  31. data/test/{primaryTests.js → primary-tests.js} +1 -3
  32. data/test/{prototype.js → prototype-test.js} +0 -2
  33. data/test/qunit/qunit/qunit.css +0 -0
  34. data/test/qunit/qunit/qunit.js +2 -2
  35. data/test/{qunit/qunit/qunit.js.smp → specs/dist/env.spec.js} +539 -7
  36. data/test/specs/envjs.spec.css +46 -0
  37. data/test/specs/parser/html.js +31 -0
  38. data/test/specs/parser/spec.html +40 -0
  39. data/test/specs/parser/xml.js +31 -0
  40. data/test/specs/qunit.bdd.js +210 -0
  41. data/test/{qunit.smp/qunit → specs}/qunit.css +0 -0
  42. data/test/{qunit.smp/qunit → specs}/qunit.js +2 -2
  43. data/test/specs/template/spec-0.js +31 -0
  44. data/test/specs/template/spec-1.js +31 -0
  45. data/test/specs/template/spec.html +40 -0
  46. data/test/specs/window/css.js +23 -0
  47. data/test/specs/window/dialog.js +25 -0
  48. data/test/specs/window/document.js +23 -0
  49. data/test/specs/window/event.js +25 -0
  50. data/test/specs/window/history.js +34 -0
  51. data/test/specs/window/location.js +34 -0
  52. data/test/specs/window/navigator.js +71 -0
  53. data/test/specs/window/screen.js +42 -0
  54. data/test/specs/window/spec.html +48 -0
  55. data/test/specs/window/timer.js +26 -0
  56. data/test/specs/window/window.js +53 -0
  57. data/test/specs/xhr/spec.html +47 -0
  58. data/test/specs/xhr/xhr.js +31 -0
  59. data/test/test.js +10 -0
  60. data/test/unit/elementmembers.js +31 -0
  61. data/test/unit/nu.validator.js +34 -0
  62. data/test/unit/onload.js +1 -3
  63. data/test/unit/parser.js +106 -98
  64. data/test/unit/prototypecompat.js +2 -2
  65. data/test/vendor/jQuery/1.3.2/ChangeLog.txt +98 -0
  66. data/test/vendor/jQuery/1.3.2/GPL-LICENSE.txt +278 -0
  67. data/test/vendor/jQuery/1.3.2/MIT-LICENSE.txt +20 -0
  68. data/test/vendor/jQuery/1.3.2/Makefile +154 -0
  69. data/test/vendor/jQuery/1.3.2/README +67 -0
  70. data/test/vendor/jQuery/1.3.2/build/ant-contrib-0.6.jar +0 -0
  71. data/test/vendor/jQuery/1.3.2/build/build/min.js +11 -0
  72. data/test/vendor/jQuery/1.3.2/build/build/pack.js +19 -0
  73. data/test/vendor/jQuery/1.3.2/build/js/Packer.js +209 -0
  74. data/test/vendor/jQuery/1.3.2/build/js/ParseMaster.js +106 -0
  75. data/test/vendor/jQuery/1.3.2/build/js/Words.js +62 -0
  76. data/test/vendor/jQuery/1.3.2/build/js/base2.js +978 -0
  77. data/test/vendor/jQuery/1.3.2/build/js/jsmin.js +316 -0
  78. data/test/vendor/jQuery/1.3.2/build/js/json.js +117 -0
  79. data/test/vendor/jQuery/1.3.2/build/js/pack.js +316 -0
  80. data/test/vendor/jQuery/1.3.2/build/js/parse.js +105 -0
  81. data/test/vendor/jQuery/1.3.2/build/js/writeFile.js +19 -0
  82. data/test/vendor/jQuery/1.3.2/build/js/xml.js +25 -0
  83. data/test/vendor/jQuery/1.3.2/build/js.jar +0 -0
  84. data/test/vendor/jQuery/1.3.2/build/runtest/env.js +1 -0
  85. data/test/vendor/jQuery/1.3.2/build/runtest/test.js +106 -0
  86. data/test/vendor/jQuery/1.3.2/build/runtest/testrunner.js +197 -0
  87. data/test/vendor/jQuery/1.3.2/build/speed/benchmarker.css +65 -0
  88. data/test/vendor/jQuery/1.3.2/build/speed/benchmarker.js +181 -0
  89. data/test/vendor/jQuery/1.3.2/build/speed/index.html +72 -0
  90. data/test/vendor/jQuery/1.3.2/build/speed/jquery-basis.js +3549 -0
  91. data/test/vendor/jQuery/1.3.2/build/style.xsl +99 -0
  92. data/test/vendor/jQuery/1.3.2/build/yuicompressor-2.4.2.jar +0 -0
  93. data/test/vendor/jQuery/1.3.2/build.xml +123 -0
  94. data/test/vendor/jQuery/1.3.2/dist/jquery.js +4376 -0
  95. data/test/vendor/jQuery/1.3.2/reminder.txt +3 -0
  96. data/test/vendor/jQuery/1.3.2/src/ajax.js +541 -0
  97. data/test/vendor/jQuery/1.3.2/src/core.js +1255 -0
  98. data/test/vendor/jQuery/1.3.2/src/data.js +145 -0
  99. data/test/vendor/jQuery/1.3.2/src/dimensions.js +49 -0
  100. data/test/vendor/jQuery/1.3.2/src/event.js +684 -0
  101. data/test/vendor/jQuery/1.3.2/src/fx.js +407 -0
  102. data/test/vendor/jQuery/1.3.2/src/intro.js +13 -0
  103. data/test/vendor/jQuery/1.3.2/src/offset.js +155 -0
  104. data/test/vendor/jQuery/1.3.2/src/outro.js +1 -0
  105. data/test/vendor/jQuery/1.3.2/src/selector.js +1015 -0
  106. data/test/vendor/jQuery/1.3.2/src/support.js +112 -0
  107. data/test/vendor/jQuery/1.3.2/test/data/cow.jpg +0 -0
  108. data/test/vendor/jQuery/1.3.2/test/data/dashboard.xml +11 -0
  109. data/test/vendor/jQuery/1.3.2/test/data/echoQuery.php +1 -0
  110. data/test/vendor/jQuery/1.3.2/test/data/iframe.html +8 -0
  111. data/test/vendor/jQuery/1.3.2/test/data/json.php +9 -0
  112. data/test/vendor/jQuery/1.3.2/test/data/json_assigned_obj.js +1 -0
  113. data/test/vendor/jQuery/1.3.2/test/data/json_obj.js +1 -0
  114. data/test/vendor/jQuery/1.3.2/test/data/jsonp.php +10 -0
  115. data/test/vendor/jQuery/1.3.2/test/data/name.html +1 -0
  116. data/test/vendor/jQuery/1.3.2/test/data/name.php +29 -0
  117. data/test/vendor/jQuery/1.3.2/test/data/offset/absolute.html +39 -0
  118. data/test/vendor/jQuery/1.3.2/test/data/offset/body.html +24 -0
  119. data/test/vendor/jQuery/1.3.2/test/data/offset/fixed.html +33 -0
  120. data/test/vendor/jQuery/1.3.2/test/data/offset/relative.html +31 -0
  121. data/test/vendor/jQuery/1.3.2/test/data/offset/scroll.html +39 -0
  122. data/test/vendor/jQuery/1.3.2/test/data/offset/static.html +31 -0
  123. data/test/vendor/jQuery/1.3.2/test/data/offset/table.html +43 -0
  124. data/test/vendor/jQuery/1.3.2/test/data/params_html.php +12 -0
  125. data/test/vendor/jQuery/1.3.2/test/data/test.html +7 -0
  126. data/test/vendor/jQuery/1.3.2/test/data/test.js +3 -0
  127. data/test/vendor/jQuery/1.3.2/test/data/test.php +7 -0
  128. data/test/vendor/jQuery/1.3.2/test/data/test2.html +5 -0
  129. data/test/vendor/jQuery/1.3.2/test/data/test3.html +3 -0
  130. data/test/vendor/jQuery/1.3.2/test/data/testrunner.js +1 -0
  131. data/test/vendor/jQuery/1.3.2/test/data/text.php +12 -0
  132. data/test/vendor/jQuery/1.3.2/test/data/with_fries.xml +25 -0
  133. data/test/vendor/jQuery/1.3.2/test/index.html +229 -0
  134. data/test/vendor/jQuery/1.3.2/test/jqenv-1259090275493.html +247 -0
  135. data/test/vendor/jQuery/1.3.2/test/jqenv-1259091671501.html +247 -0
  136. data/test/vendor/jQuery/1.3.2/test/jqenv-1259175319655.html +247 -0
  137. data/test/vendor/jQuery/1.3.2/test/offset.html +28 -0
  138. data/test/vendor/jQuery/1.3.2/test/otherlibs/jquery/1.2.1/jquery.js +11 -0
  139. data/test/vendor/jQuery/1.3.2/test/otherlibs/jquery/1.2.3/jquery.js +11 -0
  140. data/test/vendor/jQuery/1.3.2/test/otherlibs/mootools/1.11/mootools.js +1577 -0
  141. data/test/vendor/jQuery/1.3.2/test/otherlibs/prototype/1.6.0.2/prototype.js +4221 -0
  142. data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.7.0/builder.js +131 -0
  143. data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.7.0/controls.js +835 -0
  144. data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.7.0/dragdrop.js +944 -0
  145. data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.7.0/effects.js +1090 -0
  146. data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.7.0/scriptaculous.js +51 -0
  147. data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.7.0/slider.js +278 -0
  148. data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.7.0/unittest.js +564 -0
  149. data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/builder.js +136 -0
  150. data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/controls.js +965 -0
  151. data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/dragdrop.js +974 -0
  152. data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/effects.js +1122 -0
  153. data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/scriptaculous.js +58 -0
  154. data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/slider.js +275 -0
  155. data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/sound.js +55 -0
  156. data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/unittest.js +568 -0
  157. data/test/vendor/jQuery/1.3.2/test/polluted.php +64 -0
  158. data/test/vendor/jQuery/1.3.2/test/qunit/testrunner.js +780 -0
  159. data/test/vendor/jQuery/1.3.2/test/qunit/testsuite.css +120 -0
  160. data/test/vendor/jQuery/1.3.2/test/test.js +41 -0
  161. data/test/vendor/jQuery/1.3.2/test/unit/ajax.js +856 -0
  162. data/test/vendor/jQuery/1.3.2/test/unit/core.js +1872 -0
  163. data/test/vendor/jQuery/1.3.2/test/unit/data.js +160 -0
  164. data/test/vendor/jQuery/1.3.2/test/unit/dimensions.js +86 -0
  165. data/test/vendor/jQuery/1.3.2/test/unit/event.js +670 -0
  166. data/test/vendor/jQuery/1.3.2/test/unit/fx.js +451 -0
  167. data/test/vendor/jQuery/1.3.2/test/unit/offset.js +173 -0
  168. data/test/vendor/jQuery/1.3.2/test/unit/selector.js +395 -0
  169. data/test/vendor/jQuery/1.3.2/test/xhtml.php +5 -0
  170. data/test/vendor/jQuery/1.3.2/version.txt +1 -0
  171. metadata +158 -22
  172. data/lib/envjs/runtime.rb.smp +0 -133
  173. data/test/envjs-call-load-test.js +0 -5
  174. data/test/envjs-prototype.js +0 -5
  175. data/test/qunit/package.json +0 -21
  176. data/test/qunit/test/index.html +0 -17
  177. data/test/qunit/test/same.js +0 -1368
  178. data/test/qunit/test/test.js +0 -136
  179. data/test/qunit.smp/package.json +0 -21
  180. data/test/qunit.smp/test/index.html +0 -17
  181. data/test/qunit.smp/test/same.js +0 -1368
  182. data/test/qunit.smp/test/test.js +0 -136
  183. data/test/rhino-call-load-test.js +0 -5
  184. data/test/rhino-prototype.js +0 -5
  185. data/test/test-with-envs-jar.js +0 -8
  186. data/test/test-with-rhino-jar.js +0 -9
@@ -0,0 +1,48 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
+ <title>Envjs Window Spec</title>
6
+ <link rel="stylesheet" media="screen" href="../qunit.css"/>
7
+ <link rel="stylesheet" media="screen" href="../envjs.spec.css"/>
8
+ <link rel="stylesheet" media="screen" href="http://www.envjs.com/css/blueprint/screen.css"/>
9
+ <link rel="stylesheet" media="screen" href="http://www.envjs.com/css/site.css"/>
10
+ <script type='text/javascript' src='../qunit.js'></script>
11
+ <script type='text/javascript' src='../qunit.bdd.js'></script>
12
+
13
+ <!-- specs for this general api 'module' -->
14
+ <script type='text/javascript' src='window.js'></script>
15
+ <script type='text/javascript' src='css.js'></script>
16
+ <script type='text/javascript' src='dialog.js'></script>
17
+ <script type='text/javascript' src='document.js'></script>
18
+ <script type='text/javascript' src='event.js'></script>
19
+ <script type='text/javascript' src='history.js'></script>
20
+ <script type='text/javascript' src='location.js'></script>
21
+ <script type='text/javascript' src='navigator.js'></script>
22
+ <script type='text/javascript' src='screen.js'></script>
23
+ <script type='text/javascript' src='timer.js'></script>
24
+ </head>
25
+ <body class='container'>
26
+ <h2 id="qunit-banner">
27
+ <img id="envjs-icon"
28
+ src="../../fixtures/images/icon-blue.png"
29
+ height='40'/>
30
+ <span id="spec-title">Envjs Window Spec</span>
31
+ </h2>
32
+ <h2 id="qunit-userAgent"></h2>
33
+ <div id='qunit-testrunner-toolbar'></div>
34
+ <div id='qunit-test-summary'>
35
+ <ol id='qunit-tests'></ol>
36
+ </div>
37
+ <div id="qunit-main" style="display:none;">
38
+ <!--
39
+ Test HTML here:
40
+
41
+ not required to be in here but it makes it convenient
42
+ by convention to avoid having to look at the html
43
+ artifacts the test may require or have generated as
44
+ a side effect.
45
+ -->
46
+ </div>
47
+ </body>
48
+ </html>
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @author thatcher
3
+ */
4
+
5
+ (function(Q){
6
+
7
+ Q.describe('Window Timer',{
8
+
9
+ before:function(){
10
+ //setup
11
+ },
12
+ after:function(){
13
+ //tear down
14
+ }
15
+
16
+ }).should('provide the required w3c interfaces', function(){
17
+
18
+ expect(4);
19
+ ok(setTimeout, 'setTimeout');
20
+ ok(setInterval, 'setInterval');
21
+ ok(clearTimeout, 'clearTimeout');
22
+ ok(clearInterval, 'clearInterval');
23
+
24
+ });
25
+
26
+ })(QUnit);
@@ -0,0 +1,53 @@
1
+ /**
2
+ * @author thatcher
3
+ */
4
+ var global_scope=this;
5
+
6
+ (function(Q){
7
+
8
+ Q.describe('Window Basic Properties',{
9
+
10
+ before:function(){
11
+ //setup
12
+ },
13
+ after:function(){
14
+ //tear down
15
+ }
16
+
17
+ }).should('provide the required w3c interfaces', function(){
18
+
19
+ expect(19);
20
+ ok(window, 'window');
21
+ ok(self, 'self');
22
+ ok(top, 'top');
23
+ ok(parent, 'parent');
24
+ ok(window.toString(), '[object Window]');
25
+
26
+ //these values are usually the empty string ''
27
+ //so we just verify the property is available
28
+ ok('name' in window, 'name');
29
+ ok('status' in window, 'status');
30
+ ok('closed' in window, 'closed');
31
+ ok('defaultStatus' in window, 'defaultStatus');
32
+ ok('length' in window, 'length');
33
+ ok('opener' in window, 'opener');
34
+
35
+ ok(frames, 'frames');
36
+ ok(open, 'open');
37
+ ok(close, 'close');
38
+ ok(innerHeight, 'innerHeight');
39
+ ok(outerHeight, 'outerHeight');
40
+ ok(outerWidth, 'outerWidth');
41
+ ok(screenX, 'screenX');
42
+ ok(screenY, 'screenY');
43
+
44
+
45
+ }).should('have the expected values', function(){
46
+
47
+ equals( window, global_scope, 'window is the global scope "this"');
48
+ equals( window, self, 'self is an alias for window');
49
+ equals( window, top, 'top is an alias for window when the window is not in a frame');
50
+
51
+ });
52
+
53
+ })(QUnit);
@@ -0,0 +1,47 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
+ <title>Envjs Window Spec</title>
6
+ <link rel="stylesheet" media="screen" href="../qunit.css"/>
7
+ <link rel="stylesheet" media="screen" href="../envjs.spec.css"/>
8
+ <link rel="stylesheet" media="screen" href="http://www.envjs.com/css/blueprint/screen.css"/>
9
+ <link rel="stylesheet" media="screen" href="http://www.envjs.com/css/site.css"/>
10
+ <script type='text/javascript' src='../qunit.js'></script>
11
+ <script type='text/javascript' src='../qunit.bdd.js'></script>
12
+
13
+ <!-- specs for this general api 'module' -->
14
+ <script type='text/javascript' src='css.js'></script>
15
+ <script type='text/javascript' src='dialog.js'></script>
16
+ <script type='text/javascript' src='document.js'></script>
17
+ <script type='text/javascript' src='event.js'></script>
18
+ <script type='text/javascript' src='history.js'></script>
19
+ <script type='text/javascript' src='location.js'></script>
20
+ <script type='text/javascript' src='navigator.js'></script>
21
+ <script type='text/javascript' src='window.js'></script>
22
+ <script type='text/javascript' src='timer.js'></script>
23
+ </head>
24
+ <body class='container'>
25
+ <h2 id="qunit-banner">
26
+ <img id="envjs-icon"
27
+ src="../../fixtures/images/icon-blue.png"
28
+ height='40'/>
29
+ <span id="spec-title">Envjs Window Spec</span>
30
+ </h2>
31
+ <h2 id="qunit-userAgent"></h2>
32
+ <div id='qunit-testrunner-toolbar'></div>
33
+ <div id='qunit-test-summary'>
34
+ <ol id='qunit-tests'></ol>
35
+ </div>
36
+ <div id="qunit-main" style="display:none;">
37
+ <!--
38
+ Test HTML here:
39
+
40
+ not required to be in here but it makes it convenient
41
+ by convention to avoid having to look at the html
42
+ artifacts the test may require or have generated as
43
+ a side effect.
44
+ -->
45
+ </div>
46
+ </body>
47
+ </html>
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @author thatcher
3
+ */
4
+
5
+ (function(Q){
6
+
7
+ Q.describe('Another TEMPLATE Spec',{
8
+ before:function(){
9
+ //setup
10
+ },
11
+ after:function(){
12
+ //tear down
13
+ }
14
+
15
+ }).should('do something', function(){
16
+
17
+ expect(1);
18
+ ok(true, 'good job');
19
+
20
+ }).should('do something else', function(){
21
+
22
+ expect(1);
23
+ ok(true, 'good job');
24
+
25
+ }).pending('should do something new soon', function(){
26
+
27
+ expect(1);
28
+ ok(false, 'todo');
29
+ });
30
+
31
+ })(QUnit);
data/test/test.js ADDED
@@ -0,0 +1,10 @@
1
+ whichJarFile = arguments[0];
2
+ whichTestFile = arguments[1];
3
+
4
+ multiwindow = !(whichJarFile == "rhino");
5
+ whichInterpreter = whichJarFile + " interpreter jar";
6
+
7
+ load("dist/env.rhino.js");
8
+ load("test/" + whichTestFile + ".js");
9
+
10
+ Envjs.wait();
@@ -27,3 +27,34 @@ test("attributes common to all HTML elements", function() {
27
27
  }catch(e){print(e);}
28
28
  });
29
29
 
30
+ test("select element", function() {
31
+ expect(14);
32
+
33
+ var select = document.getElementById('select1');
34
+ equals("select-one", select.type, "Select field's type is select-one by default");
35
+
36
+ select = document.getElementById('test_value');
37
+ equals("optionvalue", select.value, "Select field returns its selected option's value as its value");
38
+
39
+ // if option2 is selected, unselect option1 (and update select.value)
40
+ select = document.getElementById('test_selecting');
41
+ select.options[2].selected = true;
42
+ ok(select.options[2].selected, "Select's option should be selected");
43
+ ok(!select.options[1].selected, "Previously selected option should be automatically unselected");
44
+ equals("2", select.value, "Select's value should be updated");
45
+
46
+ // if option2 is unselected, then select first option on the list (and update select.value)
47
+ select.options[2].selected = false;
48
+ ok(!select.options[2].selected, "Select's option should be unselected");
49
+ ok(!select.options[1].selected, "Previously selected option should stay unselected");
50
+ ok(select.options[0].selected, "First option in the select should be selected");
51
+ equals("0", select.value, "Select's value should be updated");
52
+
53
+ // update select's value and options when selectedIndex is changed
54
+ equals(0, select.selectedIndex, "Select's selectedIndex should return the index of selected option");
55
+ select.selectedIndex = 2;
56
+ equals(2, select.selectedIndex, "Select's selectedIndex should be updated");
57
+ equals("2", select.value, "Changing selectedIndex should update select's value");
58
+ ok(!select.options[0].selected, "Changing selectedIndex should unselect currently selected option");
59
+ ok(select.options[2].selected, "Changing selectedIndex should select option at given index");
60
+ });
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @author thatcher
3
+ */
4
+
5
+ load('dist/env.rhino.js');
6
+
7
+ window.location = 'test/html/malformed.html';
8
+
9
+
10
+ var fixture = document.xml,
11
+ testhtml = '<!DOCTYPE html><html><head/><body><script>document.write("<a>efg");</script><p>abc</body></html>',
12
+ testfragment = '<div>this is a<strong>pig<div>oink oink!',
13
+ success = function(){
14
+ print(doc.xml);
15
+ };
16
+
17
+ var doc;
18
+ //Envjs.logLevel = Envjs.DEBUG;
19
+ doc = new DOMParser().parseFromString(testhtml);
20
+ print(doc.xml);
21
+
22
+
23
+ doc.body.innerHTML = testfragment;
24
+ print(doc.xml);
25
+
26
+
27
+ /*
28
+ var start = new Date().getTime();
29
+ for(var i=0;i<1000;i++){
30
+ parseHtmlDocument(trivial, document, null, null);
31
+ }
32
+ var stop = new Date().getTime();
33
+ print("1000 parses "+(stop-start));
34
+ */
data/test/unit/onload.js CHANGED
@@ -14,7 +14,7 @@ test("Execution of onload events in top-level document",
14
14
  function() {
15
15
 
16
16
  // top-level window-onload works, or test framework wouldn't run.....
17
- expect(10);
17
+ expect(11);
18
18
 
19
19
  var mtch = document.getElementById('pCreatedByBodyOnload').innerHTML.
20
20
  match(/dynamically-generated paragraph/);
@@ -22,13 +22,11 @@ test("Execution of onload events in top-level document",
22
22
  "Got confirmation that body-onload handler executed");
23
23
  }catch(e){print(e);}
24
24
 
25
- /*
26
25
  mtch = document.getElementById('pCreatedByIframeOnload').innerHTML.
27
26
  match(/iframe-onload event handler/);
28
27
  try{ ok(mtch && mtch.length > 0,
29
28
  "Got confirmation that iframe-onload handler executed");
30
29
  }catch(e){print(e);}
31
- */
32
30
 
33
31
  var iframe = document.getElementById('loadediframe');
34
32
  var aCounter = 0;
data/test/unit/parser.js CHANGED
@@ -1,113 +1,121 @@
1
- // environment mocking for parser
2
- $w = { }
3
- $env = { debug: function() {} }
4
- $openingWindow = $parentWindow = $initTop = null;
5
- this.options = this.options || {}
6
-
7
- load("src/window/window.js", "src/dom/parser.js", "src/dom/entities.js");
8
-
9
- module("parser");
10
-
11
- test("Entity replaced", function() {
12
- expect(14);
13
- var htmlstr = "<html><body>Hello, &quot;World&quot;!</body></html>";
14
- var p = new XMLP(htmlstr);
15
- equals(XMLP._ELM_B, p.next(), "Opening html tag"); // _ELM_B <html>
16
- equals(XMLP._ELM_B, p.next(), "Opening body tag"); // _ELM_B <body>
17
-
18
- equals(XMLP._TEXT, p.next(), "Parser emits text event");
19
- var actual = p.getContent().substring(p.getContentBegin(), p.getContentEnd());
20
- equals("Hello, ", actual, "Parser content set");
21
- equals(XMLP._ENTITY, p.next(), "Parser emits entity event");
22
-
23
- actual = p.getContent().substring(p.getContentBegin(), p.getContentEnd());
24
- equals('"', actual, "Parser replaces &quot; entity");
1
+ module("Html5Parser");
2
+
3
+ var should = function(msg, options){
4
+ try{
5
+ if(options.be&&options.be=='equal'){
6
+ equals(
7
+ options.expected,
8
+ options.actual,
9
+ msg
10
+ );
11
+ }else if(options.be&&options.be==='safe'){
12
+ options.test();
13
+ ok(true, msg);
14
+ }else{
15
+ ok(false, 'unknown test '+options.be);
16
+ }
17
+ }catch(e){
18
+ //no nothing
19
+ equals(true, false, options.msg||'This test failed.');
20
+ }finally{
21
+ //TODO: might as well keep score here
22
+ return this;
23
+ }
24
+ };
25
25
 
26
- equals(XMLP._TEXT, p.next(), "Parser emits second text event");
27
- actual = p.getContent().substring(p.getContentBegin(), p.getContentEnd());
28
- equals("World", actual, "Parser content set");
29
26
 
30
- equals(XMLP._ENTITY, p.next(), "Parser emits second entity event");
31
- actual = p.getContent().substring(p.getContentBegin(), p.getContentEnd());
32
- equals('"', actual, "Parser replaces second &quot; entity");
27
+ test("XML Standard Entities: Spot Check", function() {
33
28
 
34
- equals(XMLP._TEXT, p.next(), "Parser emits third text event");
35
- actual = p.getContent().substring(p.getContentBegin(), p.getContentEnd());
36
- equals('!', actual, "Parser content set");
29
+ expect(2);
30
+ var htmlstr =
31
+ "<div id='xmlentity' \
32
+ style='&lt;Hello&gt;, &quot;W&apos;rld&quot;!'\
33
+ >&lt;Hello&gt;, &quot;W&apos;rld&quot;!</div>";
37
34
 
38
- equals(XMLP._ELM_E, p.next(), "Closing body tag"); // _ELM_E </body>
39
- equals(XMLP._ELM_E, p.next(), "Closing html tag"); // _ELM_E </html>
35
+ var doc = document.implementation.createHTMLDocument();
36
+ doc.body.innerHTML = htmlstr;
37
+
38
+ should("Replace entities at nodeValue",{
39
+ be:'equal',
40
+ actual : doc.
41
+ getElementById('xmlentity').
42
+ childNodes[0].
43
+ nodeValue,
44
+ expected : '<Hello>, "W\'rld"!'
45
+ }).
46
+ should("serialize only &amp;, &lt; and &gt; for TextNode with innerHTML",{
47
+ be: 'equal',
48
+ actual : doc.
49
+ getElementById('xmlentity').
50
+ innerHTML,
51
+ expected : '&lt;Hello&gt;, "W\'rld"!'
52
+ });
53
+
40
54
  });
41
55
 
42
- test("HTML standard entities spot-check", function() {
43
- // test definition
44
- var numentities = 23;
45
- var numexpect = 2 + (4*numentities);
46
- expect(numexpect)
47
- var htmlstr = "<html><body>&quot; &amp; &lt; &gt; "+
56
+ test("HTML Standard Entities: Spot Check", function() {
57
+
58
+ expect(1);
59
+ var htmlstr = "<div id='htmlentity'>&quot; &amp; &lt; &gt; "+
48
60
  "&nbsp; &copy; &reg; &yen; &para; " +
49
61
  "&Ecirc; &Otilde; &aelig; &divide; &Kappa; &theta; "+
50
62
  "&bull; &hellip; &trade; &rArr; &sum; &clubs; " +
51
- "&ensp; &mdash; </body></html>";
52
- var expected = [ '"', '&', '<', '>',
53
- '\xA0', '\xA9','\xAE','\xA5','\xB6',
54
- '\xCA', '\xD5', '\xE6', '\xF7', '\u039A','\u03B8',
55
- '\u2022','\u2026','\u2122','\u21D2','\u2211','\u2663',
56
- '\u2002','\u2014' ];
57
-
58
- // get started
59
- var p = new XMLP(htmlstr);
60
- equals(XMLP._ELM_B, p.next(), "Opening html tag"); // _ELM_B <html>
61
- equals(XMLP._ELM_B, p.next(), "Opening body tag"); // _ELM_B <body>
62
-
63
- // check entities
64
- for (idx=0; idx < numentities; idx++) {
65
- equals(XMLP._ENTITY, p.next(), "Parser emits entity event -- '" +
66
- expected[idx] + "'");
67
- actual = p.getContent().substring(
68
- p.getContentBegin(), p.getContentEnd());
69
- equals(expected[idx], actual, "Parser replaces entity -- '" +
70
- expected[idx] + "'");
71
-
72
- equals(XMLP._TEXT, p.next(), "Parser emits text event");
73
- actual = p.getContent().substring(
74
- p.getContentBegin(), p.getContentEnd());
75
- equals(" ", actual, "Parser content set");
76
- }
63
+ "&ensp; &mdash;</div>";
64
+
65
+ var doc = document.implementation.createHTMLDocument();
66
+ doc.body.innerHTML = htmlstr;
67
+
68
+ should("serialize only &amp;, &lt; and &gt; for TextNode with innerHTML",{
69
+ be:'equal',
70
+ actual:doc.
71
+ getElementById('htmlentity').
72
+ innerHTML,
73
+ expected : '" &amp; &lt; &gt; '+
74
+ '\xA0 \xA9 \xAE \xA5 \xB6 '+
75
+ '\xCA \xD5 \xE6 \xF7 \u039A \u03B8 '+
76
+ '\u2022 \u2026 \u2122 \u21D2 \u2211 \u2663 '+
77
+ '\u2002 \u2014'
78
+ });
79
+
77
80
  });
78
81
 
79
- test("Toggle entity replacement", function() {
80
- expect(6);
81
- var htmlstr = "<html><body>Hello, &quot;World&quot;!</body></html>";
82
- var p = new XMLP(htmlstr);
83
- p.replaceEntities = false;
84
- equals(XMLP._ELM_B, p.next(), "Opening html tag"); // _ELM_B <html>
85
- equals(XMLP._ELM_B, p.next(), "Opening body tag"); // _ELM_B <body>
82
+ test("Serialization Conventions", function(){
83
+
84
+ });
85
+
86
+ test("Ugly HTML Parsing", function() {
86
87
 
87
- equals(XMLP._TEXT, p.next(), "Parser emits text event");
88
- var actual = p.getContent().substring(p.getContentBegin(), p.getContentEnd());
89
- equals("Hello, &quot;World&quot;!", actual, "Parser content set");
88
+ expect(1);
89
+
90
+ var doc = document.implementation.createHTMLDocument();
91
+ doc.body.innerHTML = '<div id="pig"><p>this is a pig... &apos;oink! oink!&apos;</div>';
92
+
93
+ should('correct the unclosed p tag',{
94
+ be:'equal',
95
+ actual:doc.
96
+ getElementById('pig').
97
+ xml,
98
+ expected:'<div id="pig"><p>this is a pig... \'oink! oink!\'</p></div>'
99
+ });
90
100
 
91
- equals(XMLP._ELM_E, p.next(), "Closing body tag"); // _ELM_E </body>
92
- equals(XMLP._ELM_E, p.next(), "Closing html tag"); // _ELM_E </html>
93
101
  });
94
- /**
95
- test("Clean HTML", function() {
96
- expect(3);
97
- var domParser = new DOMParser(),
98
- htmlstr = "<div><p>this is a pig... &apos;oink! oink!&apos;</div>";
99
-
100
- Envjs.tidyHTML = true;
101
- equals(Envjs.tidy(htmlstr),
102
- "<div><p>this is a pig... 'oink! oink!'</p></div>",
103
- 'got expected xmlstring');
104
-
102
+
103
+ test("Really Ugly HTML Parsing", function() {
104
+
105
+ expect(1);
105
106
 
106
- var domnode = domParser.parseFromString(htmlstr);
107
- ok(domnode, 'Malformed p was parsed without error');
108
- equals(domnode.xml,
109
- "<div><p>this is a pig... 'oink! oink!'</p></div>",
110
- 'got expected value for .xml');
111
- Envjs.tidyHTML = false;
112
-
113
- });*/
107
+ should('parse the document without error',{
108
+ be:'safe',
109
+ test:function(){
110
+ var doc = document.implementation.createDocument();
111
+ doc.load('html/malformed.html');
112
+ }
113
+ });
114
+
115
+ });
116
+
117
+ // Local Variables:
118
+ // espresso-indent-level:4
119
+ // c-basic-offset:4
120
+ // tab-width:4
121
+ // End:
@@ -1,7 +1,7 @@
1
1
  //FYI: shipped with Rails 2.2.2
2
- load("test/vendor/prototype-1.6.0.3.js")
2
+ load("test/vendor/prototype-1.6.0.3.js");
3
3
 
4
- module("prototypecompat")
4
+ module("prototypecompat");
5
5
 
6
6
  test("$ method", function(){
7
7
  expect(1);
@@ -0,0 +1,98 @@
1
+ == jQuery ChangeLog ==
2
+
3
+ == 1.2.2 ==
4
+
5
+ * show is now element aware (uses default display type instead of just forcing block)
6
+ * New special events api: jQuery.events.special
7
+ * ready is now a real event and can be bound, unbound and triggered.
8
+ * mouseenter and mouseleave now work on all supported browsers
9
+ * The hover helper method now uses the mouseenter and mouseleave events
10
+ * New offset test suite test/offset.html (requires your pop-up blocker to be disabled)
11
+ * Refactored the width and height methods (fixes lots of bugs)
12
+ * Fixed event memory leaks in IE (html, remove, empty also no longer leak memory)
13
+ * Fixed window/document width/height values
14
+ * Fixed event.pageX and event.pageY in IE
15
+
16
+ == 1.2 ==
17
+
18
+ === 1.1.3 ===
19
+ * Always create an ActiveXObject when it is available instead of the XMLHttpRequest, even in IE7
20
+ * Removed XMLHttpRequest shadowing, may break code that relies on existence of that function for browser checking
21
+ * ...
22
+
23
+ === 1.1.2 ===
24
+
25
+ * Event handlers (like element.onclick) are now removed when no more functions are bound to the event.
26
+ * Fixed DOM Manipulations for form elements.
27
+ * Fixed jQuery.isFunction to return false on nodes.
28
+ * Fixed jQuery.className.has, escaping regex characters in className (for metadata)
29
+ * Fixed an issue in IE where an event on a cloned element is fired during a .clone() inside of an event handler.
30
+ * Fixed IE ID selectors selecting by the name attribute.
31
+ * Change: Events are now internally stored in elem.$events rather than elem.events (due to a nasty bug relating to DOM 0 expandos).
32
+ * .attr('href') is now consistent in all browsers.
33
+ * @href is now consistent in all browsers.
34
+ * Fixed the slideDown flickering bug.
35
+ * Having a \r endline in $("...") caused a never-ending loop.
36
+ * Fixed IE6 AJAX memory leak
37
+ * Fixed bug in pushStack, reporting an element at [0] in a jQuery object with length 0
38
+
39
+ === 1.1.1 ===
40
+
41
+ * Setting the numerical value of a css property failed, for example: .css("opacity",0.5) (also occurred with zIndex, fontWeight)
42
+ * Calling $(..., jqobj) with a context of a jQuery object failed.
43
+ * Accessing a property on an element that doesn't exist caused an error, for example: $("#foobar").attr("id")
44
+ * Calling .load() without a callback caused an error.
45
+ * You couldn't cancel an event that was triggered using .trigger() or .click() (for example).
46
+ * .add()ing a single DOM element to a jQuery object was broken.
47
+ * Passing in undefined values to a $.post() caused weird errors to occur.
48
+ * Accessing child nodes within an xml document didn't work properly.
49
+ * jQuery.isFunction() was unable to reliably determine a function, in a cross-browser way.
50
+ * Triggering a .click() failed in IE.
51
+ * Triggered click handlers were executed twice in most browsers.
52
+ * A newline passed into $(...) caused Firefox to go into a never-ending loop.
53
+ * Calling $.post() without any data caused an error.
54
+ * Calling a descendant selector after a child selector caused strange results, for example: $("ul > li ul")
55
+ * Triggered events did not occur if an event handler was not bound for that event.
56
+
57
+ == 1.1 ==
58
+
59
+ * Massive speed-ups (4x-10x) in the selector engine.
60
+ * You can now unbind event handlers from within themselves
61
+ * Added new .one( "type", fn ) method
62
+ * text(String) now escapes HTML
63
+ * Added attr(String,Function) to calculate the value
64
+ * Performming .click(), .blur(), .focus(), .submit() will actually trigger the browsers default action for those events.
65
+ * Added global settings for AJAX (in addition to timeout), use $.ajaxSetup() to modify them
66
+ * Implemented a better error handling for ajax requests. Exceptions caused by dropping connections are now handled, too.
67
+ * Improved event fixing (Opera provides event.srcElement, must ignore it if target is available; only create pageX if clientX is available)
68
+ * Fixed nth-child selectors to start on the right number
69
+ * jQuery is no longer destructive. Doing var a = $("a"); a.find("span"); does not change the original "a" variable.
70
+ * Fixed synchronous requests
71
+ * Fixed ID with context selectors (eg. div #id doesn't ignore "div" anymore)
72
+ * Fixed docs for html(): Now mentions that is not available for XML documents
73
+ * Improved AJAX docs (eg. more examples for $.ajax)
74
+ * Documented filter(Function), a very powerful approach for custom filtering
75
+ * Improved docs for FX module, merging method descriptions and marking optional arguments
76
+ * Improved docs for append, prepend, before and after, merging the three pairs into one
77
+ * Improved show/hide animations to show only hidden and hide only visible elements
78
+ * Removed .oneEvent() and .unEvent() helper methods.
79
+ * Removed all CSS helper methods.
80
+ * Removed most attribute helper methods.
81
+ * Removed the (undocumented) .find( "selector", fn ) for all destructive methods.
82
+ * $.get, $.getIfModified, $.post, $.getScript and $.getJSON now all pass through the XMLHttpRequest as returned by $.ajax
83
+
84
+ == 1.0.4 ==
85
+
86
+ * Tons of bug fixes
87
+ * Extensions to $.ajax: $.ajax accepts additonal options: beforeSend, async and processData; returns XMLHttpRequest to allow manual aborting of requests, see docs for details
88
+ * AJAX module: the public $.ajax API is now used internally (for $.get/$.post etc.); loading scripts works now much more reliable on all browers except Safari
89
+ * New global ajax handler: ajaxSend - called before an ajax request is sent
90
+ * Extensions to global ajax handlers: ajaxSend, ajaxSuccess, ajaxError and ajaxComplete get XMLHttpRequest and settings passed as arguments
91
+ * Extensions to event handling: pageX and pageY are available x-browser (IE does not provide native pageX/Y)
92
+ * Improved docs: $(String) method has now two seperate descriptions, one for selecting elements, one for creating (html on-the-fly)
93
+ * FX module: Most inline stlyes added by animations are now removed when the animation is complete, eg. height style when animating height (exception: display styles)
94
+ * Added note to attr(String, Object) about issues with setting the name property on input elements
95
+ * Seperated internal stuff from get() into set()
96
+ * Merged the two API examples for each() into one more precise example
97
+ * Improved docs for $.browser and added docs for $.boxModel
98
+ * Docs for the jQuery constructor $() were improved: There is now $(String expression[, Object context]) and $(String html)