Prototype DOM-traversal methods failing on HTML5 elements in IE < 9 using html5shiv
I'm using html5shiv 1.6.2 (latest) and Prototype v1.7 (latest).
So, html5shiv makes my <article>
, <section>
etc elements work nicely in IE < 9. They appear, I can style them etc. All good.
However, if I try to grab any such HTML5 elements using Prototype's DOM-traversal methods (e.g. down()
, up()
), then they always return undefined
in IE8/IE7 (who cares about IE6?). For example:
<article id="foo">
<div></div>
开发者_高级运维 <section></section>
<ul id="abc123"></ul>
</article>
..and then..
var bar = $('foo').down('div'); // works
var baz = $('foo').down('section'); // undefined
..and..
var theArticle = $('abc123').up('article'); // undefined
Anyone experienced such woes? Solutions/workarounds?
This appears to be down to a bug in the sizzlejs selector engine as coupled with Prototype 1.7, but it's fixed in later versions of sizzlejs. So, options are:
- wait for next Prototype version (probably with newer sizzlejs)
- go back to Prototype 1.6.x for now..
精彩评论