Skip to content

Instantly share code, notes, and snippets.

@minitech minitech/valid-html4.js
Last active Dec 11, 2015

What would you like to do?
Checking for a valid HTML4 tag name using an object.
var html4 = {
A: true, ABBR: true, ACRONYM: true, ADDRESS: true, APPLET: true, AREA: true, B: true, BASE: true, BASEFONT: true,
BDO: true, BIG: true, BLOCKQUOTE: true, BODY: true, BR: true, BUTTON: true, CAPTION: true, CENTER: true, CITE: true,
CODE: true, COL: true, COLGROUP: true, DD: true, DEL: true, DFN: true, DIR: true, DIV: true, DL: true, DT: true, EM: true,
FIELDSET: true, FONT: true, FORM: true, FRAME: true, FRAMESET: true, H1: true, H2: true, H3: true, H4: true, H5: true,
H6: true, HEAD: true, HR: true, HTML: true, I: true, IFRAME: true, IMG: true, INPUT: true, INS: true, ISINDEX: true,
KBD: true, LABEL: true, LEGEND: true, LI: true, LINK: true, MAP: true, MENU: true, META: true, NOFRAMES: true,
NOSCRIPT: true, OBJECT: true, OL: true, OPTGROUP: true, OPTION: true, P: true, PARAM: true, PRE: true, Q: true, S: true,
SAMP: true, SCRIPT: true, SELECT: true, SMALL: true, SPAN: true, STRIKE: true, STRONG: true, STYLE: true, SUB: true,
SUP: true, TABLE: true, TBODY: true, TD: true, TEXTAREA: true, TFOOT: true, TH: true, THEAD: true, TITLE: true, TR: true,
TT: true, U: true, UL: true, VAR: true
var valid = !!html4[name.toUpperCase()];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.