Skip to content

Commit

Permalink
Various Safari 10.1 fixes
Browse files Browse the repository at this point in the history
Fix infinite loop on `Polymer.Gestures.deepTargetFind`
Fix styling test for changes caused by webcomponentsjs/shadycss#79
Skip styling test broken by safari bug
  • Loading branch information
dfreedm committed Apr 10, 2017
1 parent dd4e323 commit dea052a
Show file tree
Hide file tree
Showing 3 changed files with 12 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
6 changes: 6 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,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) :
Expand Down Expand Up @@ -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');
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 dea052a

Please sign in to comment.