Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix __addScrollListeners for polyfilled browsers #263

Merged
merged 1 commit into from
Feb 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion iron-overlay-behavior.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ declare namespace Polymer {
restoreFocusOnClose: boolean|null|undefined;

/**
* Set to true to allow clicks to go through overlays.
* Set to true to allow clicks to go through overlays.
* When the user clicks outside this overlay, the click may
* close the overlay below.
*/
Expand Down
8 changes: 4 additions & 4 deletions iron-overlay-behavior.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
},

/**
* Set to true to allow clicks to go through overlays.
* Set to true to allow clicks to go through overlays.
* When the user clicks outside this overlay, the click may
* close the overlay below.
*/
Expand Down Expand Up @@ -636,7 +636,7 @@
this.__addScrollListeners();
}
},

/**
* @private
*/
Expand All @@ -645,7 +645,7 @@
this.__rootNodes = [];
// Listen for scroll events in all shadowRoots hosting this overlay only
// when in native ShadowDOM.
if ('attachShadow' in Element.prototype && 'getRootNode' in Element.prototype) {
if (Polymer.Settings.useShadow) {
var node = this;
while (node) {
if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE && node.host) {
Expand All @@ -663,7 +663,7 @@
});
}, this);
},

/**
* @private
*/
Expand Down
19 changes: 15 additions & 4 deletions test/iron-overlay-behavior-scroll-actions.html
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,12 @@

suite('scroll actions in shadow root', function() {

suiteSetup(function() {
if (!Polymer.Settings.useShadow) {
this.skip();
}
});

var scrollable, overlay;
setup(function() {
var f = fixture('scrollable');
Expand Down Expand Up @@ -278,7 +284,7 @@
overlay.addEventListener('iron-overlay-canceled', function(event) {
assert.equal(event.detail.type, 'scroll', 'detail contains original event');
// In Polymer 1.x with dom=shadow, triggering a scroll event on a node inside a shadowRoot
// doesn't set the correct target, so we skip this check.
// doesn't set the correct target, so we skip this check.
if (Polymer.Element || !Polymer.Settings.useShadow) {
assert.equal(event.detail.target, scrollable, 'original scroll event target ok');
}
Expand All @@ -294,6 +300,12 @@

suite('scroll actions in shadow root, overlay distributed', function() {

suiteSetup(function() {
if (!Polymer.Settings.useShadow) {
this.skip();
}
});

var scrollable, overlay;
setup(function() {
var f = fixture('scrollable');
Expand Down Expand Up @@ -340,7 +352,7 @@
overlay.addEventListener('iron-overlay-canceled', function(event) {
assert.equal(event.detail.type, 'scroll', 'detail contains original event');
// In Polymer 1.x with dom=shadow, triggering a scroll event on a node inside a shadowRoot
// doesn't set the correct target, so we skip this check.
// doesn't set the correct target, so we skip this check.
if (Polymer.Element || !Polymer.Settings.useShadow) {
assert.equal(event.detail.target, scrollable, 'original scroll event target ok');
}
Expand All @@ -351,10 +363,9 @@
dispatchScroll(scrollable, 0, 10);
});
});

});
</script>

</body>

</html>
</html>