395 var doc = response.documentElement; |
395 var doc = response.documentElement; |
396 } |
396 } |
397 var children = doc.childNodes; |
397 var children = doc.childNodes; |
398 if (!children.length) { |
398 if (!children.length) { |
399 // no child (error cases) => return the whole document |
399 // no child (error cases) => return the whole document |
400 return doc.cloneNode(true); |
400 return jQuery(doc).clone().context; |
401 } |
401 } |
402 children = stripEmptyTextNodes(children); |
402 children = stripEmptyTextNodes(children); |
403 if (children.length == 1) { |
403 if (children.length == 1) { |
404 // only one child => return it |
404 // only one child => return it |
405 return children[0].cloneNode(true); |
405 return jQuery(children[0]).clone().context; |
406 } |
406 } |
407 // several children => wrap them in a single node and return the wrap |
407 // several children => wrap them in a single node and return the wrap |
408 return DIV(null, map(methodcaller('cloneNode', true), children)); |
408 return DIV(null, map(function(node) { |
|
409 return jQuery(node).clone().context; |
|
410 }, |
|
411 children)); |
409 } |
412 } |
410 |
413 |
411 function postJSON(url, data, callback) { |
414 function postJSON(url, data, callback) { |
412 return jQuery.post(url, data, callback, 'json'); |
415 return jQuery.post(url, data, callback, 'json'); |
413 } |
416 } |