html2react
Version:
Utility for turning raw HTML into React elements
23 lines (21 loc) • 742 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = isElementChildrenSupported;
function isElementChildrenSupported(element) {
return isNotVoidElementTag(element.tagName);
}
/**
* List of void element tag names, that is, elements without child nodes.
* @type {Array}
*/
var VOID_ELEMENT_TAGS = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr'];
/**
* Checks if provided tag name is not in the list of void element tags.
* @param {String} tagName
* @return {Boolean}
*/
var isNotVoidElementTag = function isNotVoidElementTag(tagName) {
return VOID_ELEMENT_TAGS.indexOf(tagName.toLowerCase()) === -1;
};