I considered switching to DOMParser.parseFromString to parse incoming HTML, however some basic performance tests showed createContextualFragment was just barely faster than parseFromString when parsing a few different sized HTML fragments & documents. createContextualFragment appeared to lose it's edge as the HTML grew beyond what I would consider a "typical" amount of HTML for a webpage, so I think it's okay to stick with for now.
This PR fixes #47 by wrapping all the incoming HTML in a
<template>
before parsing it.createContextualFragment
just interprets table fragments as text nodes unless they're wrapped with a template.I considered switching to
DOMParser.parseFromString
to parse incoming HTML, however some basic performance tests showedcreateContextualFragment
was just barely faster thanparseFromString
when parsing a few different sized HTML fragments & documents.createContextualFragment
appeared to lose it's edge as the HTML grew beyond what I would consider a "typical" amount of HTML for a webpage, so I think it's okay to stick with for now.