4 ms·
We can bring that down to 16 since query selector can handle undefined. 12% reduction. setTimeout(()=>document.querySelector(contentWindow.location.hash)?.repl
by ericlewis 3y ago
We can bring that down to 16 since query selector can handle undefined. 12% reduction.
setTimeout(()=>document.querySelector(contentWindow.location.hash)?.replaceWith(...contentDocument.body.childNodes))
- Kalabasa 3y agoYeah, querySelector(undefined) works Although location.hash defaults to the empty string '' when there is no hash, which gives a SyntaxError, so we still need the fallback selector to select none.