jquery with xml/html data behaves different in internet explorer
I have collected form data into a hidden field as the html fragments generated from textarea/tinymce sandwiched between section elements. This is stored into database as php/htmlentities e开发者_如何学JAVAncoded. When retrieved and examined with jquery, count of elements varies for same data between Internet explorer (reports more elements) and other browsers like firefox, chrome (reports 4 elements as expected) and so the dependent operations go haywire. sample data is below.
<section id='data1'>html data
generated by tinymce instance
1</section> <section id='data2'>html
data generated by tinymce instance
2</section> <section id='data3'>html
data generated by tinymce instance
3</section> <section id='data4'>html
data generated by tinymce instance
4</section>
I have checked for clash/interference because tinymce. It can be safely ruled out as same code is working in firefox/chrome. Can some one help me fix this, Please?
With regards.
Internet Explorer normally sees whitespace as empty elements, but I thought jquery fixed (or worked around) that. Maybe you should only count the section elements instead of all elements.
edit: I tried this in jsfiddle: http://jsfiddle.net/9aEsh/ IE7 returns 8 instead of 4 in this example, so define the elements you want to count! IE <9 counts textnodes as elements. IE9 does not have this problem.
精彩评论