Comparing version 0.8.1 to 0.8.2
@@ -57,7 +57,14 @@ var HTMLDecode = require('./htmlencoding').HTMLDecode; | ||
} else if (parser.DefaultHandler){ | ||
// tautologistics/node-htmlparser | ||
// fb55/htmlparser2 | ||
var handler = new parser.DefaultHandler(), | ||
parserInstance = new parser.Parser(handler, { lowerCaseTags: true, lowerCaseAttributeNames: true }); | ||
parser.ParseHtml = function(rawHtml){ | ||
parser.ParseHtml = function(rawHtml) { | ||
var handler = new parser.DefaultHandler(); | ||
// Check if document is XML | ||
var isXML = (/^<\?\s*xml.*version=["']1\.0["'].*\s*\?>/i).test(rawHtml); | ||
var parserInstance = new parser.Parser(handler, { | ||
xmlMode: isXML, | ||
lowerCaseTags: !isXML, | ||
lowerCaseAttributeNames: !isXML | ||
}); | ||
parserInstance.includeLocation = false; | ||
@@ -166,3 +173,3 @@ parserInstance.parseComplete(rawHtml); | ||
try { | ||
newNode.setAttribute(c.toLowerCase(), HTMLDecode(node.attribs[c])); | ||
newNode.setAttribute(c, HTMLDecode(node.attribs[c])); | ||
} catch(e2) { /* noop */ } | ||
@@ -169,0 +176,0 @@ } |
@@ -10,2 +10,3 @@ var http = require('http'), | ||
Location = require('./location'), | ||
History = require('./history'), | ||
NOT_IMPLEMENTED = require('./utils').NOT_IMPLEMENTED, | ||
@@ -100,2 +101,3 @@ CSSStyleDeclaration = require('cssstyle').CSSStyleDeclaration, | ||
this.location = new Location(url, this); | ||
this.history = new History(this); | ||
@@ -102,0 +104,0 @@ this.console._window = this; |
@@ -1222,12 +1222,8 @@ /* | ||
get readonly() { return this._readonly;}, | ||
/* returns Element */ | ||
createElement: function(/* string */ tagName) { | ||
var c = [], lower = tagName.toLowerCase(), element; | ||
_createElementNoTagNameValidation: function(/*string*/ tagName) { | ||
var lower = tagName.toLowerCase(); | ||
var element = (this._elementBuilders[lower] || this._defaultElementBuilder)(this, tagName); | ||
if (!tagName || !tagName.match || (c = tagName.match(tagRegEx))) { | ||
throw new core.DOMException(INVALID_CHARACTER_ERR, 'Invalid character in tag name: ' + c.pop()); | ||
} | ||
element = (this._elementBuilders[lower] || this._defaultElementBuilder)(this, tagName); | ||
// Check for and introduce default elements | ||
@@ -1254,2 +1250,15 @@ if (this._doctype && this._doctype._attributes && this._doctype.name.toLowerCase() !== "html") { | ||
return element; | ||
}, | ||
/* returns Element */ | ||
createElement: function(/* string */ tagName) { | ||
tagName = String(tagName); | ||
var c = []; | ||
if (tagName.length === 0 || (c = tagName.match(tagRegEx))) { | ||
throw new core.DOMException(INVALID_CHARACTER_ERR, 'Invalid character in tag name: ' + c.pop()); | ||
} | ||
return this._createElementNoTagNameValidation(tagName); | ||
}, //raises: function(DOMException) {}, | ||
@@ -1256,0 +1265,0 @@ |
{ | ||
"name": "jsdom", | ||
"version": "0.8.1", | ||
"version": "0.8.2", | ||
"description": "A JavaScript implementation of the W3C DOM", | ||
@@ -5,0 +5,0 @@ "keywords": ["dom", "w3c", "html"], |
@@ -143,3 +143,3 @@ # jsdom | ||
var doc = jsdom(markup, level, options); | ||
var window = doc.createWindow(); | ||
var window = doc.parentWindow; | ||
``` | ||
@@ -231,3 +231,3 @@ | ||
var document = jsdom("<html><head></head><body>hello world</body></html>"); | ||
var window = document.createWindow(); | ||
var window = document.parentWindow; | ||
@@ -248,3 +248,3 @@ console.log(window.document.innerHTML); | ||
var jsdom = require("jsdom"); | ||
var window = jsdom.jsdom().createWindow(); | ||
var window = jsdom.jsdom().parentWindow; | ||
@@ -262,3 +262,3 @@ jsdom.jQueryify(window, "http://code.jquery.com/jquery.js", function () { | ||
var jsdom = require("jsdom").jsdom; | ||
var window = jsdom().createWindow(); | ||
var window = jsdom().parentWindow; | ||
@@ -288,2 +288,3 @@ window.__myObject = { foo: "bar" }; | ||
window/index 7/7 100% | ||
window/history 5/5 100% | ||
window/script 10/10 100% | ||
@@ -294,3 +295,3 @@ window/console 2/2 100% | ||
jsdom/index 76/76 100% | ||
jsdom/parsing 10/10 100% | ||
jsdom/parsing 11/11 100% | ||
jsdom/env 25/25 100% | ||
@@ -300,3 +301,3 @@ jsonp/jsonp 1/1 100% | ||
--------------------------------------- | ||
TOTALS: 0/2620 failed; 100% success | ||
TOTALS: 0/2626 failed; 100% success | ||
``` | ||
@@ -303,0 +304,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
354342
27
10292
336