diff --git a/README.md b/README.md index cffd40d..bf91384 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ LiteJS DOM – [![Coverage][1]][2] [![Size][3]][4] [![Buy Me A Tea][5]][6] ========== -Dependency-free DOM library for handling HTML and CSS files on server-side. +Dependency-free DOM library for handling HTML, XML and CSS files on server-side. ```javascript diff --git a/dom.js b/dom.js index 5217762..ce5b000 100644 --- a/dom.js +++ b/dom.js @@ -340,16 +340,22 @@ function HTMLElement(tag) { } extendNode(HTMLElement, Element, { + localName: null, + namespaceURI: "http://www.w3.org/1999/xhtml", nodeType: 1, - matches(sel) { - return selector.matches(this, sel) + tagName: null, + blur() { + this.ownerDocument.activeElement = null }, closest(sel) { return selector.closest(this, sel) }, - namespaceURI: "http://www.w3.org/1999/xhtml", - localName: null, - tagName: null, + focus() { + this.ownerDocument.activeElement = this + }, + matches(sel) { + return selector.matches(this, sel) + }, toString(minify) { var attrs = this.attributes.toString(minify) , isXml = this.ownerDocument.contentType === "application/xml" diff --git a/interactive.js b/interactive.js deleted file mode 100644 index b507dc0..0000000 --- a/interactive.js +++ /dev/null @@ -1,18 +0,0 @@ - - -/*! litejs.com/MIT-LICENSE.txt */ - - -var DOM = module.exports = require(".") -, HTMLElementExtra = { - focus() { - this.ownerDocument.activeElement = this - }, - blur() { - this.ownerDocument.activeElement = null - } -} - -Object.assign(DOM.HTMLElement.prototype, HTMLElementExtra) - - diff --git a/test/interactive.js b/test/interactive.js index c8ddfe3..11a9582 100644 --- a/test/interactive.js +++ b/test/interactive.js @@ -2,8 +2,7 @@ describe("Interactive DOM", () => { var undef - , { document } = require("../interactive") - , it = describe.it + , { document } = require("..") it("have focus and blur", assert => { var el = document.createElement("h1")