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);
精彩评论