-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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: currentDimension can return 0 for fluid player on IE #3738
Conversation
This is because IE returns 0 for both getComputedStyle and currentStyle. However, offsetHeight and offsetWidth do contain the correct values we want. So, if before returning in currentDimension the return value is still zero, check the offset values.
@@ -1149,15 +1149,20 @@ class Component { | |||
|
|||
computedWidthOrHeight = computedStyle.getPropertyValue(widthOrHeight) || computedStyle[widthOrHeight]; | |||
} else if (this.el_.currentStyle) { | |||
// ie 8 doesn't support computed style, shim it | |||
// return clientWidth or clientHeight instead for better accuracy | |||
computedWidthOrHeight = this.el_.currentStyle[widthOrHeight]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try and use currentStyle
on IE, if available.
@@ -1155,7 +1155,7 @@ class Component { | |||
|
|||
// if the computed value is still 0, it's possible that the browser is lying | |||
// and we want to check the offset values. | |||
// This code also runs on IE8 and whereever getComputedStyle doesn't exist. | |||
// This code also runs on IE8 and where-ever getComputedStyle doesn't exist. | |||
if (computedWidthOrHeight === 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wherever :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha, thanks. I'll update it before merging.
This is because IE returns 0 for both getComputedStyle and currentStyle.
However, offsetHeight and offsetWidth do contain the correct values we
want. So, if before returning in currentDimension the return value is
still zero, check the offset values.