Skip to content

Instantly share code, notes, and snippets.

@cvle cvle/parseMarkup.ts
Last active Jan 13, 2020

Embed
What would you like to do?
Make Fluent work in IE11
// Wait for this to land: https://github.com/zloirock/core-js/pull/732
// Then use this custom markup parser in <LocalizationProvider> as <template> doesn't work in IE11.
const parser = new DOMParser();
function parseMarkup(str: string) {
const doc = parser.parseFromString(`<body>${str}</body>`, "text/html");
return Array.from(doc.body.childNodes);
}
// Also don't forget to transpile fluent using babel to support IE11 :-)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.