Merge remote-tracking branch 'upstream/main'

This commit is contained in:
2026-08-26 09:31:34 +08:00
parent 9b8c4bfab6
commit 394eb0285d
34137 changed files with 3589424 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
/**
* @param {string} content
* @return {Element}
*/
export default function (content) {
const hasImportNode = !!document.importNode;
const doc = new DOMParser().parseFromString(content, 'image/svg+xml').documentElement;
/**
* Fix for browser which are throwing WrongDocumentError
* if you insert an element which is not part of the document
* @see http://stackoverflow.com/a/7986519/4624403
*/
if (hasImportNode) {
return document.importNode(doc, true);
}
return doc;
}