"use strict"; const { CSS_DISPLAY_TAGS, CSS_DISPLAY_DEFAULT, CSS_WHITE_SPACE_TAGS, CSS_WHITE_SPACE_DEFAULT } = require("./constants.evaluate"); const htmlTagNames = require("html-tag-names"); const htmlElementAttributes = require("html-element-attributes"); const HTML_TAGS = arrayToMap(htmlTagNames); const HTML_ELEMENT_ATTRIBUTES = mapObject(htmlElementAttributes, arrayToMap); function arrayToMap(array) { const map = Object.create(null); for (const value of array) { map[value] = true; } return map; } function mapObject(object, fn) { const newObject = Object.create(null); for (const key of Object.keys(object)) { newObject[key] = fn(object[key], key); } return newObject; } function shouldPreserveContent(node, options) { if ( node.type === "element" && node.fullName === "template" && node.attrMap.lang && node.attrMap.lang !== "html" ) { return true; } // unterminated node in ie conditional comment // e.g. if ( node.type === "ieConditionalComment" && node.lastChild && !node.lastChild.isSelfClosing && !node.lastChild.endSourceSpan ) { return true; } // incomplete html in ie conditional comment // e.g. if (node.type === "ieConditionalComment" && !node.complete) { return true; } // top-level elements (excluding