diff --git a/lib/utils/gestures.html b/lib/utils/gestures.html
index c81b51cd6f..01f4660734 100644
--- a/lib/utils/gestures.html
+++ b/lib/utils/gestures.html
@@ -244,7 +244,12 @@
// if there is not a shadowroot, exit the loop
while (next && next.shadowRoot && !window.ShadyDOM) {
// if there is a node at x/y in the shadowroot, look deeper
+ let oldNext = next;
next = next.shadowRoot.elementFromPoint(x, y);
+ // on Safari, elementFromPoint may return the shadowRoot host
+ if (oldNext === next) {
+ break;
+ }
if (next) {
node = next;
}
diff --git a/test/unit/styling-cross-scope-var.html b/test/unit/styling-cross-scope-var.html
index c45d7fa9e4..9e799124fb 100644
--- a/test/unit/styling-cross-scope-var.html
+++ b/test/unit/styling-cross-scope-var.html
@@ -752,6 +752,8 @@
suite('scoped-styling-var', function() {
function assertComputed(element, value, pseudo, name) {
+ // force a style-recalc for Safari
+ element.offsetWidth;
name = name || 'border-top-width';
var computed = element.getComputedStyleValue && !pseudo ?
element.getComputedStyleValue(name) :
@@ -787,6 +789,10 @@
});
test('instances of scoped @keyframes', function(done) {
+ if (navigator.userAgent.match(/Safari\/603/) && ShadyCSS.nativeCss && ShadyCSS.nativeShadow) {
+ // `:nth-of-type` is broken in shadow roots on Safari 10.1
+ this.skip();
+ }
var xKeyframes = styled.$.keyframes2;
var onAnimationEnd = function() {
assertStylePropertyValue(xKeyframes, 'left', '5px');
diff --git a/test/unit/styling-scoped.html b/test/unit/styling-scoped.html
index 2bb5c88728..feb262e40e 100644
--- a/test/unit/styling-scoped.html
+++ b/test/unit/styling-scoped.html
@@ -759,13 +759,7 @@
Polymer.flush();
assert.notInclude(d.getAttribute('style-scoped') || '', styled.is, 'scoping attribute not removed when added to other root');
assert.notInclude(d.className, styled.is, 'scoping class not removed when added to other root');
- Polymer.dom(styled.root).appendChild(d);
- Polymer.flush();
- assertComputed(d, '4px');
- Polymer.dom(styled.root).removeChild(d);
- Polymer.flush();
- assert.notInclude(d.getAttribute('style-scoped') || '', styled.is, 'scoping attribute not removed when removed from root');
- assert.notInclude(d.className, styled.is, 'scoping class not removed when removed from root');
+ assertComputed(d, '0px');
Polymer.dom(styled.root).appendChild(d);
Polymer.flush();
assertComputed(d, '4px');