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

🐛 Guard against getBoundingClientRect to prevent unspecified errors in IE. #20731

Merged
merged 13 commits into from
Feb 14, 2019
9 changes: 8 additions & 1 deletion src/service/viewport/viewport-binding-natural.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,16 @@ export class ViewportBindingNatural_ {

/** @override */
getLayoutRect(el, opt_scrollLeft, opt_scrollTop) {

const documentElement = this.win.document.documentElement;
const childMatch = childElement(documentElement /* parent */, (child) => {
child.equals(el);
});
const isElementInDoc = (childMatch != null);
jridgewell marked this conversation as resolved.
Show resolved Hide resolved

// Default value for when 'el' is has not been added to the page yet.
let b = 0;
jridgewell marked this conversation as resolved.
Show resolved Hide resolved
if (el != undefined && el != null) {
if (isElementInDoc) {
b = el./*OK*/getBoundingClientRect();
}

Expand Down