Skip to content

Commit

Permalink
Merge pull request #4520 from Polymer/safari-fixes
Browse files Browse the repository at this point in the history
Various Safari 10.1 fixes
  • Loading branch information
dfreedm authored Apr 10, 2017
2 parents e9c6380 + ef90168 commit d4b28b9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
5 changes: 5 additions & 0 deletions lib/utils/gestures.html
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
8 changes: 8 additions & 0 deletions test/unit/styling-cross-scope-var.html
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,9 @@
suite('scoped-styling-var', function() {

function assertComputed(element, value, pseudo, name) {
// force a style-recalc for Safari missing updated CSS Custom Properties
// https://bugs.webkit.org/show_bug.cgi?id=170708
element.offsetWidth;
name = name || 'border-top-width';
var computed = element.getComputedStyleValue && !pseudo ?
element.getComputedStyleValue(name) :
Expand Down Expand Up @@ -787,6 +790,11 @@
});

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
// https://bugs.webkit.org/show_bug.cgi?id=166748
this.skip();
}
var xKeyframes = styled.$.keyframes2;
var onAnimationEnd = function() {
assertStylePropertyValue(xKeyframes, 'left', '5px');
Expand Down
8 changes: 1 addition & 7 deletions test/unit/styling-scoped.html
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit d4b28b9

Please sign in to comment.