Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed multiple class selectors and bug with nested tag selectors, e.g…

…. 'p p'
  • Loading branch information...
commit 96baffb2d2e09b06aeee9f611017191936f7a5d6 1 parent 0c7e885
@chriso chriso authored Harry Fuecks committed
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/soupselect.js
View
8 lib/soupselect.js
@@ -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;
};
@@ -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;
}
Please sign in to comment.
Something went wrong with that request. Please try again.