UNPKG

google-closure-library

Version:
35 lines (28 loc) 878 B
/** * @license * Copyright The Closure Library Authors. * SPDX-License-Identifier: Apache-2.0 */ /** * @fileoverview Utilities for HTML element tag names. */ goog.provide('goog.dom.tags'); goog.require('goog.object'); /** * The void elements specified by * http://www.w3.org/TR/html-markup/syntax.html#void-elements. * @const @private {!Object<string, boolean>} */ goog.dom.tags.VOID_TAGS_ = goog.object.createSet( 'area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr'); /** * Checks whether the tag is void (with no contents allowed and no legal end * tag), for example 'br'. * @param {string} tagName The tag name in lower case. * @return {boolean} */ goog.dom.tags.isVoidTag = function(tagName) { 'use strict'; return goog.dom.tags.VOID_TAGS_[tagName] === true; };