-
Notifications
You must be signed in to change notification settings - Fork 50.4k
Fix ReactEmptyComponent disappearing and throwing in IE8 #1495
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
Conversation
|
that's neat lol, 👍 |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
|
@chenglou can you get the right people looking at this and get it reviewed and landed? |
|
@chenglou Rebased, no conflicts. I don't know if there are any practical implications, but using |
|
@syranide diff created, although I can't repro this. I also vaguely remember being able to repro it, weird... |
|
@chenglou It happens if there is no text before the "invisible" tag. You can try it with just plain |
|
Reproed! Merged internally. |
Fix ReactEmptyComponent disappearing and throwing in IE8
One possible fix for #1494 and at the same time enabling the safe use of non-visible tags in IE8 for React components as well.
The down-side is cost, http://jsperf.com/testnoscrip, in worst-case scenarios it's 20% slower, that is; there's no leading text and only one element being inserted. However, using a more precise test (with no hits) the overall performance seems to only dip by 6%. Looking at http://jsperf.com/testnoscrip/3 with 6 elements being inserted, the cost of the lookups has already become reduced to only 2% slower overall performance. This does NOT include any overhead by React nor layouting/rendering, so the numbers should be significantly lower in practice. Also, this obviously only affects IE8.
Another possibility is to tag HTML insertions of non-visible tags inside React which could probably remove the overhead all-together, but I don't think there's an obvious non-intrusive way of doing it in React that would be worth it considering only IE8 is affected.
My PR implements the faster fix, including another check intended to further improve certain cases.