mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-12 11:15:14 +00:00
19 lines
447 B
TypeScript
19 lines
447 B
TypeScript
export function detach(node: Node) {
|
|
node.parentNode.removeChild(node);
|
|
}
|
|
|
|
export function findAnchor(node: Node) {
|
|
while (node && node.nodeName.toUpperCase() !== 'A') node = node.parentNode; // SVG <a> elements have a lowercase name
|
|
return node;
|
|
}
|
|
|
|
export function which(event: MouseEvent) {
|
|
return event.which === null ? event.button : event.which;
|
|
}
|
|
|
|
export function scroll_state() {
|
|
return {
|
|
x: window.scrollX,
|
|
y: window.scrollY
|
|
};
|
|
} |