Use faster cached regexps for tests in setInnerHTML#1885
Use faster cached regexps for tests in setInnerHTML#1885zpao merged 1 commit intofacebook:masterfrom syranide:testinnerhtml
Conversation
|
Seems like a reasonable thing to take as is. I actually want to figure out the longer term IE8 plan as it would be great to be able to continue supporting it in some way but also build modern browser builds (your polyfill all the features idea is interesting). |
|
|
|
@zpao The polyfill is interesting, but there are two flaws I think:
I'm currently experimenting with how to support IE8 (and possibly other less capable browsers) for our service (we use iframes a lot) without making it too invasive or feeling like too much of a commitment. What I'm doing right now is simply just defining helper utils for all the properties/functions that I want and put them conditionally behind an if-statement. For instance: Which is simply implemented as: This creates a bit of overhead as uglifyjs isn't smart enough to inline these for the modern browser build, but for React core, the callsites for legacy features are so few and far in-between that we could just write: The minimal overhead of Since the fix is contained within |
Use faster cached regexps for tests in setInnerHTML
This is significantly faster than the current code.
http://jsperf.com/reacttestindexof (only relevant on IE8)
Also added comments to the list of non-visible tags and made the test even stricter.
Since this code is explicitly aimed at IE8, we could also switch the current extensive "feature test" for just
document.documentMode === 8, it correctly identifies emulation mode (which emulates the crappy whitespace behavior). The upside to this would be that we only target IE8 mode and doesn't apply potentially wonky logic to some other potentially broken browser out there (which I doubt there is).