开发者

Safari strips tags from XML parsed with jQuery

Safari is consistently showing some weird behavior which is best demonstrated with a code example (in JavaScript):

var xml = "<whatever><status>success</status><title>interface update</title><details>just an example</details></whatever>"
var $jquery_xml = jQuery(xml);
var $jquery_xml.html();

The final line should return:

<status>success</status><title>interface update</title><details>just an example</details>

However, it actually returns:

<status>success</status><details>just an example</details>

The tag has been erased! Any ideas on why, and how I can get around this w开发者_运维技巧hile still using jQuery?


jQuery has a built in XML parser, that would probably better serve you.

var xml = "<whatever><status>success</status><title>interface update</title><details>just an example</details></whatever>";
var $jquery_xm = jQuery.parseXML(xml);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜