Skip to content

Commit

Permalink
Merge pull request #21 from cscott/move-outerHTML
Browse files Browse the repository at this point in the history
Move outerHTML/innerHTML properties from HTMLElement to Element.
  • Loading branch information
fgnass committed Apr 3, 2013
2 parents 9910ba8 + fb4a932 commit 0b3eb5f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
19 changes: 19 additions & 0 deletions lib/Element.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -64,6 +64,25 @@ Element.prototype = Object.create(Node.prototype, {
} }
} }
}, },
innerHTML: {
get: function() {
return this.serialize();
},
set: utils.nyi
},
outerHTML: {
get: function() {
// "the attribute must return the result of running the HTML fragment
// serialization algorithm on a fictional node whose only child is
// the context object"
var fictional = {
childNodes: [ this ],
nodeType: 0
};
return this.serialize.call(fictional);
},
set: utils.nyi
},


children: { get: function() { children: { get: function() {
if (!this._children) { if (!this._children) {
Expand Down
13 changes: 0 additions & 13 deletions lib/htmlelts.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -112,19 +112,6 @@ var HTMLElement = exports.HTMLElement = define({
Element.call(this, doc, localName, NAMESPACE.HTML, prefix); Element.call(this, doc, localName, NAMESPACE.HTML, prefix);
}, },
props: { props: {
outerHTML: {
get: function() {
// "the attribute must return the result of running the HTML fragment
// serialization algorithm on a fictional node whose only child is
// the context object"
var fictional = {
childNodes: [ this ],
nodeType: 0
};
return this.serialize.call(fictional);
},
set: utils.nyi
},
innerHTML: { innerHTML: {
get: function() { get: function() {
return this.serialize(); return this.serialize();
Expand Down

0 comments on commit 0b3eb5f

Please sign in to comment.