Bug Tracker

Modify

Ticket #10114 (closed bug: invalid)

Opened 3 years ago

Last modified 3 years ago

escaping ':' in a find( element) does not work in Safari

Reported by: iamjonathanchan@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.6.2
Keywords: Cc:
Blocking: Blocked by:

Description

The following returns undefined in Safari:

var temp = $(xml).find('yweather
:condition').attr('temp');

Code snippet to work around this: $.ajax({

type: "GET", url: "./common/getFile.php?feed= http://weather.yahooapis.com/forecastrss?w=" + locationId, dataType: "xml", success: function(xml){

if ($.browser.webkit){

var temp = $(xml).find('condition').attr('temp'); var conditionText = $(xml).find('condition').attr('text'); var code = $(xml).find('condition').attr('code');

}else{ assume Mozilla

var temp = $(xml).find('yweather
:condition').attr('temp'); var conditionText = $(xml).find('yweather
:condition').attr('text'); var code = $(xml).find('yweather
:condition').attr('code');

}

}

...

Change History

comment:1 Changed 3 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to invalid

$(xml)

As documented, the $() operator is meant to parse HTML, not XML. Look into $.parseXML() instead.

In general, jQuery does not support namespaces.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.