+15
| 0.0.3 / 2011-10-09 | ||
| ================== | ||
| * Fixed specificity :not recursion. | ||
| 0.0.2 / 2011-10-09 | ||
| ================== | ||
| * Fixed specificity calculation for `not()` and pseudos. [arian] | ||
| 0.0.1 / 2011-10-09 | ||
| ================== | ||
| * Initial release. |
+1
-1
@@ -22,3 +22,3 @@ | ||
| exports.version = '0.0.2'; | ||
| exports.version = '0.0.3'; | ||
@@ -25,0 +25,0 @@ /** |
+31
-27
@@ -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; | ||
| } |
+5
-1
| { | ||
| "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" |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No License Found
LicenseLicense information could not be found.
Found 1 instance in 1 package
8571
6.62%11
10%0
-100%297
1.37%1
-50%