Skip to content

Commit

Permalink
Make outerHTML writable
Browse files Browse the repository at this point in the history
  • Loading branch information
lauriro committed Jul 23, 2015
1 parent acf367f commit 7c9a113
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 6 additions & 0 deletions index.js
Expand Up @@ -161,6 +161,12 @@ Node.prototype = {
get outerHTML() {
return this.toString()
},
set outerHTML(html) {
var frag = this.ownerDocument.createDocumentFragment()
frag.innerHTML = html
this.parentNode.replaceChild(frag, this)
return html
},
get htmlFor() {
return this["for"]
},
Expand Down
3 changes: 1 addition & 2 deletions tests/samp1.js
Expand Up @@ -8,8 +8,7 @@ var DOM = require("../")


test("replace document", function (assert) {
document.documentElement.innerHTML = src
document.childNodes = [document.documentElement = document.documentElement.firstChild]
document.documentElement.outerHTML = src

assert.equal("" + document, src)

Expand Down

0 comments on commit 7c9a113

Please sign in to comment.