Skip to content

Commit

Permalink
Fixed multiple class selectors and bug with nested tag selectors, e.g…
Browse files Browse the repository at this point in the history
…. 'p p'
  • Loading branch information
chriso authored and Harry Fuecks committed Nov 9, 2010
1 parent 0c7e885 commit 96baffb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/soupselect.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ exports.select = function(dom, selector) {
if (!value) return false;
var classes = value.split(/\s+/);
for (var i = 1, len = parts.length; i < len; i++) {
if (!~classes.indexOf(parts[i]) return false;
if (!~classes.indexOf(parts[i])) return false;
}
return true;
};
Expand Down Expand Up @@ -160,13 +160,13 @@ exports.select = function(dom, selector) {
found = [];
for ( var m = 0; m < currentContext.length; m++ ) {
// htmlparsers document itself has no child property - only nodes do...
if ( typeof context.children !== 'undefined' ) {
if ( typeof currentContext[m].children !== 'undefined' ) {
found = found.concat(domUtils.getElementsByTagName(tokens[i], currentContext[m].children));
} else {
} else if (i === 0) {
found = found.concat(domUtils.getElementsByTagName(tokens[i], currentContext[m]));
}

});
};

currentContext = found;
}
Expand Down

0 comments on commit 96baffb

Please sign in to comment.