sunra / php-simple-html-dom-parser

PHP Simple HTML DOM Parser adaptation for Composer and PSR-0
1.3k stars 352 forks source link

Cannot find tags that have additional classes #80

Open komputronika opened 4 years ago

komputronika commented 4 years ago

find method cannot find tag that has additional classes.

For example, I want to find all tags that have 'services' class:

<div class='services'> or <div class='services last-item'> or <div class='services active'>

But, If I run:

$html->find('div[class=services]'); 

I will only get one result:

<div class='services'>
voku commented 4 years ago

You need to use .services or div[class~=services]: https://github.com/voku/simple_html_dom/commit/5b1854e3a5540db70342c639b8326622ce57b842