Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong class detection in Select #17

Closed
GoogleCodeExporter opened this issue Feb 17, 2016 · 3 comments
Closed

Wrong class detection in Select #17

GoogleCodeExporter opened this issue Feb 17, 2016 · 3 comments

Comments

@GoogleCodeExporter
Copy link

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
Copy link
Author

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
Copy link
Author

This issue was closed by revision r74.

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

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

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

  • Added labels: Priority-High
  • Removed labels: Priority-Medium

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant