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: workaround for mozilla bug #106

Merged
merged 1 commit into from
Dec 8, 2016
Merged

Conversation

funnel-mark
Copy link
Contributor

@funnel-mark funnel-mark commented Dec 8, 2016

Firefox has a fun bug, described here:

https://bugzilla.mozilla.org/show_bug.cgi?id=548397
window.getComputedStyle() returns null inside an iframe with display: none

This causes react-sortable-hoc to throw TypeError: can't convert null to object

The workaround is to return an array with a single fake mozilla-prefixed style in it if window.getComputedStyle() returns falsy.

https://bugzilla.mozilla.org/show_bug.cgi?id=548397
window.getComputedStyle() returns null inside an iframe with display: none
@clauderic
Copy link
Owner

clauderic commented Dec 8, 2016

Hey @funnel-mark, thanks for flagging this and providing a detailed PR!

Based on your proposed implementation however, I wonder if there aren't other situations where window.getComputedStyle() might return a falsy value?

@funnel-mark
Copy link
Contributor Author

As far as I can understand from the documentation on MDN window.getComputedStyle() should either return a CSSStyleDeclaration or throw an error. It's only because of this bug that it returns null, it should never happen otherwise.

@clauderic
Copy link
Owner

I see. Thanks for the clarification! 👍

@clauderic clauderic merged commit b6e0a00 into clauderic:master Dec 8, 2016
DimitarNestorov pushed a commit to codemotionapps/react-sortable-hoc that referenced this pull request Feb 4, 2019
fix: workaround for mozilla bug
@mikhail-polontech
Copy link

mikhail-polontech commented Nov 20, 2020

Since Firefox version 62, window.getComputedStyle() returns a CSSStyleDeclaration object with length 0 (instead of null) inside an iframe with display: none.
See this comment: https://bugzilla.mozilla.org/show_bug.cgi?id=548397#c53.

CSSStyleDeclaration object with length 0 is not a falsy value, so the fix above does not work anymore and vendorPrefix gets an empty string value.

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.

3 participants