Skip to content

Commit

Permalink
tweak to make sure docs are loaded async
Browse files Browse the repository at this point in the history
  • Loading branch information
smparkes committed Feb 5, 2010
1 parent 8c858bc commit 9198ddb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/dom/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,11 @@ __extend__(DOMDocument.prototype, {
xhr = ({
open: function(){},
send: function(){
this.responseText = content;
this.onreadystatechange();
var self = this;
setTimeout(function(){
self.responseText = content;
self.onreadystatechange();
},0);
},
status: 200
});
Expand Down
6 changes: 6 additions & 0 deletions test/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ url_escaped = "data:text/html,"+escape(doc);
base64 = "data:text/html;base64,"+Base64.encode(doc);
debug(url_escaped);
window.location = "about:blank";
Envjs.wait();
window.location = url_escaped;
Envjs.wait();
debug(window.document.documentElement.innerHTML);
if(window.document.documentElement.innerHTML != inner){
debug(window.document.documentElement.innerHTML);
Expand All @@ -15,13 +17,17 @@ if(window.document.documentElement.innerHTML != inner){
}
debug(base64);
window.location = "about:blank";
Envjs.wait();
window.location = base64;
Envjs.wait();
debug(window.document.documentElement.innerHTML);
if(window.document.documentElement.innerHTML != inner){
throw new Error("b"+window.document.documentElement.innerHTML);
}
window.location = "about:blank";
Envjs.wait();
window.location = "data:,"+escape("Hello, World from a data uri!");
Envjs.wait();
debug(window.location+"");
debug(window.document.documentElement.innerHTML);
inner = "<head><title></title></head><body>Hello, World from a data uri!</body>";
Expand Down

0 comments on commit 9198ddb

Please sign in to comment.