2 Object.defineProperty(exports, "__esModule", { value: true });
3 exports.Doctype = exports.CDATA = exports.Tag = exports.Style = exports.Script = exports.Comment = exports.Directive = exports.Text = exports.Root = exports.isTag = exports.ElementType = void 0;
4 /** Types of elements found in htmlparser2's DOM */
6 (function (ElementType) {
7 /** Type for the root element of a document */
8 ElementType["Root"] = "root";
10 ElementType["Text"] = "text";
11 /** Type for <? ... ?> */
12 ElementType["Directive"] = "directive";
13 /** Type for <!-- ... --> */
14 ElementType["Comment"] = "comment";
15 /** Type for <script> tags */
16 ElementType["Script"] = "script";
17 /** Type for <style> tags */
18 ElementType["Style"] = "style";
19 /** Type for Any tag */
20 ElementType["Tag"] = "tag";
21 /** Type for <![CDATA[ ... ]]> */
22 ElementType["CDATA"] = "cdata";
23 /** Type for <!doctype ...> */
24 ElementType["Doctype"] = "doctype";
25 })(ElementType = exports.ElementType || (exports.ElementType = {}));
27 * Tests whether an element is a tag or not.
29 * @param elem Element to test
31 function isTag(elem) {
32 return (elem.type === ElementType.Tag ||
33 elem.type === ElementType.Script ||
34 elem.type === ElementType.Style);
36 exports.isTag = isTag;
37 // Exports for backwards compatibility
38 /** Type for the root element of a document */
39 exports.Root = ElementType.Root;
41 exports.Text = ElementType.Text;
42 /** Type for <? ... ?> */
43 exports.Directive = ElementType.Directive;
44 /** Type for <!-- ... --> */
45 exports.Comment = ElementType.Comment;
46 /** Type for <script> tags */
47 exports.Script = ElementType.Script;
48 /** Type for <style> tags */
49 exports.Style = ElementType.Style;
50 /** Type for Any tag */
51 exports.Tag = ElementType.Tag;
52 /** Type for <![CDATA[ ... ]]> */
53 exports.CDATA = ElementType.CDATA;
54 /** Type for <!doctype ...> */
55 exports.Doctype = ElementType.Doctype;