I'm wondering if there any way to get all html attributes and put them in an Javascript array , I meen all html attributes that can be set to HTML elements including global attributes
-
You mean all attributes that exist on an element, or all attributes that hypothetically could exist on an element?T.J. Crowder– T.J. Crowder2015-04-04 11:23:27 +00:00Commented Apr 4, 2015 at 11:23
-
all attributes that hypothetically could exist on an elementmahmoud nezar sarhan– mahmoud nezar sarhan2015-04-04 11:24:07 +00:00Commented Apr 4, 2015 at 11:24
Add a comment
|
1 Answer
There's no automatic process that will give you that list, no. You'll need to get that information from the specification and maintain your own array, keeping it up to date as the specification evolves. The index provides a handy reference for them, and references the list of globals as well. And you'll want to allow for the fact that any element can have any number of data-* attributes.