Side navigation
#10114 closed bug (invalid)
Opened August 22, 2011 07:59PM UTC
Closed August 22, 2011 11:17PM UTC
escaping ':' in a find( element) does not work in Safari
Reported by: | iamjonathanchan@gmail.com | 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');
}
}
...
Attachments (0)
Change History (1)
Changed August 22, 2011 11:17PM UTC by comment:1
resolution: | → invalid |
---|---|
status: | new → closed |
As documented, the
$()
operator is meant to parse HTML, not XML. Look into$.parseXML()
instead.In general, jQuery does not support namespaces.