|
|
|
|
|
by k1m
53 days ago
|
|
I find CSS selectors a lot easier to write than XPath. I recently gave a talk on how PHP's new DOM API makes working with HTML and CSS selectors natively very easy (previously you had to convert CSS to XPath).[1] It's a shame that because CSS is still primarily for browser use and styling, we don't get nice things like the ability to select based on text content like we can with XPath. My understanding is that this was proposed but didn't make it into the spec because it could lead to performance issues in a browser rendering context. [1] https://speakerdeck.com/keyvan/parsing-html-with-php-8-dot-4... |
|
Works like magic!