Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Medium Menu -7
function onMouseUp() {
var sel = document.getSelection(),
txt = sel.toString();
if (txt !== "") {
var range = sel.getRangeAt(0);
if (range.startContainer.parentElement.parentElement.localName
=== "article"
|| range.startContainer.parentElement.localName
=== "article") {
// some text in the article was selected
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment