Reputation: 3302
Is there a way in javascript to get a list of all tags (HTML element .tag property) that a browser supports, like div, span, a, table, tr, input, etc. etc.
Upvotes: 1
Views: 793
Reputation: 8660
In short, no. Not currently.
You would have to do some scraping or API calls to get each Browser's compatibility, but as a starting point you would want to look at the HTML Standard https://html.spec.whatwg.org/multipage/ .
You can use a Regular Expression to get all the currently available HTML tags, and then compare that through something like CanIUse or each Browser's individual Engine documentation.
It's kind of a big project, but all Element prototypes aren't really listed anywhere, and even where they are because of all the nesting it's not listed in any organizational way that makes it easy to figure out how many are under each branch/ what their names are, etc. Keep in mind that's not even including Elements that have internal state/prototypal changes dictated by things like the type
attribute.
Here's the RegEx'd HTML5 Spec: http://regexr.com/4rimr
And the list given from that RegEx (as of 01/02/2020
):
document html head title base link link meta style body article section nav aside hgroup header footer address p hr pre blockquote ol ul menu li dl dt dd figure figcaption main div a em strong small s cite q dfn abbr ruby rt rp data time code var samp kbd i b u mark bdi bdo span br wbr ins del picture source img iframe embed object param video audio track map area table caption colgroup col tbody thead tfoot tr td th form label input button select datalist optgroup option textarea output progress meter fieldset legend details summary dialog script noscript template slot canvas hr button marquee meter progress select textarea marquee
Upvotes: 1