Bug Tracker

Opened 5 years ago

Closed 5 years ago

#10114 closed bug (invalid)

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:
Blocked by: Blocking:

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 (1)

comment:1 Changed 5 years ago by dmethvin

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

$(xml)

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

In general, jQuery does not support namespaces.

Note: See TracTickets for help on using tickets.