72472cedc1902882a0b6ded5d0900aea37f58cfb987009e7248bdc63e6fccc878f69ef5f25b61b59a95abb4ad0791fba83040b12d6008ee46c8894060af3e4 504 B

12345678910111213141516171819
  1. /**
  2. * @param {string} content
  3. * @return {Element}
  4. */
  5. export default function (content) {
  6. const hasImportNode = !!document.importNode;
  7. const doc = new DOMParser().parseFromString(content, 'image/svg+xml').documentElement;
  8. /**
  9. * Fix for browser which are throwing WrongDocumentError
  10. * if you insert an element which is not part of the document
  11. * @see http://stackoverflow.com/a/7986519/4624403
  12. */
  13. if (hasImportNode) {
  14. return document.importNode(doc, true);
  15. }
  16. return doc;
  17. }