Comparing version 0.2.6 to 0.2.7
@@ -1,3 +0,7 @@ | ||
var core = Object.create(require("../level1/core").dom.level1.core), | ||
INVALID_STATE_ERR = core.INVALID_STATE_ERR = 11, | ||
var core = require("../level1/core").dom.level1.core; | ||
// modify cloned instance for more info check: https://github.com/tmpvar/jsdom/issues/325 | ||
core = Object.create(core); | ||
var INVALID_STATE_ERR = core.INVALID_STATE_ERR = 11, | ||
SYNTAX_ERR = core.SYNTAX_ERR = 12, | ||
@@ -4,0 +8,0 @@ INVALID_MODIFICATION_ERR = core.INVALID_MODIFICATION_ERR = 13, |
@@ -6,6 +6,9 @@ /* DOM Level2 Events implemented as described here: | ||
*/ | ||
var core = Object.create(require("./core").dom.level2.core), | ||
var core = require("./core").dom.level2.core, | ||
utils = require("../utils"), | ||
sys = require("sys"); | ||
// modify cloned instance for more info check: https://github.com/tmpvar/jsdom/issues/325 | ||
core = Object.create(core); | ||
var events = {}; | ||
@@ -12,0 +15,0 @@ |
@@ -1,2 +0,2 @@ | ||
var core = Object.create(require("./core").dom.level2.core), | ||
var core = require("./core").dom.level2.core, | ||
events = require("./core").dom.level2.events, | ||
@@ -10,2 +10,5 @@ applyDocumentFeatures = require('../browser/documentfeatures').applyDocumentFeatures, | ||
// modify cloned instance for more info check: https://github.com/tmpvar/jsdom/issues/325 | ||
core = Object.create(core); | ||
// Setup the javascript language processor | ||
@@ -12,0 +15,0 @@ core.languageProcessors = { |
@@ -7,2 +7,5 @@ var core = require("./core").dom.level2.core, | ||
// modify cloned instance for more info check: https://github.com/tmpvar/jsdom/issues/325 | ||
core = Object.create(core); | ||
// What works now: | ||
@@ -81,3 +84,3 @@ // - Accessing the rules defined in individual stylesheets | ||
function fetchStylesheet(url, sheet) { | ||
core.resourceLoader.load(this, url, function(data, filename) { | ||
html.resourceLoader.load(this, url, function(data, filename) { | ||
// TODO: abort if the content-type is not text/css, and the document is | ||
@@ -84,0 +87,0 @@ // in strict mode |
@@ -1,2 +0,2 @@ | ||
var core = Object.create(require("../level2/core").dom.level2.core), | ||
var core = require("../level2/core").dom.level2.core, | ||
HtmlToDom = require('../browser/htmltodom').HtmlToDom, | ||
@@ -8,2 +8,5 @@ domToHtml = require('../browser/domtohtml').domToHtml, | ||
// modify cloned instance for more info check: https://github.com/tmpvar/jsdom/issues/325 | ||
core = Object.create(core); | ||
/* | ||
@@ -10,0 +13,0 @@ valuetype DOMString sequence<unsigned short>; |
@@ -1,3 +0,6 @@ | ||
var events = Object.create(require("../level2/events").dom.level2.events); | ||
var events = require("../level2/events").dom.level2.events; | ||
// modify cloned instance for more info check: https://github.com/tmpvar/jsdom/issues/325 | ||
events = Object.create(events); | ||
/* | ||
@@ -4,0 +7,0 @@ |
@@ -1,3 +0,3 @@ | ||
var core = Object.create(require("./core").dom.level3.core), | ||
html = Object.create(require("../level2/html").dom.level2.html) | ||
var core = require("./core").dom.level3.core, | ||
html = require("../level2/html").dom.level2.html | ||
@@ -4,0 +4,0 @@ exports.dom = { |
{ | ||
"name": "jsdom", | ||
"version": "0.2.6", | ||
"version": "0.2.7", | ||
"description": "A javascript implementation of the W3C DOM", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -961,3 +961,3 @@ var path = require("path"); | ||
a.style.width = '100%'; | ||
// Test fails so disable test.ok(!!a.getAttribute('style').match(/^\s*width\s*:\s*100%\s*;?\s*$/), 'style attribute must contain width'); | ||
test.ok(!!a.getAttribute('style').match(/^\s*width\s*:\s*100%\s*;?\s*$/), 'style attribute must contain width'); | ||
test.done(); | ||
@@ -964,0 +964,0 @@ }, |
@@ -1,65 +0,85 @@ | ||
jsdom = require('../../lib/jsdom'); | ||
assert = require('assert') | ||
var jsdom = require('../../lib/jsdom'); | ||
var assert = require('assert'); | ||
var http = require('http'); | ||
var fs = require('fs'); | ||
exports.tests = { | ||
HTMLStyleElement01 : function (test) { | ||
jsdom.env( | ||
'<html><head><style>p{color:red}</style></head><body>', | ||
jsdom.defaultLevel, function(err, win) { | ||
var style = win.document.head.lastChild; | ||
test.equal(1, style.sheet.cssRules.length); | ||
test.equal('p', style.sheet.cssRules[0].selectorText); | ||
test.equal('red', style.sheet.cssRules[0].style.color); | ||
test.done(); | ||
}); | ||
}, | ||
HTMLStyleElement01 : function (test) { | ||
jsdom.env( | ||
'<html><head><style>p{color:red}</style></head><body>', | ||
jsdom.defaultLevel, function(err, win) { | ||
var style = win.document.head.lastChild; | ||
test.equal(1, style.sheet.cssRules.length); | ||
test.equal('p', style.sheet.cssRules[0].selectorText); | ||
test.equal('red', style.sheet.cssRules[0].style.color); | ||
test.done(); | ||
}); | ||
}, | ||
HTMLStyleAttribute01 : function (test) { | ||
jsdom.env( | ||
'<html><body><p style="color:red">', | ||
jsdom.defaultLevel, function(err, win) { | ||
var p = win.document.body.lastChild; | ||
test.equal(1, p.style.length); | ||
test.equal('color', p.style[0]); | ||
test.equal('red', p.style.color); | ||
test.done(); | ||
}); | ||
}, | ||
HTMLStyleAttribute01 : function (test) { | ||
jsdom.env( | ||
'<html><body><p style="color:red">', | ||
jsdom.defaultLevel, function(err, win) { | ||
var p = win.document.body.lastChild; | ||
test.equal(1, p.style.length); | ||
test.equal('color', p.style[0]); | ||
test.equal('red', p.style.color); | ||
test.done(); | ||
}); | ||
}, | ||
StylePropertyReflectsStyleAttribute : function (test) { | ||
jsdom.env( | ||
'<html>', | ||
jsdom.defaultLevel, function(err, win) { | ||
var p = win.document.createElement('p'); | ||
p.setAttribute('style', 'color:red'); | ||
test.equal(1, p.style.length); | ||
test.equal('color', p.style[0]); | ||
test.equal('red', p.style.color); | ||
p.setAttribute('style', ''); | ||
test.equal(0, p.style.length); | ||
test.equal('', p.style.color); | ||
p.setAttribute('style', 'color:blue'); | ||
test.equal('color', p.style[0]); | ||
test.equal('blue', p.style.color); | ||
test.done(); | ||
}); | ||
}, | ||
StylePropertyReflectsStyleAttribute : function (test) { | ||
jsdom.env( | ||
'<html>', | ||
jsdom.defaultLevel, function(err, win) { | ||
var p = win.document.createElement('p'); | ||
p.setAttribute('style', 'color:red'); | ||
test.equal(1, p.style.length); | ||
test.equal('color', p.style[0]); | ||
test.equal('red', p.style.color); | ||
p.setAttribute('style', ''); | ||
test.equal(0, p.style.length); | ||
test.equal('', p.style.color); | ||
p.setAttribute('style', 'color:blue'); | ||
test.equal('color', p.style[0]); | ||
test.equal('blue', p.style.color); | ||
test.done(); | ||
}); | ||
}, | ||
StyleAttributeReflectsStyleProperty : function (test) { | ||
jsdom.env( | ||
'<html>', | ||
jsdom.defaultLevel, function(err, win) { | ||
var p = win.document.createElement('p'); | ||
p.style.setProperty('color', 'red'); | ||
test.equal(p.getAttribute('style'), 'color: red;'); | ||
p.style.setProperty('width', '20px'); | ||
test.equal(p.getAttribute('style'), 'color: red; width: 20px;'); | ||
p.style.removeProperty('color'); | ||
test.equal(p.getAttribute('style'), 'width: 20px;'); | ||
p.style.removeProperty('width'); | ||
test.equal(p.getAttribute('style'), ''); | ||
test.done(); | ||
}); | ||
}, | ||
StyleAttributeReflectsStyleProperty : function (test) { | ||
jsdom.env( | ||
'<html>', | ||
jsdom.defaultLevel, function(err, win) { | ||
var p = win.document.createElement('p'); | ||
p.style.setProperty('color', 'red'); | ||
test.equal(p.getAttribute('style'), 'color: red;'); | ||
p.style.setProperty('width', '20px'); | ||
test.equal(p.getAttribute('style'), 'color: red; width: 20px;'); | ||
p.style.removeProperty('color'); | ||
test.equal(p.getAttribute('style'), 'width: 20px;'); | ||
p.style.removeProperty('width'); | ||
test.equal(p.getAttribute('style'), ''); | ||
test.done(); | ||
}); | ||
}, | ||
ensure_external_stylesheets_are_loadable : function(test) { | ||
var css = "body { border: 1px solid #f0f; }"; | ||
var server = http.createServer(function(req, res) { | ||
req.writeHead(200, { | ||
'Content-type' : 'text/css', | ||
'Content-length' : css.length | ||
}); | ||
req.end(css); | ||
}); | ||
server.listen(10099); | ||
jsdom.env(__dirname + '/style/external_css.html', function(e, w) { | ||
test.equal(w.document.errors, null); | ||
server.close(); | ||
test.done(); | ||
}); | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
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
33821810
308
143876
15
7