Comparing version 0.5.6 to 0.5.7
@@ -590,21 +590,29 @@ /* | ||
// set using element.on* in a script. | ||
// | ||
// @see http://www.w3.org/TR/2011/WD-html5-20110405/webappapis.html#event-handler-content-attributes | ||
if ((name.length > 2) && (name[0] == 'o') && (name[1] == 'n')) { | ||
if (value) { | ||
var self = this; | ||
self[name] = function () { | ||
// Check whether we're the window. This can happen because inline | ||
// handlers on the body are proxied to the window. | ||
var w = (typeof self.run !== 'undefined') ? self : self._ownerDocument.parentWindow; | ||
self[name] = function (event) { | ||
// The handler code probably refers to functions declared in the | ||
// window context, so we need to call run(). | ||
if (self.run != undefined) { | ||
// We're the window. This can happen because inline handlers | ||
// on the body are proxied to the window. | ||
self.run(value); | ||
} else { | ||
// We're an element. Use awesome hacks to get the correct `this` context for the inline event handler. | ||
self._ownerDocument.parentWindow.__tempContextForInlineEventHandler = self; | ||
self._ownerDocument.parentWindow.run("(function () {" + value + "}).call(window.__tempContextForInlineEventHandler);"); | ||
delete self.ownerDocument.parentWindow.__tempContextForInlineEventHandler; | ||
} | ||
// Use awesome hacks to get the correct `this` context for the | ||
// inline event handler. This would only be necessary if we're an | ||
// element, but for the sake of simplicity we also do it on window. | ||
// Also set event variable and support `return false`. | ||
w.__tempContextForInlineEventHandler = self; | ||
w.__tempEvent = event; | ||
w.run("if ((function (event) {" + value + "}).call(" + | ||
"window.__tempContextForInlineEventHandler, window.__tempEvent) === false) {" + | ||
"window.__tempEvent.preventDefault()}"); | ||
delete w.__tempContextForInlineEventHandler; | ||
delete w.__tempEvent; | ||
}; | ||
} else { | ||
delete this[name]; | ||
this[name] = null; | ||
} | ||
@@ -611,0 +619,0 @@ } |
@@ -1166,2 +1166,9 @@ var core = require("./core").dom.level2.core, | ||
define('HTMLCanvasElement', { | ||
tagName: 'CANVAS', | ||
attributes: [ | ||
'align' | ||
] | ||
}); | ||
define('HTMLDivElement', { | ||
@@ -1168,0 +1175,0 @@ tagName: 'DIV', |
@@ -151,13 +151,27 @@ var core = require("../level2/core").dom.level2.core, | ||
// @see http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#Node3-textContent | ||
core.Node.prototype.__defineGetter__('textContent', function() { | ||
if (this.nodeType === this.TEXT_NODE || this.nodeType === this.COMMENT_NODE || this.nodeType === this.ATTRIBUTE_NODE || this.nodeType === this.CDATA_SECTION_NODE) { | ||
return this.nodeValue; | ||
} else if (this.nodeType === this.ELEMENT_NODE || this.nodeType === this.DOCUMENT_FRAGMENT_NODE) { | ||
var out = ''; | ||
for (var i = 0 ; i < this.childNodes.length ; i += 1) { | ||
out += this.childNodes[i].textContent || ''; | ||
} | ||
return out; | ||
} else { | ||
return null; | ||
switch (this.nodeType) { | ||
case this.COMMENT_NODE: | ||
case this.CDATA_SECTION_NODE: | ||
case this.PROCESSING_INSTRUCTION_NODE: | ||
case this.TEXT_NODE: | ||
return this.nodeValue; | ||
case this.ATTRIBUTE_NODE: | ||
case this.DOCUMENT_FRAGMENT_NODE: | ||
case this.ELEMENT_NODE: | ||
case this.ENTITY_NODE: | ||
case this.ENTITY_REFERENCE_NODE: | ||
var out = ''; | ||
for (var i = 0 ; i < this.childNodes.length ; ++i) { | ||
if (this.childNodes[i].nodeType !== this.COMMENT_NODE && | ||
this.childNodes[i].nodeType !== this.PROCESSING_INSTRUCTION_NODE) { | ||
out += this.childNodes[i].textContent || ''; | ||
} | ||
} | ||
return out; | ||
default: | ||
return null; | ||
} | ||
@@ -164,0 +178,0 @@ }); |
{ | ||
"name": "jsdom", | ||
"version": "0.5.6", | ||
"version": "0.5.7", | ||
"description": "A JavaScript implementation of the W3C DOM", | ||
@@ -5,0 +5,0 @@ "keywords": ["dom", "w3c", "html"], |
@@ -282,3 +282,3 @@ # jsdom | ||
level2/html 705/705 100% | ||
level2/style 13/13 100% | ||
level2/style 14/14 100% | ||
level2/extra 4/4 100% | ||
@@ -296,3 +296,3 @@ level2/events 24/24 100% | ||
------------------------------------------------------ | ||
TOTALS: 0/2592 failed; 100% success | ||
TOTALS: 0/2593 failed; 100% success | ||
``` | ||
@@ -299,0 +299,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
347997
10119