Skip to content

Instantly share code, notes, and snippets.

@jvlahos
Last active December 21, 2015 20:09
Show Gist options
  • Save jvlahos/6359576 to your computer and use it in GitHub Desktop.
Save jvlahos/6359576 to your computer and use it in GitHub Desktop.
isElement SASS function
@function isElement($name){
//Used MDN for reference list: https://developer.mozilla.org/en-US/docs/Web/HTML/Element
$htmlElements: a, abbr, acronym, address, applet, area, article, aside, audio, b, base, basefont, bdi, bdo, bgsound, big, blink, blockquote, body, br, button, canvas, caption, center, cite, code, col, colgroup, data, datalist, dd, decorator, del, details, dfn, dir, div, dl, dt, em, embed, fieldset, figcaption, figure, font, footer, form, frame, frameset, h1, h2, h3, h4, h5, h6, head, header, hgroup, hr, html, i, iframe, img, input, ins, isindex, kbd, keygen, label, legend, li, link, listing, main, map, mark, marquee, menu, menuitem, meta, meter, nav, nobr, noframes, noscript, object, ol, optgroup, option, output, p, param, plaintext, pre, progress, q, rp, rt, ruby, s, samp, script, section, select, small, source, spacer, span, strike, strong, style, sub, summary, sup, table;
@if index($htmlElements, $name) == false {
@return false;
} @else {
@return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment