Skip to content

Instantly share code, notes, and snippets.

@sz332
Created November 10, 2016 19:20
Show Gist options
  • Save sz332/893140d1da9ea69c3144a7fd54ee22f8 to your computer and use it in GitHub Desktop.
Save sz332/893140d1da9ea69c3144a7fd54ee22f8 to your computer and use it in GitHub Desktop.
Polymer outside click element
window.addEventListener((e) {
var target = event.target;
while(target != this && target != document.body) {
target = Polymer.dom(target).node.domHost.parentNode;
// might need some additional steps to get the parent from inside custom elements
// don't know by heart
}
if(target == this) {
// inside element
} else {
// outside element
}
});
olymer.dom(target).node.parentElement
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment