Dad to a weapons-grade face-licker dog,
Partner to a hyper-energetic, monica-esque girl,
Hiker,
const selection = getSelection(); | |
const isALink = selection.type.toLowerCase() == "range") && // Selection is a range, and | |
selection.anchorNode == selection.focusNode && // Starts & finishes in the same node, and | |
selection.anchorOffset == 0 && // Starts at beginning of the node, and | |
selection.focusOffset == selection.focusNode.textContent.length && // Finishes at end of the node, and | |
(selection.anchorNode.nodeName.toLowerCase() == 'a' || // Node is of type 'a' (link/anchor), or | |
selection.anchorNode.parentElement.nodeName.toLowerCase() == 'a') // Node parent is of type 'a' (link/anchor) | |
I hereby claim:
To claim this, I am signing this object: