Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fela-dom

Package Overview
Dependencies
Maintainers
2
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fela-dom - npm Package Compare versions

Comparing version 10.1.0 to 10.1.1

1

es/dom/connection/createSubscription.js

@@ -18,2 +18,3 @@

renderer.nodes = {};
renderer.scoreIndex = {};
return;

@@ -20,0 +21,0 @@ }

27

es/dom/connection/insertRule.js

@@ -9,4 +9,6 @@ import { generateCSSRule, generateCSSSupportRule, getRuleScore } from 'fela-utils';

support = _ref.support,
media = _ref.media,
pseudo = _ref.pseudo;
var nodeReference = media + support;
// only use insertRule in production as browser devtools might have

@@ -26,10 +28,21 @@ // weird behavior if used together with insertRule at runtime

// TODO: (PERF) instead of checking the score every time
// we could save the latest score=0 index to quickly inject
// basic styles and only check for score!=0 (e.g. pseudo classes)
for (var i = 0, len = cssRules.length; i < len; ++i) {
if (cssRules[i].score > score) {
index = i;
break;
if (score === 0) {
if (renderer.scoreIndex[nodeReference] === undefined) {
renderer.scoreIndex[nodeReference] = 0;
index = 0;
} else {
++renderer.scoreIndex[nodeReference];
index = renderer.scoreIndex[nodeReference];
}
} else {
// we start iterating from the last score=0 entry
// to corretly inject pseudo classes etc.
var startIndex = renderer.scoreIndex[nodeReference] || 0;
for (var i = startIndex, len = cssRules.length; i < len; ++i) {
if (cssRules[i].score > score) {
index = i;
break;
}
}
}

@@ -36,0 +49,0 @@

@@ -48,6 +48,14 @@ import arrayEach from 'fast-loops/lib/arrayEach';

if (node.sheet && node.sheet.cssRules) {
arrayEach(node.sheet.cssRules, function (rule) {
var nodeReference = media + support;
arrayEach(node.sheet.cssRules, function (rule, index) {
var selectorText = rule.conditionText ? rule.cssRules[0].selectorText : rule.selectorText;
rule.score = getRuleScore(renderer.ruleOrder, selectorText.split(CLASSNAME_REGEX)[1]);
var score = getRuleScore(renderer.ruleOrder, selectorText.split(CLASSNAME_REGEX)[1]);
if (score === 0) {
renderer.scoreIndex[nodeReference] = index;
}
rule.score = score;
});

@@ -54,0 +62,0 @@ }

@@ -7,2 +7,3 @@ import objectEach from 'fast-loops/lib/objectEach';

if (!renderer.updateSubscription) {
renderer.scoreIndex = {};
renderer.nodes = {};

@@ -9,0 +10,0 @@

@@ -34,2 +34,3 @@ 'use strict';

renderer.nodes = {};
renderer.scoreIndex = {};
return;

@@ -36,0 +37,0 @@ }

@@ -20,4 +20,6 @@ 'use strict';

support = _ref.support,
media = _ref.media,
pseudo = _ref.pseudo;
var nodeReference = media + support;
// only use insertRule in production as browser devtools might have

@@ -37,10 +39,21 @@ // weird behavior if used together with insertRule at runtime

// TODO: (PERF) instead of checking the score every time
// we could save the latest score=0 index to quickly inject
// basic styles and only check for score!=0 (e.g. pseudo classes)
for (var i = 0, len = cssRules.length; i < len; ++i) {
if (cssRules[i].score > score) {
index = i;
break;
if (score === 0) {
if (renderer.scoreIndex[nodeReference] === undefined) {
renderer.scoreIndex[nodeReference] = 0;
index = 0;
} else {
++renderer.scoreIndex[nodeReference];
index = renderer.scoreIndex[nodeReference];
}
} else {
// we start iterating from the last score=0 entry
// to corretly inject pseudo classes etc.
var startIndex = renderer.scoreIndex[nodeReference] || 0;
for (var i = startIndex, len = cssRules.length; i < len; ++i) {
if (cssRules[i].score > score) {
index = i;
break;
}
}
}

@@ -47,0 +60,0 @@

@@ -70,6 +70,14 @@ 'use strict';

if (node.sheet && node.sheet.cssRules) {
(0, _arrayEach2.default)(node.sheet.cssRules, function (rule) {
var nodeReference = media + support;
(0, _arrayEach2.default)(node.sheet.cssRules, function (rule, index) {
var selectorText = rule.conditionText ? rule.cssRules[0].selectorText : rule.selectorText;
rule.score = (0, _felaUtils.getRuleScore)(renderer.ruleOrder, selectorText.split(CLASSNAME_REGEX)[1]);
var score = (0, _felaUtils.getRuleScore)(renderer.ruleOrder, selectorText.split(CLASSNAME_REGEX)[1]);
if (score === 0) {
renderer.scoreIndex[nodeReference] = index;
}
rule.score = score;
});

@@ -76,0 +84,0 @@ }

@@ -20,2 +20,3 @@ 'use strict';

if (!renderer.updateSubscription) {
renderer.scoreIndex = {};
renderer.nodes = {};

@@ -22,0 +23,0 @@

{
"name": "fela-dom",
"version": "10.1.0",
"version": "10.1.1",
"description": "Fela package for working with the DOM",

@@ -28,10 +28,10 @@ "main": "lib/index.js",

"fast-loops": "^1.0.1",
"fela-utils": "^10.1.0"
"fela-utils": "^10.1.1"
},
"devDependencies": {
"fela": "^10.1.0",
"fela-preset-web": "^10.1.0",
"fela-tools": "^10.1.0"
"fela": "^10.1.1",
"fela-preset-web": "^10.1.1",
"fela-tools": "^10.1.1"
},
"gitHead": "b9117965128f6fe4733ee17de6779af09549e99b"
"gitHead": "06e996dcb7f1b10ffc3ed9667fcfa7a64ebb02c2"
}
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc