(node1: Node, node2: Node)
| 816 | * compare the position of two nodes |
| 817 | */ |
| 818 | export const comparePosition = (node1: Node, node2: Node): PositionNO => { |
| 819 | if (node1 === node2) { |
| 820 | return PositionNO.TheSame |
| 821 | } |
| 822 | const l1 = node1.zLevel |
| 823 | const l2 = node2.zLevel |
| 824 | if (l1 === l2) { |
| 825 | return PositionNO.BeforeOrAfter |
| 826 | } |
| 827 | |
| 828 | let p: any |
| 829 | if (l1 < l2) { |
| 830 | p = getZLevelTop(node2, l1) |
| 831 | if (p && p === node1) { |
| 832 | return PositionNO.Contains |
| 833 | } |
| 834 | return PositionNO.BeforeOrAfter |
| 835 | } |
| 836 | |
| 837 | p = getZLevelTop(node1, l2) |
| 838 | if (p && p === node2) { |
| 839 | return PositionNO.ContainedBy |
| 840 | } |
| 841 | |
| 842 | return PositionNO.BeforeOrAfter |
| 843 | } |
| 844 | |
| 845 | export const insertChild = ( |
| 846 | container: Node, |
no test coverage detected