Skip to content

Instantly share code, notes, and snippets.

@c7x43t
Created November 14, 2018 15:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save c7x43t/e46338242e1130202053360b616f2eaf to your computer and use it in GitHub Desktop.
Save c7x43t/e46338242e1130202053360b616f2eaf to your computer and use it in GitHub Desktop.
var html = '<div id="test_div"><ul><li>Item 1</li><li>Item 2</li><li>Item 3</li></ul></div>';
var parser = new DOMParser();
var wrapper = parser.parseFromString(html, "text/html"); // this is a DocumentFragment
// Polyfill for DOMParser.parseFromString to support html: https://developer.mozilla.org/de/docs/Web/API/DOMParser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment