Comparing version 0.2.0 to 0.3.0
@@ -72,7 +72,13 @@ | ||
if (selector.parsed().some(function (sel) { | ||
return sel.pseudos && sel.pseudos.some(function (pseudo) { | ||
return ~juice.ignoredPseudos.indexOf(pseudo.key); | ||
}); | ||
})) return; | ||
// skip rule if the selector has any pseudos which are ignored | ||
var parsedSelector = selector.parsed(); | ||
for (var i = 0; i < parsedSelector.length; ++i) { | ||
var subSel = parsedSelector[i]; | ||
if (subSel.pseudos) { | ||
for (var j = 0; j < subSel.pseudos.length; ++j) { | ||
var subSelPseudo = subSel.pseudos[j]; | ||
if (juice.ignoredPseudos.indexOf(subSelPseudo.key) >= 0) return; | ||
} | ||
} | ||
} | ||
@@ -119,5 +125,6 @@ utils.toArray(document.querySelectorAll(sel)).forEach(function (el) { | ||
var style = ''; | ||
for (var i in el.styleProps) | ||
style += el.styleProps[i].toString(); | ||
el.setAttribute('style', style); | ||
for (var i in el.styleProps) { | ||
style += el.styleProps[i].toString() + ' '; | ||
} | ||
el.setAttribute('style', style.trim()); | ||
} | ||
@@ -124,0 +131,0 @@ } |
@@ -6,3 +6,3 @@ | ||
var parser = require('mootools-slick-parser').Slick.parse | ||
var parser = require('slick').parse | ||
@@ -63,6 +63,6 @@ /** | ||
if (expression.attributes) spec[2] += expression.attributes.length; | ||
if (expression.classes) spec[2] += expression.classes.length; | ||
if (expression.classList) spec[2] += expression.classList.length; | ||
// tag awards a point in the fourth column | ||
if (expression.tag && expression.tag != '*') spec[3]++; | ||
if (expression.tag && expression.tag !== '*') spec[3]++; | ||
@@ -74,3 +74,3 @@ // pseudos award a point each in the fourth column | ||
for (var p = 0; p < pseudos.length; p++) { | ||
if (pseudos[p].key == 'not'){ | ||
if (pseudos[p].key === 'not'){ | ||
nots.push(pseudos[p].value); | ||
@@ -101,3 +101,3 @@ spec[3]--; | ||
try { | ||
return parser(text).expressions[0]; | ||
return parser(text)[0]; | ||
} catch (e) { | ||
@@ -104,0 +104,0 @@ return []; |
{ | ||
"name": "juice", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Inlines css into html source", | ||
@@ -28,17 +28,17 @@ "bin": "./bin/juice", | ||
"engines": { | ||
"node": ">=0.6.0 <0.9.0" | ||
"node": ">=0.8.0" | ||
}, | ||
"dependencies": { | ||
"cssom": "~0.2.5", | ||
"jsdom": "~0.5.0", | ||
"mootools-slick-parser": "1.3.2", | ||
"batch": "~0.2.1", | ||
"superagent": "~0.12.2", | ||
"commander": "~1.1.1" | ||
"jsdom": "~0.5.4", | ||
"batch": "~0.3.2", | ||
"superagent": "~0.13.0", | ||
"commander": "~1.1.1", | ||
"slick": "~1.10.0" | ||
}, | ||
"devDependencies": { | ||
"should": "0.3.1", | ||
"expresso": "0.9.0", | ||
"mocha": "~1.8.1" | ||
"should": "~1.2.2", | ||
"expresso": "~0.9.2", | ||
"mocha": "~1.8.2" | ||
} | ||
} |
[![Build Status](https://travis-ci.org/LearnBoost/juice.png?branch=master)](https://travis-ci.org/LearnBoost/juice) | ||
![](http://david-dm.org/LearnBoost/juice.png) | ||
[![Dependency Status](https://david-dm.org/LearnBoost/juice.png)](https://david-dm.org/LearnBoost/juice) | ||
# Juice ![](http://i.imgur.com/jN8Ht.gif) | ||
@@ -4,0 +4,0 @@ |
22297
483
+ Addedslick@~1.10.0
+ Addedbatch@0.3.2(transitive)
+ Addedslick@1.10.4(transitive)
+ Addedsuperagent@0.13.0(transitive)
- Removedmootools-slick-parser@1.3.2
- Removedbatch@0.2.1(transitive)
- Removedmootools-slick-parser@1.3.2(transitive)
- Removedsuperagent@0.12.4(transitive)
Updatedbatch@~0.3.2
Updatedjsdom@~0.5.4
Updatedsuperagent@~0.13.0