textContent
impressivewebs opened this issue · 10 comments
All browsers support textContent:
https://developer.mozilla.org/en-US/docs/Web/API/Node.textContent
except IE6-8. You can polyfill it easily using the IE proprietary innerText:
http://msdn.microsoft.com/en-us/library/ie/ms533899(v=vs.85).aspx
Not sure if this would be appropriate for your library, but it would be easy to fix and wouldn't require users to branch for IE in this case. Note that there are differences between the two, as outlined on MDN.
would that be OK for you if the shim here simply use innerText ? This library is not a full 1:1 polyfill , is rather a fix for DOM Level 2 events and custom events and does NOT want to fix the whole IE8 DOM specially because of performance on same IE8 that will make this library pointless ...
As summary: a quick fix could land in here, a proper W3C fully compatible replacement with all possible gotchas ... ain't nobody got time for that ;-)
Let me know so I can eventually proceed with this ticket, thanks
Yeah, I think the quick fix is fine. That's basically what I was implying, I didn't expect a full polyfill. I was just mentioning that there are differences, just in case a quick fix wouldn't be worth it. So yeah, do the quick fix, I think the differences are somewhat small.... Except maybe the one where it says innerText will not grab something that's hidden with CSS, and causes reflows... That seems a bit odd, but it's better than nothing. :)
let me know if this version is OK, thanks
I don't have time to create a test myself, but if you want to throw a demo page up somewhere that uses this, I can test in IE10, in IE7/8 compatibility view.
no ... compatibility view is not an option but the test page has always been available here note that with Chrome and Safari those 2 reds at the beginning are not real.
oh ok... well, I can't test on a native IE8, only in IE10's document modes.
And FWIW, IE10 in IE8 mode passes with flying colors. :)
I'll do that too ... weird you asked for such change in first place then :D
I only asked for it because I wrote about that feature in my newsletter:
Next week's issue talks about textContent and how to make it work in oldIE, and I also included your script in a previous issue, so I thought I'd mention it here. :) Thanks for adding it.
uh .. right. In such case: thanks! ;-)