Skip to content

Commit

Permalink
whitespace detabbing only. will make next checking nicer
Browse files Browse the repository at this point in the history
  • Loading branch information
client9 committed May 2, 2010
1 parent 7c4ce40 commit b3afa5c
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions specs/parser/spec.js
Expand Up @@ -663,3 +663,34 @@ test('Form Named Elements via DOMAPI', function() {
doc.close();
stop();
});

/**
* If a script in running in <head>, then document.body === null
*
* Due to frame scoping rules, we have indirectly make the test.
* What we are really doing is this:
* <html><head><script>
* ok(document.body === null);
* </script><head><body></body></html>
*/
test('document.body is null in head', function() {
expect(1);
var iframe = document.createElement("iframe");
document.body.appendChild(iframe);

iframe.addEventListener('load', function() {
var doc = iframe.contentDocument;
console.log("doc.bodyinhead = " + document.body);
ok(doc.bodyinhead === null, 'doc.body === null');
document.body.removeChild( iframe );
start();
}, false);

var doc = iframe.contentDocument;
doc.write('<html><head><script type="text/javascript">' +
'document.bodyinhead = document.body;' +
'</script></head><body><div id="container">' +
'</div></body></html>');
doc.close();
stop();
});

0 comments on commit b3afa5c

Please sign in to comment.