Jack, if it is XML it cannot be dirty and there are no problems to fix with the string. I bet your wrap[1] and wrap[2] will always be "" and "", the last array, and I think it is good, being XML, if the browser raise an error if passed string is not valid XML.
Accordingly, you do not need anything there except what you already wrote: div = new DOMParser().parseFromString('<div>' + elem + '</div>', context.contentType).documentElement; But this modification produces an XML with two divs, rather than one, so it is not that simple, it should be just elem, and it should be elsewhere: var isXML = jQuery.isXML(context), ret = [], scripts = [], div = isXML ? (new DOMParser().parseFromString(elem, context.contentType).documentElement) : context.createElement("div"); if(isXML) { do some stuff to retrieve nodes } else { code as is } I did not test but what I am sure about those wrap cases should never exists with XML. Hope this helps. Regards --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---