The simple_html_dom library is great for getting known attributes, but is there a way to get a list of all the attributes for an element?
For example, if I have:
<div id="test" custom1="custom" custom2="custom">
I can easily get the id:
$el = $html->find('div');
$id = $el->id;
But, is it possible to get custom1 and custom2 if they are not known ahead of time? Ideally, the solution would produce an array of the NVP's for all attributes (id, custom1, custom2).
custom1andcustom2are not valid HTML attributes. If you need custom attributes, use the HTML5'sdata-*attributes (data-custom1="custom" ...).