Skip to content
This repository
Browse code

All attribute selector tests now passing

  • Loading branch information...
commit 6dbedb4dcf164b7c752649143438cf21e1623475 1 parent fa05d81
Harry Fuecks authored

Showing 2 changed files with 10 additions and 9 deletions. Show diff stats Hide diff stats

  1. +2 1  lib/soupselect.js
  2. +8 8 tests/soupselect.js
3  lib/soupselect.js
@@ -71,7 +71,8 @@ exports.select = function(dom, selector) {
71 71 });
72 72
73 73 if ( tag ) {
74   - found = domUtils.getElements({ 'tag_name': tag }, found);
  74 + // Filter to only those matching the tag name
  75 + found = domUtils.getElements({ 'tag_name': tag }, found, false);
75 76 }
76 77
77 78 currentContext = found
16 tests/soupselect.js
@@ -150,7 +150,7 @@ exports.basicSelectors = {
150 150 });
151 151 test.equal(els[1].attribs.class, 'onep');
152 152
153   - // attribs not created when none around - checking there's not class attribute
  153 + // attribs not created when none around - should really be checking there's no class attribute
154 154 test.ok(typeof els[0].attribs == 'undefined');
155 155 test.done();
156 156 });
@@ -233,8 +233,8 @@ exports.attributeSelectors = {
233 233 ['[href^="http://"]', ['bob', 'me']],
234 234 ['[id^="p"]', ['pmulti', 'p1']],
235 235 ['[id^="m"]', ['me', 'main']],
236   - // ['div[id^="m"]', ['main']],
237   - // ['a[id^="m"]', ['me']],
  236 + ['div[id^="m"]', ['main']],
  237 + ['a[id^="m"]', ['me']],
238 238 ]);
239 239 });
240 240 test.done();
@@ -267,20 +267,20 @@ exports.attributeSelectors = {
267 267 ['a[href*="http://"]', ['bob', 'me']],
268 268 ['[href*="http://"]', ['bob', 'me']],
269 269 ['[id*="p"]', ['pmulti', 'p1']],
270   - // ['div[id*="m"]', ['main']],
271   - // ['a[id*="m"]', ['me']],
  270 + ['div[id*="m"]', ['main']],
  271 + ['a[id*="m"]', ['me']],
272 272 // From test_attribute_endswith
273 273 ['[href*=".css"]', ['l1']],
274 274 ['link[href*=".css"]', ['l1']],
275   - // ['link[id*="1"]', ['l1']],
  275 + ['link[id*="1"]', ['l1']],
276 276 ['[id*="1"]', ['l1', 'p1', 'header1']],
277   - // ['div[id*="1"]', []],
  277 + ['div[id*="1"]', []],
278 278 ['[id*="noending"]', []],
279 279 // New for this test
280 280 ['[href*="."]', ['bob', 'me', 'l1']],
281 281 ['a[href*="."]', ['bob', 'me']],
282 282 ['link[href*="."]', ['l1']],
283   - // ['div[id*="n"]', ['main', 'inner']],
  283 + ['div[id*="n"]', ['main', 'inner']],
284 284 ['div[id*="nn"]', ['inner']],
285 285 ]);
286 286 });

0 comments on commit 6dbedb4

Please sign in to comment.
Something went wrong with that request. Please try again.