/**
 * Constant enumeration of legal values returned by HTMLElement.tagName property.
 *
 * Note: `TagName` are uppercase for comparison '===' with the 'tagName' property of Element.
 *       Unfortunately, this is the opposite of the casing used for document.createElement().
 */ export const enum TagName { a = "A" , abbr = "ABBR" , address = "ADDRESS" , area = "AREA" , article = "ARTICLE" , aside = "ASIDE" , audio = "AUDIO" , b = "B" , base = "BASE" , bdi = "BDI" , bdo = "BDO" , blockquote = "BLOCKQUOTE" , body = "BODY" , br = "BR" , button = "BUTTON" , canvas = "CANVAS" , caption = "CAPTION" , cite = "CITE" , code = "CODE" , col = "COL" , colgroup = "COLGROUP" , data = "DATA" , datalist = "DATALIST" , dd = "DD" , del = "DEL" , details = "DETAILS" , dfn = "DFN" , dialog = "DIALOG" , div = "DIV" , dl = "DL" , dt = "DT" , em = "EM" , embed = "EMBED" , fieldset = "FIELDSET" , figcaption = "FIGCAPTION" , figure = "FIGURE" , footer = "FOOTER" , form = "FORM" , h1 = "H1" , h2 = "H2" , h3 = "H3" , h4 = "H4" , h5 = "H5" , h6 = "H6" , head = "HEAD" , header = "HEADER" , hr = "HR" , html = "HTML" , i = "I" , iframe = "IFRAME" , img = "IMG" , input = "INPUT" , ins = "INS" , kbd = "KBD" , keygen = "KEYGEN" , label = "LABEL" , legend = "LEGEND" , li = "LI" , link = "LINK" , main = "MAIN" , map = "MAP" , mark = "MARK" , menu = "MENU" , menuitem = "MENUITEM" , meta = "META" , meter = "METER" , nav = "NAV" , noscript = "NOSCRIPT" , object = "OBJECT" , ol = "OL" , optgroup = "OPTGROUP" , option = "OPTION" , output = "OUTPUT" , p = "P" , param = "PARAM" , picture = "PICTURE" , pre = "PRE" , progress = "PROGRESS" , q = "Q" , rb = "RB" , rbc = "RBC" , rp = "RP" , rt = "RT" , rtc = "RTC" , ruby = "RUBY" , s = "S" , samp = "SAMP" , script = "SCRIPT" , section = "SECTION" , select = "SELECT" , slot = "SLOT" , small = "SMALL" , source = "SOURCE" , span = "SPAN" , strong = "STRONG" , style = "STYLE" , sub = "SUB" , summary = "SUMMARY" , sup = "SUP" , table = "TABLE" , tbody = "TBODY" , td = "TD" , template = "TEMPLATE" , textarea = "TEXTAREA" , tfoot = "TFOOT" , th = "TH" , thead = "THEAD" , time = "TIME" , title = "TITLE" , tr = "TR" , track = "TRACK" , u = "U" , ul = "UL" , var = "VAR" , video = "VIDEO" , wbr = "WBR" } interface TagMap { [ TagName . a ] : HTMLAnchorElement ; [ TagName . abbr ] : HTMLElement ; [ TagName . address ] : HTMLElement ; [ TagName . area ] : HTMLAreaElement ; [ TagName . article ] : HTMLElement ; [ TagName . aside ] : HTMLElement ; [ TagName . audio ] : HTMLAudioElement ; [ TagName . b ] : HTMLElement ; [ TagName . base ] : HTMLBaseElement ; [ TagName . bdi ] : HTMLElement ; [ TagName . bdo ] : HTMLElement ; [ TagName . blockquote ] : HTMLQuoteElement ; [ TagName . body ] : HTMLBodyElement ; [ TagName . br ] : HTMLBRElement ; [ TagName . button ] : HTMLButtonElement ; [ TagName . canvas ] : HTMLCanvasElement ; [ TagName . caption ] : HTMLTableCaptionElement ; [ TagName . cite ] : HTMLElement ; [ TagName . code ] : HTMLElement ; [ TagName . col ] : HTMLTableColElement ; [ TagName . colgroup ] : HTMLTableColElement ; [ TagName . data ] : HTMLDataElement ; [ TagName . datalist ] : HTMLDataListElement ; [ TagName . dd ] : HTMLElement ; [ TagName . del ] : HTMLModElement ; [ TagName . details ] : HTMLDetailsElement ; [ TagName . dfn ] : HTMLElement ; [ TagName . dialog ] : HTMLDialogElement ; [ TagName . div ] : HTMLDivElement ; [ TagName . dl ] : HTMLDListElement ; [ TagName . dt ] : HTMLElement ; [ TagName . em ] : HTMLElement ; [ TagName . embed ] : HTMLEmbedElement ; [ TagName . fieldset ] : HTMLFieldSetElement ; [ TagName . figcaption ] : HTMLElement ; [ TagName . figure ] : HTMLElement ; [ TagName . footer ] : HTMLElement ; [ TagName . form ] : HTMLFormElement ; [ TagName . h1 ] : HTMLHeadingElement ; [ TagName . h2 ] : HTMLHeadingElement ; [ TagName . h3 ] : HTMLHeadingElement ; [ TagName . h4 ] : HTMLHeadingElement ; [ TagName . h5 ] : HTMLHeadingElement ; [ TagName . h6 ] : HTMLHeadingElement ; [ TagName . head ] : HTMLHeadElement ; [ TagName . header ] : HTMLElement ; [ TagName . hr ] : HTMLHRElement ; [ TagName . html ] : HTMLHtmlElement ; [ TagName . i ] : HTMLElement ; [ TagName . iframe ] : HTMLIFrameElement ; [ TagName . img ] : HTMLImageElement ; [ TagName . input ] : HTMLInputElement ; [ TagName . ins ] : HTMLModElement ; [ TagName . kbd ] : HTMLElement ; [ TagName . keygen ] : HTMLElement ; [ TagName . label ] : HTMLLabelElement ; [ TagName . legend ] : HTMLLegendElement ; [ TagName . li ] : HTMLLIElement ; [ TagName . link ] : HTMLLinkElement ; [ TagName . main ] : HTMLElement ; [ TagName . map ] : HTMLMapElement ; [ TagName . mark ] : HTMLElement ; [ TagName . menu ] : HTMLMenuElement ; [ TagName . menuitem ] : HTMLElement ; [ TagName . meta ] : HTMLMetaElement ; [ TagName . meter ] : HTMLMeterElement ; [ TagName . nav ] : HTMLElement ; [ TagName . noscript ] : HTMLElement ; [ TagName . object ] : HTMLObjectElement ; [ TagName . ol ] : HTMLOListElement ; [ TagName . optgroup ] : HTMLOptGroupElement ; [ TagName . option ] : HTMLOptionElement ; [ TagName . output ] : HTMLOutputElement ; [ TagName . p ] : HTMLParagraphElement ; [ TagName . param ] : HTMLParamElement ; [ TagName . picture ] : HTMLPictureElement ; [ TagName . pre ] : HTMLPreElement ; [ TagName . progress ] : HTMLProgressElement ; [ TagName . q ] : HTMLQuoteElement ; [ TagName . rb ] : HTMLElement ; [ TagName . rbc ] : HTMLElement ; [ TagName . rp ] : HTMLElement ; [ TagName . rt ] : HTMLElement ; [ TagName . rtc ] : HTMLElement ; [ TagName . ruby ] : HTMLElement ; [ TagName . s ] : HTMLElement ; [ TagName . samp ] : HTMLElement ; [ TagName . script ] : HTMLScriptElement ; [ TagName . section ] : HTMLElement ; [ TagName . select ] : HTMLSelectElement ; [ TagName . slot ] : HTMLSlotElement ; [ TagName . small ] : HTMLElement ; [ TagName . source ] : HTMLSourceElement ; [ TagName . span ] : HTMLSpanElement ; [ TagName . strong ] : HTMLElement ; [ TagName . style ] : HTMLStyleElement ; [ TagName . sub ] : HTMLElement ; [ TagName . summary ] : HTMLElement ; [ TagName . sup ] : HTMLElement ; [ TagName . table ] : HTMLTableElement ; [ TagName . tbody ] : HTMLTableSectionElement ; [ TagName . td ] : HTMLTableDataCellElement ; [ TagName . template ] : HTMLTemplateElement ; [ TagName . textarea ] : HTMLTextAreaElement ; [ TagName . tfoot ] : HTMLTableSectionElement ; [ TagName . th ] : HTMLTableHeaderCellElement ; [ TagName . thead ] : HTMLTableSectionElement ; [ TagName . time ] : HTMLTimeElement ; [ TagName . title ] : HTMLTitleElement ; [ TagName . tr ] : HTMLTableRowElement ; [ TagName . track ] : HTMLTrackElement ; [ TagName . u ] : HTMLElement ; [ TagName . ul ] : HTMLUListElement ; [ TagName . var ] : HTMLElement ; [ TagName . video ] : HTMLVideoElement ; [ TagName . wbr ] : HTMLElement ; } /** Type guard that returns true if the given `node` is an `Element`. */ export function isElementNode ( node ) { return node . nodeType === 1 ; } /** Type guard that returns true if the given `node` is a `Text` node. */ export function isTextNode ( node ) { return node . nodeType === 3 ; } /** Type guard that returns true if the given `node` has the given `tagName`. */ export function hasTagName < K extends keyof TagMap > ( node , tagName ) { return ( node as Element ) . tagName === tagName ; }