aFarkas / html5shiv

This script is the defacto way to enable use of HTML5 sectioning elements in legacy Internet Explorer.
http://paulirish.com/2011/the-history-of-the-html5-shiv/
9.89k stars 2.56k forks source link

Consider an IE8+ version of HTML5Shiv #70

Open jonathantneal opened 12 years ago

jonathantneal commented 12 years ago

There could be lots of optimisations done for an IE8+ version.

In a world where IE6 and IE7 step aside, IE8 would then offer new approaches to the same HTML5 incompatibilities. One approach would be to drop the list of sectioning elements in lieu of a defineProperty listener, hijacking the innerHTML setter, and shivving support for new elements responsively.

http://www.jonathantneal.com/blog/a-close-shiv/

paulirish commented 12 years ago

I think it's worth exploring.

also it's be "IE8" instead of "IE8+" right?

jonathantneal commented 12 years ago

True that. IE8.

(Unless there's something IE9 isn't telling us, or the unlikely event that more polyfilling and style shimmings make their way in.)

aFarkas commented 12 years ago

I also thought about using defineProperty to fix IE8. From my point of view this approach is soooo much cleaner and looks extremly promissing.

I have just added a first draft in the defineProperty branch. What we need is a really good cloneNode patch, new unit tests, perf (and size) optimizations and documentation.

Some important points:

  1. Do not redeclare body.innerHTML. This totally destroys the robustness of this approach (and this is the main advantage over our duckpunch). If someone wants to add html5shiv at the bottom of a document or load it async, she/he can write those lines her/his own (But we should make clear that his can harm other scripts and is really bad for performance).
  2. This script should never mix IE6/7 solutions with IE8 solutions. The defineProperty approach is so much better and different, that we can not guarantee similiar behavior. (Therefore this scripts also adds a false positive for supportsUnknownElements in 6/7.
  3. Before moving on with this branch, I would like to finalize/release the current version 3.6 in the main branch. It's marked as RC and is fully unit tested. After releasing it, I want to start on the documentation. So please review :-).
jonathantneal commented 10 years ago

Hey guys, pinging this conversation again. What would you think about a rewrite for v4? Here are three suggestions.

  1. More fun. Shiv the prototype & defineProperty way.
  2. More clear. The v3 IE6+ version becomes the branch, like normalize.css did it.
  3. Less legal. Switch to MIT or Public Domain license.
aFarkas commented 10 years ago

In short: YES!!! With 2. I would wait a little bit.