Socket
Socket
Sign inDemoInstall

jsdom

Package Overview
Dependencies
68
Maintainers
2
Versions
259
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.3.3 to 0.3.4

test.css

33

lib/jsdom/browser/index.js

@@ -247,17 +247,26 @@ var http = require('http'),

cs = new CSSStyleDeclaration(),
forEach = Array.prototype.forEach,
selectors, matched;
forEach = Array.prototype.forEach;
function setPropertiesFromRule(rule) {
var selectors = rule.selectorText.split(/\s*,\s*/);
var matched = false;
selectors.forEach(function (selectorText) {
if (!matched && matchesDontThrow(node, selectorText)) {
matched = true;
forEach.call(rule.style, function (property) {
cs.setProperty(property, rule.style.getPropertyValue(property), rule.style.getPropertyPriority(property));
});
}
});
}
forEach.call(node.ownerDocument.styleSheets, function (sheet) {
forEach.call(sheet.cssRules, function (ruleSet) {
selectors = ruleSet.selectorText.split(/\s*,\s*/);
matched = false;
selectors.forEach(function (selectorText) {
if (!matched && matchesDontThrow(node, selectorText)) {
matched = true;
forEach.call(ruleSet.style, function (property) {
cs.setProperty(property, ruleSet.style.getPropertyValue(property), ruleSet.style.getPropertyPriority(property));
});
forEach.call(sheet.cssRules, function (rule) {
if (rule.media) {
if (Array.prototype.indexOf.call(rule.media, 'screen') !== -1) {
forEach.call(rule.cssRules, setPropertiesFromRule);
}
});
} else {
setPropertiesFromRule(rule);
}
});

@@ -264,0 +273,0 @@ });

{
"name": "jsdom",
"version": "0.3.3",
"version": "0.3.4",
"description": "A JavaScript implementation of the W3C DOM",

@@ -5,0 +5,0 @@ "keywords": [

"use strict";
var assert = require("assert");
var jsdom = require("./lib/jsdom").jsdom;
//var document = jsdom('<html><head></head><body><select><option value="">Nothing</option><option value="1">1</option><option value="2">2</option><option value="3">3</option></select><img src="3" /></body></html>');
var document = jsdom('<html><head></head><body><div><p>stuff</p></div></body></html>');
var window = document.createWindow();
var jsdom = require("./lib/jsdom");
var cssom = require("cssom");
console.log(document.querySelector("div\tp"));
console.log(cssom.parse(require("fs").readFileSync('test.css', 'utf-8')));
jsdom.env({
html: '<html><head><style>' + require("fs").readFileSync('test.css') + '</style></head><body></body></html>',
config: {
ProcessExternalResources: ["script", "link"]
},
done: function (errors, window) {
window.getComputedStyle(window.document.body);
}
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc