jQuery, html5, append()/appendTo() and IE

Posted by karbassi on Stack Overflow See other posts from Stack Overflow or by karbassi
Published on 2009-07-27T23:17:44Z Indexed on 2010/04/04 22:03 UTC
Read the original article Hit count: 450

Filed under:
|
|
|

How to replicate:

  1. Create an html5 page.

  2. Make sure you have the script from remysharp.com/2009/01/07/html5-enabling-script/ added so that IE will notice the tags.

  3. Create an hardcoded <section id='anything'></section> tag.

  4. Using jQuery 1.3.2, append another section tag: $('#anything').append('<section id="whatever"></section>'); So far, everything works in all the browsers.

  5. Repeat the previous step. $('#whatever').append('<section id="fail"></section>'); This is where IE6/7 fails. Firefox/Safari will continue working.

Error

This is the error displayed.

Thoughts

  • It could be that IE6/7 can't handle the HTML5 section tag. I say this because when I change step 4 from <section> to <div>, IE6/7 will start working.

  • If I use document.createElement() and create my new element, it works, but it seems like jQuery's append() has a problem with html5 elements.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about html5