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: currentDimension can return 0 for fluid player on IE #3738

Merged
merged 4 commits into from
Nov 3, 2016

Conversation

gkatsev
Copy link
Member

@gkatsev gkatsev commented Nov 3, 2016

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.

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];
Copy link
Member Author

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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wherever :)

Copy link
Member Author

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.

@gkatsev gkatsev merged commit 74cddca into master Nov 3, 2016
@gkatsev gkatsev deleted the fix-current-dimensions branch November 3, 2016 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants