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
7 changes: 6 additions & 1 deletion src/service/viewport/viewport-binding-natural.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,12 @@ export class ViewportBindingNatural_ {

/** @override */
getLayoutRect(el, opt_scrollLeft, opt_scrollTop) {
const b = el./*OK*/getBoundingClientRect();
// 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) {
jridgewell marked this conversation as resolved.
Show resolved Hide resolved
b = el./*OK*/getBoundingClientRect();
}

if (this.useLayers_) {
return layoutRectLtwh(b.left, b.top, b.width, b.height);
}
Expand Down