Skip to content
This repository was archived by the owner on Dec 19, 2024. It is now read-only.

Commit 71ceaf9

Browse files
committed
Guard against CE polyfill's lack of reactions stack in #detached; add a cast for Closure.
1 parent ce47d6d commit 71ceaf9

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

iron-overlay-behavior.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,18 @@ export const IronOverlayBehaviorImpl = {
211211

212212
/** @override */
213213
detached: function() {
214-
dom(this).unobserveNodes(this._observer);
214+
// TODO(bicknellr): Per spec, checking `this._observer` should never be
215+
// necessary because `connectedCallback` and `disconnectedCallback` should
216+
// always be called in alternating order. However, the custom elements
217+
// polyfill doesn't implement the reactions stack, so this can sometimes
218+
// happen, particularly if ShadyDOM is in noPatch mode where the custom
219+
// elements polyfill is installed before ShadyDOM. We should investigate
220+
// whether or not we can either implement the reactions stack without major
221+
// performance implications or patch ShadyDOM's functions to restore the
222+
// typical ShadyDOM-then-custom-elements order and remove this workaround.
223+
if (this._observer) {
224+
dom(this).unobserveNodes(this._observer);
225+
}
215226
this._observer = null;
216227
for (var cb in this.__rafs) {
217228
if (this.__rafs[cb] !== null) {

iron-scroll-manager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ export function _shouldPreventScrolling(event) {
270270
*/
271271
export function _getScrollableNodes(nodes) {
272272
var scrollables = [];
273-
var lockingIndex = nodes.indexOf(currentLockingElement);
273+
var lockingIndex = nodes.indexOf(/** @type {!Node} */(currentLockingElement));
274274
// Loop from root target to locking element (included).
275275
for (var i = 0; i <= lockingIndex; i++) {
276276
// Skip non-Element nodes.

0 commit comments

Comments
 (0)