Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Merge pull request #82 from azakus/master
Browse files Browse the repository at this point in the history
use ShadowRoot.olderShadowRoot
  • Loading branch information
dfreedm committed Jun 24, 2013
2 parents ad7371d + 9d1453a commit 3c1eb52
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,25 @@
return inEl.shadowRoot || inEl.webkitShadowRoot;
}
},
canTarget: function(scope) {
return scope && Boolean(scope.elementFromPoint);
canTarget: function(shadow) {
return shadow && Boolean(shadow.elementFromPoint);
},
targetingShadow: function(inEl) {
var s = this.shadow(inEl);
if (this.canTarget(s)) {
return s;
}
},
olderShadow: function(shadow) {
var os = shadow.olderShadowRoot;
if (!os) {
var se = shadow.querySelector('shadow');
if (se) {
os = se.olderShadowRoot;
}
}
return os;
},
searchRoot: function(inRoot, x, y) {
if (inRoot) {
var t = inRoot.elementFromPoint(x, y);
Expand All @@ -32,9 +42,7 @@
st = sr.elementFromPoint(x, y);
if (!st) {
// check for older shadows
os = sr.querySelector('shadow');
// check the older shadow if available
sr = os && os.olderShadowRoot;
sr = this.olderShadow(sr);
} else {
// shadowed element may contain a shadow root
var ssr = this.targetingShadow(st);
Expand Down

0 comments on commit 3c1eb52

Please sign in to comment.