Skip to content

Commit dea052a

Browse files
committed
Various Safari 10.1 fixes
Fix infinite loop on `Polymer.Gestures.deepTargetFind` Fix styling test for changes caused by webcomponentsjs/shadycss#79 Skip styling test broken by safari bug
1 parent dd4e323 commit dea052a

3 files changed

Lines changed: 12 additions & 7 deletions

File tree

lib/utils/gestures.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,12 @@
244244
// if there is not a shadowroot, exit the loop
245245
while (next && next.shadowRoot && !window.ShadyDOM) {
246246
// if there is a node at x/y in the shadowroot, look deeper
247+
let oldNext = next;
247248
next = next.shadowRoot.elementFromPoint(x, y);
249+
// on Safari, elementFromPoint may return the shadowRoot host
250+
if (oldNext === next) {
251+
break;
252+
}
248253
if (next) {
249254
node = next;
250255
}

test/unit/styling-cross-scope-var.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,8 @@
752752
suite('scoped-styling-var', function() {
753753

754754
function assertComputed(element, value, pseudo, name) {
755+
// force a style-recalc for Safari
756+
element.offsetWidth;
755757
name = name || 'border-top-width';
756758
var computed = element.getComputedStyleValue && !pseudo ?
757759
element.getComputedStyleValue(name) :
@@ -787,6 +789,10 @@
787789
});
788790

789791
test('instances of scoped @keyframes', function(done) {
792+
if (navigator.userAgent.match(/Safari\/603/) && ShadyCSS.nativeCss && ShadyCSS.nativeShadow) {
793+
// `:nth-of-type` is broken in shadow roots on Safari 10.1
794+
this.skip();
795+
}
790796
var xKeyframes = styled.$.keyframes2;
791797
var onAnimationEnd = function() {
792798
assertStylePropertyValue(xKeyframes, 'left', '5px');

test/unit/styling-scoped.html

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -759,13 +759,7 @@
759759
Polymer.flush();
760760
assert.notInclude(d.getAttribute('style-scoped') || '', styled.is, 'scoping attribute not removed when added to other root');
761761
assert.notInclude(d.className, styled.is, 'scoping class not removed when added to other root');
762-
Polymer.dom(styled.root).appendChild(d);
763-
Polymer.flush();
764-
assertComputed(d, '4px');
765-
Polymer.dom(styled.root).removeChild(d);
766-
Polymer.flush();
767-
assert.notInclude(d.getAttribute('style-scoped') || '', styled.is, 'scoping attribute not removed when removed from root');
768-
assert.notInclude(d.className, styled.is, 'scoping class not removed when removed from root');
762+
assertComputed(d, '0px');
769763
Polymer.dom(styled.root).appendChild(d);
770764
Polymer.flush();
771765
assertComputed(d, '4px');

0 commit comments

Comments
 (0)