1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.nextElementSibling = exports.getName = exports.hasAttrib = exports.getAttributeValue = exports.getSiblings = exports.getParent = exports.getChildren = void 0;
|
4 | function getChildren(elem) {
|
5 | return elem.children || null;
|
6 | }
|
7 | exports.getChildren = getChildren;
|
8 | function getParent(elem) {
|
9 | return elem.parent || null;
|
10 | }
|
11 | exports.getParent = getParent;
|
12 | function getSiblings(elem) {
|
13 | var parent = getParent(elem);
|
14 | return parent ? getChildren(parent) : [elem];
|
15 | }
|
16 | exports.getSiblings = getSiblings;
|
17 | function getAttributeValue(elem, name) {
|
18 | var _a;
|
19 | return (_a = elem.attribs) === null || _a === void 0 ? void 0 : _a[name];
|
20 | }
|
21 | exports.getAttributeValue = getAttributeValue;
|
22 | function hasAttrib(elem, name) {
|
23 | return (!!elem.attribs &&
|
24 | Object.prototype.hasOwnProperty.call(elem.attribs, name) &&
|
25 | elem.attribs[name] != null);
|
26 | }
|
27 | exports.hasAttrib = hasAttrib;
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 | function getName(elem) {
|
34 | return elem.name;
|
35 | }
|
36 | exports.getName = getName;
|
37 | function nextElementSibling(elem) {
|
38 | var node = elem.next;
|
39 | while (node !== null && node.type !== "tag")
|
40 | node = node.next;
|
41 | return node;
|
42 | }
|
43 | exports.nextElementSibling = nextElementSibling;
|