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

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.2 to 0.0.3

History.md

2

lib/juice.js

@@ -22,3 +22,3 @@

exports.version = '0.0.2';
exports.version = '0.0.3';

@@ -25,0 +25,0 @@ /**

@@ -34,41 +34,45 @@

Selector.prototype.specificity = function () {
if (this.spec) return this.spec;
if (!this.spec) return specificity(this.text);
return this.spec;
var parsed = parse(this.text)
, expressions = parsed.expressions[0]
, spec = [0, 0, 0, 0]
, nots = []
function specificity (text) {
var parsed = parse(text)
, expressions = parsed.expressions[0]
, spec = [0, 0, 0, 0]
, nots = []
for (var i = 0; i < expressions.length; i++) {
var expression = expressions[i], pseudos = expression.pseudos;
for (var i = 0; i < expressions.length; i++) {
var expression = expressions[i]
, pseudos = expression.pseudos
// id awards a point in the second column
if (expression.id) spec[1]++;
// id awards a point in the second column
if (expression.id) spec[1]++;
// 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;
// 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;
// tag awards a point in the fourth column
if (expression.tag && expression.tag != '*') spec[3]++;
// tag awards a point in the fourth column
if (expression.tag && expression.tag != '*') spec[3]++;
// pseudos award a point each in the fourth column
if (pseudos) {
spec[3] += pseudos.length;
// pseudos award a point each in the fourth column
if (pseudos) {
spec[3] += pseudos.length;
for (var p = 0; p < pseudos.length; p++) {
if (pseudos[p].key == 'not'){
nots.push(pseudos[p].value);
spec[3]--;
for (var p = 0; p < pseudos.length; p++) {
if (pseudos[p].key == 'not'){
nots.push(pseudos[p].value);
spec[3]--;
}
}
}
}
}
for (var ii = nots.length; ii--;) {
var not = specificity(nots[ii]);
for (var jj = 4; jj--;) spec[jj] += not[jj];
for (var ii = nots.length; ii--;) {
var not = specificity(nots[ii]);
for (var jj = 4; jj--;) spec[jj] += not[jj];
}
return spec;
}
return this.spec = spec;
}
{
"name": "juice"
, "version": "0.0.2"
, "version": "0.0.3"
, "description": "Inlines css into html source"
, "contributors": [
{ "name": "Guillermo Rauch", "email": "guillermo@learnboost.com" }
, { "name": "Arian Stolwijk", "email": "arian@aryweb.nl" }
]
, "devDependencies": {

@@ -6,0 +10,0 @@ "should": "0.3.1"

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