Function
assertSingleNodeFromXPath
(xpath: string, context: Node)
Source from the content-addressed store, hash-verified
| 73 | } |
| 74 | |
| 75 | function assertSingleNodeFromXPath(xpath: string, context: Node) { |
| 76 | const node = document.evaluate( |
| 77 | xpath, |
| 78 | context, |
| 79 | undefined, |
| 80 | XPathResult.FIRST_ORDERED_NODE_TYPE, |
| 81 | ).singleNodeValue |
| 82 | |
| 83 | if (!node) { |
| 84 | throw new Error(`invalid XPath: "${xpath}"`) |
| 85 | } |
| 86 | |
| 87 | return node |
| 88 | } |
| 89 | |
| 90 | export function setup<Elements extends Element | Element[] = HTMLElement>( |
| 91 | ui: string, |
Tested by
no test coverage detected