smparkes-envjs 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +25 -13
- data/bin/jquery-1.3.2-test.js +7 -6
- data/bin/test-jquery.sh +2 -2
- data/lib/envjs/env.js +11043 -92
- data/lib/envjs/runtime.rb +22 -1
- data/test/call-load-test.js +1 -1
- data/test/envjs-call-load-test.js +2 -0
- data/test/envjs-prototype.js +2 -0
- data/test/html/malformed.html +180 -0
- data/test/index.html +4 -1
- data/test/rhino-prototype.js +5 -0
- data/test/unit/dom.js +2 -1
- data/test/unit/elementmembers.js +1 -1
- data/test/unit/iframe.js +1 -1
- data/test/unit/onload.js +9 -3
- metadata +4 -10
- data/lib/envjs/runtime.rb.smp +0 -133
- data/test/qunit/qunit/qunit.js.smp +0 -1002
- data/test/qunit.smp/package.json +0 -21
- data/test/qunit.smp/qunit/qunit.css +0 -17
- data/test/qunit.smp/qunit/qunit.js +0 -997
- data/test/qunit.smp/test/index.html +0 -17
- data/test/qunit.smp/test/same.js +0 -1368
- data/test/qunit.smp/test/test.js +0 -136
data/README
CHANGED
@@ -57,36 +57,48 @@ Installing:
|
|
57
57
|
load('env.rhino.js'); //if in a Rhino script
|
58
58
|
|
59
59
|
2) Tell env.js to load an HTML file from your file system that it should model:
|
60
|
-
window.location = "some/file.html";
|
61
60
|
Envjs("some/file.html");
|
61
|
+
or
|
62
|
+
var someWindow = window.open("some/file.html");
|
63
|
+
or
|
64
|
+
window.location = "some/file.html";
|
62
65
|
|
63
66
|
Optionally you can turn on/off settings by passing an options object:
|
64
67
|
Envjs("some/file.html", {log: function(msg){ console.debug(msg) }});
|
65
68
|
|
66
69
|
3) Optionally trigger "document ready" events in one of these ways:
|
67
70
|
|
68
|
-
|
71
|
+
4) Start processing of window(s)' event queue:
|
72
|
+
Envjs.wait();
|
73
|
+
|
74
|
+
All together, the steps could be:
|
75
|
+
|
76
|
+
a) simplest method:
|
69
77
|
load('env.rhino.js');
|
70
|
-
window.location = "some/file.html";
|
71
78
|
Envjs("some/file.html");
|
72
|
-
|
79
|
+
Envjs.wait();
|
80
|
+
|
73
81
|
b) jQuery ready method:
|
74
82
|
load('env.rhino.js');
|
75
83
|
load('jquery-1.3.2.js');
|
76
84
|
Envjs("some/file.html");
|
77
85
|
load('some-code-that-sets-up-jquery-onready-behaviors.js')
|
78
86
|
jQuery.ready();
|
87
|
+
Envjs.wait();
|
79
88
|
|
80
89
|
c) Other JavaScript frameworks have their own methods of setup, but the general pattern is:
|
81
|
-
// load env.js
|
82
|
-
// load your framework
|
83
|
-
// tell env.js the base DOM to model
|
84
|
-
// run any setup code for your framework
|
85
|
-
// tell the framework that the document is loaded
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
+
// step 1: load env.js
|
91
|
+
// optionally: load your framework(s)
|
92
|
+
// step 2: tell env.js the base DOM to model
|
93
|
+
// optionally: run any setup code for your framework(s0
|
94
|
+
// step 3: tell the framework that the document is loaded
|
95
|
+
// step 4: Envjs.wait();
|
96
|
+
|
97
|
+
Note that env.js is currently limited to loading a single HTML page
|
98
|
+
from the original window. If you are going to load multiple pages in
|
99
|
+
succession into the same window, load the first into a new window
|
100
|
+
object using window.open().
|
101
|
+
|
90
102
|
Testing jQuery Compatibility:
|
91
103
|
* run ./bin/test-jquery.sh 1.3.2
|
92
104
|
* run ./bin/test-jquery.sh 1.3.1
|
data/bin/jquery-1.3.2-test.js
CHANGED
@@ -45,11 +45,12 @@ load("build/runtest/env.js");
|
|
45
45
|
isStopped = true;
|
46
46
|
unsafeStop.call(this);
|
47
47
|
timeout = ( timeout && timeout > 0 ) ? timeout : 10000;
|
48
|
-
if (timeout)
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
48
|
+
/*if (timeout)
|
49
|
+
config_timeout = setTimeout(function() {
|
50
|
+
QUnit.ok( false, "Test timed out" );
|
51
|
+
start();
|
52
|
+
}, timeout);*/
|
53
|
+
$env.wait()
|
53
54
|
}
|
54
55
|
};
|
55
56
|
start = function(){
|
@@ -60,7 +61,7 @@ load("build/runtest/env.js");
|
|
60
61
|
clearTimeout(config_timeout);
|
61
62
|
config_timeout = undefined;
|
62
63
|
}
|
63
|
-
|
64
|
+
unsafeStart.call(this);
|
64
65
|
}
|
65
66
|
};
|
66
67
|
//we know some ajax calls will fail becuase
|
data/bin/test-jquery.sh
CHANGED
@@ -42,11 +42,11 @@ cp bin/jquery-$VERSION-test.js $JQUERY_DIR/build/runtest/test.js
|
|
42
42
|
|
43
43
|
if [ $DEBUG -eq 1 ]; then
|
44
44
|
echo 'enabling rhino debugger'
|
45
|
-
perl -pi~ -e "s/^JAR(.*)(-jar.*|-cp.*)/JAR\1 -cp \\$\{BUILD_DIR}\/js.jar org.mozilla.javascript.tools.debugger.Main/" $JQUERY_DIR/Makefile;
|
45
|
+
perl -pi~ -e "s/^JAR(.*)(-jar.*|-cp.*)/JAR\1 -cp \\$\{BUILD_DIR}\/js.jar org.mozilla.javascript.tools.debugger.Main -opt -1/" $JQUERY_DIR/Makefile;
|
46
46
|
else
|
47
47
|
if [ "x$JOHNSON" == "x " ]; then
|
48
48
|
echo 'running with rhino'
|
49
|
-
perl -pi~ -e "s/^JAR(.*)(-jar.*|-cp.*)/JAR\1 -cp \\$\{BUILD_DIR}\/js.jar org.mozilla.javascript.tools.envjs.Main/" $JQUERY_DIR/Makefile;
|
49
|
+
perl -pi~ -e "s/^JAR(.*)(-jar.*|-cp.*)/JAR\1 -cp \\$\{BUILD_DIR}\/js.jar org.mozilla.javascript.tools.envjs.Main -opt -1/" $JQUERY_DIR/Makefile;
|
50
50
|
else
|
51
51
|
echo 'running with johnson'
|
52
52
|
echo > $JQUERY_DIR/build/runtest/env.js
|