Bug Tracker

Ticket #163 (closed bug: duplicate)

Opened 2 years ago

Last modified 1 year ago

IE throws errors for $(this) in nested each loops

Reported by: klaus.hartl@… Assigned to: anonymous
Type: bug Priority: minor
Milestone: 1.0 Component: core
Version: 1.0 Keywords: each loop ie xml
Cc: Needs:

Description

Consider the following XML:

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

And that JavaScript (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 throws an error (object does not support that property or method).

Attachments

Change History

Changed 2 years ago by joern

  • status changed from new to closed
  • resolution set to duplicate
Note: See TracTickets for help on using tickets.