Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
Override document.write too
Browse files Browse the repository at this point in the history
  • Loading branch information
arv committed Apr 26, 2013
1 parent 07be1f3 commit 733b350
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/wrappers/Document.js
Expand Up @@ -109,6 +109,7 @@
'createTextNode',
'elementFromPoint',
'getElementById',
'write',
]);

mixin(Document.prototype, GetElementsByInterface);
Expand Down
7 changes: 5 additions & 2 deletions test/document-write.html
Expand Up @@ -4,11 +4,14 @@
<script src="../shadowdom.js"></script>
<a></a><script>
var assert = chai.assert;
var wrap = ShadowDOMPolyfill.wrap;

var a = document.querySelector('a');
document.write('<b></b>');
document.write('<script><' + '/script>');
wrap(document).write('<b></b>');
assert.equal(a.nextSibling.localName, 'script');
assert.equal(a.nextSibling.nextSibling.localName, 'b');
assert.equal(a.nextSibling.nextSibling.localName, 'script');
assert.equal(a.nextSibling.nextSibling.nextSibling.localName, 'b');

var all = document.querySelectorAll('*');
var last = all[all.length - 1];
Expand Down

0 comments on commit 733b350

Please sign in to comment.