Comparing version 1.2.2 to 1.2.3
@@ -139,3 +139,3 @@ var through = require('through'); | ||
self._writing = false; | ||
self._matcher = matcher(parseSelector(sel), self); | ||
self._matcher = matcher(parseSelector(sel)); | ||
@@ -142,0 +142,0 @@ var remainingSets = []; |
@@ -16,3 +16,3 @@ var inherits = require('inherits'); | ||
module.exports = function (selector, result) { | ||
module.exports = function (selector) { | ||
var group = new EventEmitter; | ||
@@ -29,3 +29,3 @@ var matchers = group.matchers = [ create() ]; | ||
function create () { | ||
var m = new Match(selector, result); | ||
var m = new Match(selector); | ||
@@ -55,3 +55,3 @@ m.on('open', group.emit.bind(group, 'open')); | ||
function Match (selector, result) { | ||
function Match (selector) { | ||
this.selector = selector; | ||
@@ -64,3 +64,2 @@ this.index = 0; | ||
this.operator = null; | ||
this.result = result; | ||
} | ||
@@ -126,7 +125,4 @@ | ||
} | ||
else if (this.index <= this.startLevel && this.startLevel !== null) { | ||
if (!this.result._reading && !this.result._writing) { | ||
this.stack.pop(); | ||
if (this.stack.length && this.index > 0) this.index --; | ||
} | ||
else if (this.index < this.startLevel && this.startLevel !== null) { | ||
this.unmatch(); | ||
} | ||
@@ -133,0 +129,0 @@ } |
{ | ||
"name" : "trumpet", | ||
"version" : "1.2.2", | ||
"version" : "1.2.3", | ||
"description" : "parse and transform streaming html using css selectors", | ||
@@ -5,0 +5,0 @@ "main" : "index.js", |
@@ -6,3 +6,2 @@ var trumpet = require('../'); | ||
/* | ||
test('descendant selector', function (t) { | ||
@@ -18,3 +17,2 @@ t.plan(1); | ||
}); | ||
*/ | ||
@@ -25,3 +23,3 @@ test('descendant no-match selector', function (t) { | ||
var tr = trumpet(); | ||
var elem = tr.select('.a .d'); | ||
var elem = tr.select('.b .d'); | ||
elem.getAttribute('class', function (value) { | ||
@@ -28,0 +26,0 @@ t.fail('should not have matched'); |
@@ -49,1 +49,12 @@ var trumpet = require('../'); | ||
}); | ||
test('deeply nested', function (t) { | ||
t.plan(1); | ||
var tr = trumpet(); | ||
var elem = tr.select('.c h1'); | ||
elem.getAttribute('value', function (value) { | ||
t.equal(value, 'ch1'); | ||
}); | ||
fs.createReadStream(__dirname + '/misc_tags.html').pipe(tr); | ||
}); |
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
42938
1059