Comparing version 0.3.1 to 0.3.2
@@ -138,15 +138,15 @@ var Stream = require('stream').Stream; | ||
var m = { | ||
name : s.match(/^([\w-]+|\*)/), | ||
class : s.match(/\.([\w-]+)/), | ||
id : s.match(/#([\w-]+)/), | ||
pseudo : s.match(/:([\w-]+)/), | ||
attribute : s.match(/\[([^\]]+)\]/), | ||
name: s.match(/^([\w-]+|\*)/), | ||
'class': s.match(/\.([\w-]+)/g), | ||
id: s.match(/#([\w-]+)/), | ||
pseudo: s.match(/:([\w-]+)/), | ||
attribute: s.match(/\[([^\]]+)\]/), | ||
}; | ||
return { | ||
name : m.name && m.name[1].toUpperCase(), | ||
class : m.class && m.class[1], | ||
id : m.id && m.id[1], | ||
pseudo : m.pseudo && m.pseudo[1], | ||
attribute : m.attribute && m.attribute[1], | ||
name: m.name && m.name[1].toUpperCase(), | ||
'class': m['class'], | ||
id: m.id && m.id[1], | ||
pseudo: m.pseudo && m.pseudo[1], | ||
attribute: m.attribute && m.attribute[1], | ||
}; | ||
@@ -176,3 +176,5 @@ }).filter(Boolean); | ||
if (p.name !== '*' && p.name && p.name !== t.name) return false; | ||
if (p.class && p.class !== t.attributes.class) return false; | ||
if (p['class'] && !checkClass(p['class'], t.attributes['class'])) { | ||
return false; | ||
} | ||
if (p.id && p.id !== t.attributes.id) return false; | ||
@@ -216,1 +218,10 @@ return true; | ||
} | ||
function checkClass (wanted, present) { | ||
if (present === undefined) return false; | ||
var classes = present.split(/\s+/); | ||
return wanted.every(function (s) { | ||
var w = s.replace(/^\./, ''); | ||
return classes.indexOf(w) >= 0; | ||
}); | ||
} |
{ | ||
"name" : "trumpet", | ||
"version" : "0.3.1", | ||
"version" : "0.3.2", | ||
"description" : "parse and transform streaming html using css selectors", | ||
@@ -5,0 +5,0 @@ "main" : "index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32963
32
687
12