tangled
alpha
login
or
join now
yippee.fun
/
morphlex
0
fork
atom
Precise DOM morphing
morphing
typescript
dom
0
fork
atom
overview
issues
pulls
pipelines
Improve is parent node naming
joel.drapper.me
4 months ago
cb64636e
0e4f9379
+17
-2
1 changed file
expand all
collapse all
unified
split
src
morphlex.ts
+17
-2
src/morphlex.ts
···
1
const SUPPORTS_MOVE_BEFORE = "moveBefore" in Element.prototype
2
const ELEMENT_NODE_TYPE = 1
3
const TEXT_NODE_TYPE = 3
4
-
const PARENT_NODE_TYPES = [false, true, false, false, false, false, false, false, false, true, false, true]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
5
6
const Operation = {
7
EqualNode: 0,
···
791
}
792
793
function isParentNode(node: Node): node is ParentNode {
794
-
return !!PARENT_NODE_TYPES[node.nodeType]
795
}
···
1
const SUPPORTS_MOVE_BEFORE = "moveBefore" in Element.prototype
2
const ELEMENT_NODE_TYPE = 1
3
const TEXT_NODE_TYPE = 3
4
+
5
+
const IS_PARENT_NODE_TYPE = [
6
+
0, // 0: (unused)
7
+
1, // 1: Element
8
+
0, // 2: Attribute (deprecated)
9
+
0, // 3: Text
10
+
0, // 4: CDATASection (deprecated)
11
+
0, // 5: EntityReference (deprecated)
12
+
0, // 6: Entity (deprecated)
13
+
0, // 7: ProcessingInstruction
14
+
0, // 8: Comment
15
+
1, // 9: Document
16
+
0, // 10: DocumentType
17
+
1, // 11: DocumentFragment
18
+
0, // 12: Notation (deprecated)
19
+
]
20
21
const Operation = {
22
EqualNode: 0,
···
806
}
807
808
function isParentNode(node: Node): node is ParentNode {
809
+
return !!IS_PARENT_NODE_TYPE[node.nodeType]
810
}