Socket
Socket
Sign inDemoInstall

juice

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

juice - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

6

lib/juice.js

@@ -19,2 +19,8 @@

/**
* Package version
*/
exports.version = '0.0.2';
/**
* Export Selector.

@@ -21,0 +27,0 @@ */

42

lib/selector.js

@@ -36,25 +36,39 @@

this.parsed = parse(this.text).expressions[0];
this.spec = [0, 0, 0, 0];
var parsed = parse(this.text)
, expressions = parsed.expressions[0]
, spec = [0, 0, 0, 0]
, nots = []
for (var i = 0, l = this.parsed.length; i < l; i++) {
var token = this.parsed[i];
for (var i = 0; i < expressions.length; i++) {
var expression = expressions[i], pseudos = expression.pseudos;
// id awards a point in the second column
if (undefined != token.id) this.spec[1]++;
if (expression.id) spec[1]++;
// classes award a point each in the third column
if (token.classes) this.spec[2] += token.classes.length;
// classes and attributes award a point each in the third column
if (expression.attributes) spec[2] += expression.attributes.length;
if (expression.classes) spec[2] += expression.classes.length;
// attributes award a point each in the third column
if (token.attributes) this.spec[2] += token.attributes.length;
// tag awards a point in the fourth column
if (expression.tag && expression.tag != '*') spec[3]++;
// pseudos award a point each in the third column
if (token.pseudos) this.spec[2] += token.pseudos.length;
// pseudos award a point each in the fourth column
if (pseudos) {
spec[3] += pseudos.length;
// tag awards a point in the fourth column
if ('*' != token.tag) this.spec[3]++;
for (var p = 0; p < pseudos.length; p++) {
if (pseudos[p].key == 'not'){
nots.push(pseudos[p].value);
spec[3]--;
}
}
}
}
return this.spec;
for (var ii = nots.length; ii--;) {
var not = specificity(nots[ii]);
for (var jj = 4; jj--;) spec[jj] += not[jj];
}
return this.spec = spec;
}
{
"name": "juice"
, "version": "0.0.1"
, "version": "0.0.2"
, "description": "Inlines css into html source"

@@ -5,0 +5,0 @@ , "devDependencies": {

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