Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

use pre-open, fixes set-attrs test

  • Loading branch information...
commit a7c21e8ff481c860e457abf500ec12452a4b512f 1 parent 28bebee
James Halliday authored
Showing with 3 additions and 1 deletion.
  1. +1 −1  index.js
  2. +2 −0  lib/matcher.js
2  index.js
View
@@ -30,7 +30,7 @@ module.exports = function (opts) {
tr.selectAll = function (sel, cb) {
var r = createResult(sel, { all: true });
- r._matcher.on('open', function (m) {
+ r._matcher.on('pre-open', function (m) {
r.name = m.current.name;
r.attributes = m.current.attributes;
r.isSelfClosing = m.current.isSelfClosing;
2  lib/matcher.js
View
@@ -31,6 +31,7 @@ module.exports = function (selector) {
var m = new Match(selector);
m.on('open', group.emit.bind(group, 'open'));
+ m.on('pre-open', group.emit.bind(group, 'pre-open'));
m.on('tag-end', group.emit.bind(group, 'tag-end'));
m.on('attribute', group.emit.bind(group, 'attribute'));
@@ -75,6 +76,7 @@ Match.prototype.next = function () {
if (++ this.index === this.selector.length) {
this.matched = true;
+ this.emit('pre-open', this);
this.emit('open', this);
return true;
}
Please sign in to comment.
Something went wrong with that request. Please try again.