I have run across a browser inconsistency which is not corrected for in jQuery. This may be on purpose, but I was wondering if it's something that should be added as a bug?
<script> $(document).ready(function(){ alert($("#foo:empty").length); }); </script> <div id="foo"><!-- This is awesome! --></div> --------------- In IE, that will alert 0, because it treats the comment as a child node (though I haven't figured out with jQuery how to access such a node in any meaningful way. In FF, it alerts 1, because it sees #foo as indeed empty (ignores the comment altogether). Should jQuery correct for :empty checks where the only child node(s) is/are comments? Seems like treating comments as actual node content is problematic. I recently ran across an even weirder instance of this issue, where IE actually adds a comment as a child of a preceeding LI element if it appears in a UL: <ul> <li></li> <!-- i love commenting --> <li>this is cool</li> </ul> The :empty check will fail on that first LI in IE, but will work in FF. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---