Ticket #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: | ||
| 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
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

As documented, the $() operator is meant to parse HTML, not XML. Look into $.parseXML() instead.
In general, jQuery does not support namespaces.