|
|
|
@ -433,7 +433,7 @@ function claim_node<R extends ChildNodeEx>(nodes: ChildNodeArray, predicate: (no
|
|
|
|
return resultNode;
|
|
|
|
return resultNode;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export function claim_element(nodes: ChildNodeArray, name: string, attributes: { [key: string]: boolean }, create_element: (name: string) => Element | SVGElement = element) {
|
|
|
|
export function claim_element_base(nodes: ChildNodeArray, name: string, attributes: { [key: string]: boolean }, create_element: (name: string) => Element | SVGElement) {
|
|
|
|
return claim_node<Element | SVGElement>(
|
|
|
|
return claim_node<Element | SVGElement>(
|
|
|
|
nodes,
|
|
|
|
nodes,
|
|
|
|
(node: ChildNode): node is Element | SVGElement => node.nodeName === name,
|
|
|
|
(node: ChildNode): node is Element | SVGElement => node.nodeName === name,
|
|
|
|
@ -452,6 +452,14 @@ export function claim_element(nodes: ChildNodeArray, name: string, attributes: {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function claim_element(nodes: ChildNodeArray, name: string, attributes: { [key: string]: boolean }) {
|
|
|
|
|
|
|
|
return claim_element_base(nodes, name, attributes, element);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function claim_svg_element(nodes: ChildNodeArray, name: string, attributes: { [key: string]: boolean }) {
|
|
|
|
|
|
|
|
return claim_element_base(nodes, name, attributes, svg_element);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export function claim_text(nodes: ChildNodeArray, data) {
|
|
|
|
export function claim_text(nodes: ChildNodeArray, data) {
|
|
|
|
return claim_node<Text>(
|
|
|
|
return claim_node<Text>(
|
|
|
|
nodes,
|
|
|
|
nodes,
|
|
|
|
|