diff --git a/bin/test-jquery.js b/bin/test-jquery.js
index 0381d4ab..9185d7d3 100644
--- a/bin/test-jquery.js
+++ b/bin/test-jquery.js
@@ -1,6 +1,6 @@
//debugger;
load("dist/env.rhino.js");
-load("plugins/qunit.env.js");
+load("plugins/env.qunit.js");
//yup its that easy
window.location = 'test/vendor/jQuery/'+arguments[0]+'/test/index.html';
\ No newline at end of file
diff --git a/build.xml b/build.xml
index d8b18eef..9c329a96 100644
--- a/build.xml
+++ b/build.xml
@@ -122,6 +122,7 @@
+
@@ -136,10 +137,10 @@
-
+
@@ -184,7 +185,7 @@
@@ -213,7 +214,6 @@
-
@@ -222,7 +222,7 @@
@@ -238,7 +238,7 @@
-
+
@@ -283,7 +283,7 @@
@@ -298,7 +298,7 @@
-
+
@@ -330,7 +330,7 @@
@@ -345,7 +345,7 @@
-
+
@@ -367,7 +367,7 @@
@@ -382,7 +382,7 @@
-
+
@@ -461,7 +461,7 @@
@@ -476,7 +476,7 @@
-
+
@@ -505,7 +505,7 @@
@@ -520,7 +520,7 @@
-
+
@@ -548,7 +548,7 @@
@@ -565,7 +565,7 @@
-
+
@@ -593,7 +593,7 @@
@@ -608,7 +608,7 @@
-
+
@@ -637,7 +637,7 @@
@@ -651,9 +651,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ depends="zip">
@@ -692,11 +709,27 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/htmlparser/gwt2/build.sh b/htmlparser/gwt2/build.sh
index 2b4ac310..f17e45fc 100755
--- a/htmlparser/gwt2/build.sh
+++ b/htmlparser/gwt2/build.sh
@@ -2,15 +2,23 @@
#
# Autodownload Parser
+# from mozilla HG.
+# TODO: use specific releases
#
-#
-PARSER=htmlparser-1.2.1
-PARSER_ZIP="${PARSER}.zip"
+PARSER=htmlparser
+#
+# Use mozilla trunk
+#
+echo "HG update from http://hg.mozilla.org/projects/htmlparser"
if [ ! -d "${PARSER}" ]; then
- wget "http://about.validator.nu/htmlparser/${PARSER_ZIP}"
- unzip ${PARSER_ZIP}
+ hg clone http://hg.mozilla.org/projects/htmlparser
+else
+ (cd "${PARSER}"; hg pull; hg update )
fi
+echo "----"
+
+echo "Installing GWT"
#
# Autodownload GWT
@@ -23,15 +31,17 @@ if [ ! -d "${GWT}" ]; then
wget "http://google-web-toolkit.googlecode.com/files/${GWT_ZIP}"
unzip ${GWT_ZIP}
fi
+echo "----"
-echo "Starting GWT compile..."
CP="./src:./${PARSER}/src:./${PARSER}/super:./${GWT}/gwt-user.jar:./${GWT}/gwt-dev.jar"
# Compile a new GWT linker. Very simple to Single Script Linker but
# removes all the "bootstrap" and client (real browser) onScriptLoad
# events, etc.
+echo "Javac our linker"
javac -cp ${CP} src/com/envjs/gwt/linker/ServerSingleScriptLinker.java
+echo "Starting GWT..."
java \
-Xmx256M \
-cp "${CP}" \
@@ -41,6 +51,8 @@ java \
nu.validator.htmlparser.HtmlParser;
# -draftCompile \
+echo "----"
+echo "COPY to envjs src tree"
cp war/nu.validator.htmlparser.HtmlParser/nu.validator.htmlparser.HtmlParser.nocache.js ../../src/parser/htmlparser.js
#
@@ -48,6 +60,7 @@ cp war/nu.validator.htmlparser.HtmlParser/nu.validator.htmlparser.HtmlParser.noc
# parser being invoked with the wrong state. This patch just prevents
# the parser from dying and throwing an exception.
#
+echo "PATCHING"
patch ../../src/parser/htmlparser.js patch1.diff
echo "DONE"
diff --git a/htmlparser/gwt2/patch1.diff b/htmlparser/gwt2/patch1.diff
index 9bf0a23e..17e98589 100644
--- a/htmlparser/gwt2/patch1.diff
+++ b/htmlparser/gwt2/patch1.diff
@@ -1,9 +1,14 @@
-2884a2885
-> if (current) {
-2885a2887
-> }
-10214c10216
-< gwtOnLoad();})();
-\ No newline at end of file
----
-> gwtOnLoad();})();
+*** nu.validator.htmlparser.HtmlParser.nocache.js~ Wed May 5 14:56:28 2010
+--- nu.validator.htmlparser.HtmlParser.nocache.js Wed May 5 15:12:56 2010
+***************
+*** 2825,2831 ****
+--- 2825,2833 ----
+ $processNonNcNames(attributes, this$static, this$static.namePolicy);
+ elt = $createElement_0(this$static, ns, elementName.name_0, attributes);
+ current = this$static.stack_0[this$static.currentPtr];
++ if (current) {
+ current.fosterParenting?$insertIntoFosterParent(this$static, elt):$appendElement(this$static, elt, current.node);
++ }
+ node = $StackNode_0(new StackNode, ns, elementName, elt);
+ $push_0(this$static, node);
+ }
diff --git a/htmlparser/gwt2/src/nu/validator/htmlparser/gwt/HtmlParser.java b/htmlparser/gwt2/src/nu/validator/htmlparser/gwt/HtmlParser.java
index 4093f5e0..eab4a9eb 100644
--- a/htmlparser/gwt2/src/nu/validator/htmlparser/gwt/HtmlParser.java
+++ b/htmlparser/gwt2/src/nu/validator/htmlparser/gwt/HtmlParser.java
@@ -26,7 +26,7 @@
import java.util.LinkedList;
import nu.validator.htmlparser.common.XmlViolationPolicy;
-//import nu.validator.htmlparser.impl.ErrorReportingTokenizer;
+import nu.validator.htmlparser.impl.ErrorReportingTokenizer;
import nu.validator.htmlparser.impl.Tokenizer;
import nu.validator.htmlparser.impl.UTF16Buffer;
@@ -101,7 +101,7 @@ public HtmlParser(JavaScriptObject document) {
this.domTreeBuilder = new BrowserTreeBuilder(document);
// updated here
- this.tokenizer = new Tokenizer(domTreeBuilder);
+ this.tokenizer = new ErrorReportingTokenizer(domTreeBuilder);
// ^
this.domTreeBuilder.setNamePolicy(XmlViolationPolicy.ALTER_INFOSET);
this.tokenizer.setCommentPolicy(XmlViolationPolicy.ALTER_INFOSET);
@@ -144,16 +144,73 @@ private void tokenize(String source, final boolean useSetTimeouts, String contex
pump(useSetTimeouts);
}
+ /**
+ * pump pushes tokens out to the parser (I believe).
+ *
+ * The default version of this (same file/directory but in the
+ * htmlparser/src-gwt directory, works file. However this has
+ * been hacked for the "useSetTimeout" flag which corresponses to
+ * the doc.async flag (with async --> use SetTimeouts).
+ *
+ * The async version parses a token then calls SetTimeout with 1ms,
+ * to be called again inorder to get another token. This lets other
+ * tasks in the timer run (perhaps networking) or pre-empty the parser.
+ *
+ * The Sync version just repeatably calls pumpcore
+ */
private void pump(boolean useSetTimeouts) throws SAXException {
-
+ if (pumpcore()) {
+ return;
+ }
+
+ if(useSetTimeouts){
+ // schedule
+ Timer timer = new Timer() {
+
+ @Override public void run() {
+ try {
+ pump(true);
+ } catch (SAXException e) {
+ ending = true;
+ if (errorHandler != null) {
+ try {
+ errorHandler.fatalError(new SAXParseException(
+ e.getMessage(), null, null, -1, -1, e));
+ } catch (SAXException e1) {
+ }
+ }
+ }
+ }
+
+ };
+ timer.schedule(1);
+ }else{
+ try {
+ while (!pumpcore()) { }
+ } catch (SAXException e) {
+ ending = true;
+ if (errorHandler != null) {
+ try {
+ errorHandler.fatalError(new SAXParseException(
+ e.getMessage(), null, null, -1, -1, e));
+ } catch (SAXException e1) {
+ }
+ }
+ }
+ }
+ }
+
+ private boolean pumpcore() throws SAXException {
+
if (ending) {
tokenizer.end();
domTreeBuilder.getDocument(); // drops the internal reference
parseEndListener.parseComplete();
// Don't schedule timeout
- return;
- }
+ return true;
+ }
+
int docWriteLen = documentWriteBuffer.length();
if (docWriteLen > 0) {
@@ -194,42 +251,8 @@ private void pump(boolean useSetTimeouts) throws SAXException {
continue;
}
}
+ return false;
- if(useSetTimeouts){
- // schedule
- Timer timer = new Timer() {
-
- @Override public void run() {
- try {
- pump(true);
- } catch (SAXException e) {
- ending = true;
- if (errorHandler != null) {
- try {
- errorHandler.fatalError(new SAXParseException(
- e.getMessage(), null, null, -1, -1, e));
- } catch (SAXException e1) {
- }
- }
- }
- }
-
- };
- timer.schedule(1);
- }else{
- try {
- pump(false);
- } catch (SAXException e) {
- ending = true;
- if (errorHandler != null) {
- try {
- errorHandler.fatalError(new SAXParseException(
- e.getMessage(), null, null, -1, -1, e));
- } catch (SAXException e1) {
- }
- }
- }
- }
}
private void push(UTF16Buffer buffer) {
diff --git a/specs/env.qunit.js b/specs/env.qunit.js
index f188f11b..f01876c9 100644
--- a/specs/env.qunit.js
+++ b/specs/env.qunit.js
@@ -35,6 +35,4 @@ QUnit.done = function( fail, pass){
};
QUnit.start = function(){
_start();
- Envjs.wait();
}
-
diff --git a/specs/fulldoc/boot.js b/specs/fulldoc/boot.js
new file mode 100644
index 00000000..d833f20e
--- /dev/null
+++ b/specs/fulldoc/boot.js
@@ -0,0 +1,22 @@
+
+/**
+ *
+ */
+var myprint = print;
+load('dist/env.rhino.js');
+
+
+Envjs({
+ scriptTypes: { "text/javascript": true },
+});
+window.location = 'specs/fulldoc/index.html';
+
+var div = window.document.getElementById('qunit-testresult');
+var spans = div.getElementsByTagName('SPAN')
+
+var summary = {};
+for (var i = 0; i < spans.length; ++i) {
+ var clazz = spans[i].getAttribute('class');
+ summary[clazz] = parseInt(spans[i].textContent);
+ myprint(clazz + ' = ' + summary[clazz]);
+}
diff --git a/specs/fulldoc/index.html b/specs/fulldoc/index.html
new file mode 100644
index 00000000..c3e4c85b
--- /dev/null
+++ b/specs/fulldoc/index.html
@@ -0,0 +1,41 @@
+
+
+
+
+ Envjs Parser Spec
+
+
+
+
+
+
+
+
+
+
+
+
+ Envjs Parser Spec
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/specs/fulldoc/spec.js b/specs/fulldoc/spec.js
new file mode 100644
index 00000000..b4b26bd8
--- /dev/null
+++ b/specs/fulldoc/spec.js
@@ -0,0 +1,46 @@
+QUnit.module('integration');
+
+/**
+ * This is very different from the other tests in that the "work"
+ * in done, //outside// of a test(). The test() just check the
+ * final results. This is needed since the tests must run in
+ * tag of the main document.
+ */
+
+var isenvjs;
+try {
+ isenvjs = runningUnderEnvjs();
+} catch (e) {
+ isenvjs= false;
+}
+/**
+ * If a script in running in , then document.body === null
+ *
+ * Due to frame scoping rules, we have indirectly make the test.
+ * What we are really doing is this:
+ *
+ */
+document.bodyinhead = document.body;
+
+/**
+ * in
+ * Create a new