Browse files

Stream#pre now supports callback function.

  • Loading branch information...
1 parent dd12ac6 commit 91faa3357b77bf323e8fd7e6b6185cea2d37a0cb @pgte committed Sep 14, 2012
Showing with 13 additions and 5 deletions.
  1. +5 −4 index.js
  2. +8 −1 lib/select.js
View
9 index.js
@@ -110,10 +110,11 @@ module.exports = function (opts) {
parser.onclosetag = function (name) {
parser.pause();
- stream.pre('close', name);
- update('close');
- stream.post('close', name);
- parser.resume();
+ stream.pre('close', name, function() {
+ update('close');
+ stream.post('close', name);
+ parser.resume();
+ });
};
parser.ontext = function (text) {
View
9 lib/select.js
@@ -41,7 +41,12 @@ module.exports = function (parser, opts) {
var updating = false;
- stream.pre = function (name, t) {
+ stream.pre = function (name, t, cb) {
+
+ function callback() {
+ if (cb) { cb(); }
+ }
+
if (name === 'open') {
selectors.forEach(function (sel) {
sel(t, parser)
@@ -74,6 +79,8 @@ module.exports = function (parser, opts) {
}
});
}
+
+ callback();
};
stream.post = function (name, t) {

0 comments on commit 91faa33

Please sign in to comment.