Comparing version 0.5.1 to 0.5.2
@@ -320,3 +320,4 @@ var dom = exports.dom = require("./jsdom/level3/index").dom, | ||
'url' : false, // the URL for location.href if different from html | ||
'document': false // HTMLDocument properties | ||
'document': false, // HTMLDocument properties | ||
'features': false // allow for features to be specified | ||
}, | ||
@@ -323,0 +324,0 @@ propKeys = Object.keys(props), |
@@ -250,2 +250,6 @@ var http = require('http'), | ||
function setPropertiesFromRule(rule) { | ||
if (!rule.selectorText) { | ||
return; | ||
} | ||
var selectors = rule.selectorText.split(/\s*,\s*/); | ||
@@ -252,0 +256,0 @@ var matched = false; |
@@ -145,19 +145,2 @@ var core = require("./core").dom.level2.core, | ||
// currently, cssom's parse doesn't really work if you pass in | ||
// {state: 'name'}, so instead we just build a dummy sheet. | ||
var styleSheet = cssom.parse('dummy{' + data + '}'); | ||
var style = this.style; | ||
while (style.length) { | ||
style.removeProperty(style[0]); | ||
} | ||
if (styleSheet.cssRules.length > 0 && styleSheet.cssRules[0].style) { | ||
var newStyle = styleSheet.cssRules[0].style; | ||
for (var i = 0; i < newStyle.length; ++i) { | ||
var prop = newStyle[i]; | ||
style.setProperty( | ||
prop, | ||
newStyle.getPropertyValue(prop), | ||
newStyle.getPropertyPriority(prop)); | ||
} | ||
} | ||
} | ||
@@ -171,10 +154,16 @@ | ||
core.Attr.call(this, node.ownerDocument, 'style'); | ||
this.nodeValue = value; | ||
if (!this._node._ignoreValueOfStyleAttr) { | ||
this.nodeValue = value; | ||
} | ||
} | ||
StyleAttr.prototype = { | ||
get nodeValue() { | ||
return this._node.style.cssText; | ||
if (typeof this._node._style === 'string') { | ||
return this._node._style; | ||
} else { | ||
return this._node.style.cssText; | ||
} | ||
}, | ||
set nodeValue(value) { | ||
evaluateStyleAttribute.call(this._node, value); | ||
this._node._style = value; | ||
} | ||
@@ -199,10 +188,29 @@ }; | ||
html.HTMLElement.prototype.__defineGetter__('style', function() { | ||
var style = this._cssStyleDeclaration; | ||
if (!style) { | ||
style = this._cssStyleDeclaration = new cssstyle.CSSStyleDeclaration(); | ||
if (!this.getAttributeNode('style')) { | ||
this.setAttribute('style', ''); | ||
if (typeof this._style === 'string') { | ||
// currently, cssom's parse doesn't really work if you pass in | ||
// {state: 'name'}, so instead we just build a dummy sheet. | ||
var styleSheet = cssom.parse('dummy{' + this._style + '}'); | ||
this._style = new cssstyle.CSSStyleDeclaration(); | ||
if (styleSheet.cssRules.length > 0 && styleSheet.cssRules[0].style) { | ||
var newStyle = styleSheet.cssRules[0].style; | ||
for (var i = 0; i < newStyle.length; ++i) { | ||
var prop = newStyle[i]; | ||
this._style.setProperty( | ||
prop, | ||
newStyle.getPropertyValue(prop), | ||
newStyle.getPropertyPriority(prop)); | ||
} | ||
} | ||
} | ||
return style; | ||
if (!this._style) { | ||
this._style = new cssstyle.CSSStyleDeclaration(); | ||
} | ||
if (!this.getAttributeNode('style')) { | ||
// Tell the StyleAttr constructor to not overwrite this._style | ||
this._ignoreValueOfStyleAttr = true; | ||
this.setAttribute('style'); | ||
this._ignoreValueOfStyleAttr = false; | ||
} | ||
return this._style; | ||
}); | ||
@@ -209,0 +217,0 @@ |
{ | ||
"name": "jsdom", | ||
"version": "0.5.1", | ||
"version": "0.5.2", | ||
"description": "A JavaScript implementation of the W3C DOM", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -281,3 +281,3 @@ # jsdom | ||
level2/html 700/700 100% | ||
level2/style 11/11 100% | ||
level2/style 13/13 100% | ||
level2/extra 4/4 100% | ||
@@ -290,3 +290,3 @@ level2/events 24/24 100% | ||
sizzle/index 14/14 100% | ||
jsdom/index 86/86 100% | ||
jsdom/index 87/87 100% | ||
jsonp/jsonp 1/1 100% | ||
@@ -296,3 +296,3 @@ browser/contextifyReplacement 4/4 100% | ||
------------------------------------------------------ | ||
TOTALS: 0/2580 failed; 100% success | ||
TOTALS: 0/2583 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
347708
10056