Skip to content

Instantly share code, notes, and snippets.

@shaneriley
Created August 29, 2011 15:37
Show Gist options
  • Save shaneriley/1178644 to your computer and use it in GitHub Desktop.
Save shaneriley/1178644 to your computer and use it in GitHub Desktop.
HTML nodeName Dictionary
var el_dictionary = {
a: "anchor",
h1: "heading",
h2: "heading",
h3: "heading",
h4: "heading",
h5: "heading",
h6: "heading",
li: "list item",
ul: "list container",
ol: "list container",
img: "image",
dl: "definition list",
dt: "definition term",
dd: "definition description",
em: "emphasis text",
i: "italic text",
strong: "strong text",
b: "bold text",
u: "underlined text",
s: "strikethrough text",
mark: "marked text",
hgroup: "heading group",
figcaption: "figure caption",
p: "paragraph",
tr: "table row",
td: "table cell",
th: "table heading",
thead: "table header",
tbody: "table body",
tfoot: "table foot",
col: "table column",
colgroup: "table column group",
abbr: "abbreviation",
bdo: "bidirection override",
br: "line break",
hr: "horizontal rule",
caption: "table caption",
del: "deleted text",
ins: "inserted text",
dfn: "instance definition",
q: "inline quote",
strike: "strikethrough text",
sub: "subscript",
sup: "superscript",
tt: "teletype",
nav: "navigation block",
pre: "preformatted block",
kbd: "keyboard input",
ruby: "ruby annotation",
rt: "ruby text",
rp: "ruby parentheses",
bdi: "inline bidirectional override",
wbr: "line break opportunity"
};
// Use:
el_dictionary[document.querySelector("wbr").nodeName.toLowerCase()]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment