qzwbqkz / ganon

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

Wrong class detection in Select #17

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
An example:

$test_string = '<div><span class="NOIsThis">Foo</span></div><div><span 
class="IsThis">Bar</span></div>';
$test_html = str_get_dom($test_string);
$spans = $test_html->select('span.IsThis');
echo 'Spans with class IsThis (should be one):'.count($spans);
echo "\r\n";
echo 'This should print Bar: 
'.$test_html->select('span.IsThis',0)->getPlainText();

I want select the span with class "IsThis", but, the query returns the first 
span (with class "NOIsThis").

I think this is wrong... dont you think?

Original issue reported on code.google.com by Radika...@gmail.com on 10 Sep 2012 at 3:01

GoogleCodeExporter commented 8 years ago
I solved this with: 

$test_string = '<div><span class="NOIsThis">Foo</span></div><div><span 
class="IsThis">Bar</span></div>';
$test_html = str_get_dom($test_string);
$spans = $test_html->select('span[class="IsThis"]');
echo 'Spans with class IsThis (should be one):'.count($spans);
echo "\r\n";
echo 'This should print Bar: 
'.$test_html->select('span[class="IsThis"]',0)->getPlainText();
exit;

Original comment by Radika...@gmail.com on 10 Sep 2012 at 3:24

GoogleCodeExporter commented 8 years ago
This issue was closed by revision r74.

Original comment by niels....@gmail.com on 19 Oct 2012 at 5:22

GoogleCodeExporter commented 8 years ago
Sorry it took so long, should be fixed in the next release!

Original comment by niels....@gmail.com on 19 Oct 2012 at 5:23