We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4a64f9a commit 2fea569Copy full SHA for 2fea569
src/manipulation.js
@@ -486,7 +486,13 @@ jQuery.extend({
486
div = context.createElement("div");
487
488
// Go to html and back, then peel off extra wrappers
489
- div.innerHTML = wrap[1] + elem + wrap[2];
+ try {
490
+ div.innerHTML = wrap[1] + elem + wrap[2];
491
+ } catch(e) {
492
+
493
+ // .innerHTML throws exception in non-HTML documents, #5022
494
+ div.appendChild(new DOMParser().parseFromString(wrap[1] + elem + wrap[2], context.contentType).documentElement);
495
+ }
496
497
// Move to the right depth
498
while ( depth-- ) {
0 commit comments