ferrarilongato / phpquery

Automatically exported from code.google.com/p/phpquery
0 stars 0 forks source link

Multiple selectors don't work with filter() method #74

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. get a set of element like that $myPhpQuery = $myPhpQuery->find('ul')
2. filtered it with $myPhpQuery->filter('.myClass1,.myClass2')
3. this only get the element matched ".myClass1" but not those matched
".myClass2".

What is the expected output? What do you see instead?
Don't select the element which have the "myClass2" class.

What version of the product are you using? On what operating system?
r292

Please provide any additional information below.
Exactly the same that issue 31 ... which have been fixed more than one
month ago !

Original issue reported on code.google.com by nicolas....@gmail.com on 1 Nov 2008 at 2:24

GoogleCodeExporter commented 8 years ago
Fixed in r292.
$doc = phpQuery::newDocument('<div class="class1 class2"/><div 
class="class1"/><div
class="class2"/>');
$doc['div']->filter('.class1, .class2')->dumpWhois();
Result is div.class1.class2

Original comment by tobiasz....@gmail.com on 1 Nov 2008 at 4:14

GoogleCodeExporter commented 8 years ago
Hey ! you should be with your family ! LoL
Thanks ;). I'll test it :).

Original comment by nicolas....@gmail.com on 1 Nov 2008 at 4:20

GoogleCodeExporter commented 8 years ago
Hum that's not really what we want it to do.
<php>filter('.class1, .class2')</php> should match the three DIV in your 
example.
Because the coma in a CSS selector is equal to "OR" not "AND".
So it filters the DIv having the "class1" OR the "class2".

So it doesn't work for me :(.

Original comment by nicolas....@gmail.com on 1 Nov 2008 at 4:29

GoogleCodeExporter commented 8 years ago
Youre right Nicolas, and even better because jQuery returns 4 nodes (one 
duplicate)
for such query. Ive applied this behavior in r293.

Original comment by tobiasz....@gmail.com on 1 Nov 2008 at 6:53

GoogleCodeExporter commented 8 years ago
Thanks to correct it ^^.
Working perfectly :).

Original comment by nicolas....@gmail.com on 3 Nov 2008 at 9:04