jsdom
Advanced tools
Comparing version 0.3.2 to 0.3.3
@@ -399,5 +399,21 @@ var core = require("./core").dom.level2.core, | ||
write : function(text) { | ||
if (this.readyState === "loading") { | ||
if (this._writeAfterElement) { | ||
// If called from an script element directly (during the first tick), | ||
// the new elements are inserted right after that element. | ||
var tempDiv = this.createElement('div'); | ||
tempDiv.innerHTML = text; | ||
var child = tempDiv.firstChild; | ||
var previous = this._writeAfterElement; | ||
var parent = this._writeAfterElement.parentNode; | ||
while (child) { | ||
var node = child; | ||
child = child.nextSibling; | ||
parent.insertBefore(node, previous.nextSibling); | ||
previous = node; | ||
} | ||
} else if (this.readyState === "loading") { | ||
// During page loading, document.write appends to the current element | ||
// Find the last child that has been added to the document. | ||
// Find the last child that has ben added to the document. | ||
var node = this; | ||
@@ -831,2 +847,7 @@ while (node.lastChild && node.lastChild.nodeType === this.ELEMENT_NODE) { | ||
tagName: 'INPUT', | ||
init: function() { | ||
if (!this.hasAttribute('type')) { | ||
this.setAttribute('type', 'text'); | ||
} | ||
}, | ||
proto: { | ||
@@ -1309,3 +1330,5 @@ _initDefaultValue: function() { | ||
{ | ||
this._ownerDocument._writeAfterElement = this; | ||
core.languageProcessors[this.language](this, text, filename); | ||
delete this._ownerDocument._writeAfterElement; | ||
} | ||
@@ -1312,0 +1335,0 @@ }, |
@@ -243,3 +243,9 @@ var core = require("./core").dom.level2.core, | ||
} | ||
evaluateStylesheet.call(this, this.textContent, this.sheet, this._ownerDocument.URL); | ||
var content = ''; | ||
Array.prototype.forEach.call(this.childNodes, function (child) { | ||
if (child.nodeType === child.TEXT_NODE) { // text node | ||
content += child.nodeValue; | ||
} | ||
}); | ||
evaluateStylesheet.call(this, content, this.sheet, this._ownerDocument.URL); | ||
}); | ||
@@ -246,0 +252,0 @@ }; |
{ | ||
"name": "jsdom", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"description": "A JavaScript implementation of the W3C DOM", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -278,4 +278,4 @@ # jsdom | ||
level2/core 283/283 100% | ||
level2/html 695/695 100% | ||
level2/style 8/8 100% | ||
level2/html 697/697 100% | ||
level2/style 10/10 100% | ||
level2/extra 4/4 100% | ||
@@ -287,4 +287,4 @@ level2/events 24/24 100% | ||
window/frame 14/14 100% | ||
sizzle/index 8/14 57% | ||
jsdom/index 85/85 100% | ||
sizzle/index 9/14 64% | ||
jsdom/index 86/86 100% | ||
jsonp/jsonp 1/1 100% | ||
@@ -294,3 +294,3 @@ browser/contextifyReplacement 4/4 100% | ||
------------------------------------------------------ | ||
TOTALS: 6/2559 failed; 99% success | ||
TOTALS: 5/2564 failed; 99% success | ||
``` | ||
@@ -297,0 +297,0 @@ |
343633
26
9988