in javascript dom, is there a mapping of tagName to HTMLElement?
cannot find a mapping of element tagName to HTMLElement, for example:
'DIV': HTMLDivElement
'A': HTMLAnchorElement
开发者_运维技巧
there is not a 1:1 mapping, for example
'B': HTMLElement
'S': HTMLElement
would be nice if said reference contained the distinguishing characteristic between an bold and strikeout HTMLElement
, but maybe I hope for too much.
this has to exist somewhere in webland...
There's a list on MDN:
https://developer.mozilla.org/en/Gecko_DOM_Reference#section_14
Looks like it maps the DOM objects to the corresponding HTML elements:
HTMLElement, directly implemented by: <dd>, <dt>, <tt>, <i>, <b>, <u>, <s>, <strike>, <big>, <small>, <em>, <strong>, <dfn>, <code>, <samp>, <kbd>, <var>, <cite>, <acronym>, <abbr>, <sub>, <sup>, <bdo>, <center>, <address>, <noframes>, <wbr>, <noscript>, <noembed>, <header>, <footer>, <article>, <aside>, <section>, <nav>, <figure>, <figcaption>, <mark>, <ruby>, <rt>, <rp>
HTMLAnchorElement, implemented by: <a>
HTMLAppletElement, implemented by: <applet>
...
you can visit here,see the interfaces in javascript.i hope this can help you.
If you read the docs http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-58190037
You'll see that elements are named like you wish (HTMLInputElement,HTMLQuoteElement, etc..)
But it looks like javascript is making no difference, you can always differ on node.nodeName
or node.tagName
精彩评论