John Resig schrieb:
>> in IE the each function does not work under certain circumstances. The
>> following snippet throws an error in IE:
>>
>> $('infowindowtab/tab', this).each( ... )
> 
> This was the same issue with selecting children - which has been
> resolved now. Sorry about that.
> 

John,

I still get that strange bug inside the each loop

Consider the following XML:

<dashboard>
     <locations>
         <location>
             <infowindowtab>
                 <tab title="Location">
                     <![CDATA[ ... ]]>
                </tab>
                 <tab title="Users">
                     <![CDATA[ ... ]]>
                </tab>
             </infowindowtab>
         </location>
     </locations>
</dashboard>

And that snippet (both simplified):

$.get(..., function(xml) {

$('location', xml).each(function() {
     var content = [];
     var infoWindowTabs = $('infowindowtab', this);
     $('tab', infoWindowTabs[0]).each(function(k) {
         // workaround for IE needed here, $(this).text() throws an error
         content[k] = this.firstChild.data || $(this).text());
     });
});

});

In that case IE fails on $(this).text() and reports that object does not 
support that property or method (only have it in german, but I think you 
know what I mean).

You can see that I added some ugly bugfix for IE - fortunately IE 
returns the content of the CDATA block with this.firstChild.data whereas 
all other browsers return an empty string...


-- Klaus

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to