The other day, I was reminiscing about the old days of jQuery and its ridonkulous number of plugins. Then I remembered one which I reeeally liked: smoothState.I was kinda disappointed the development seems to have stopped, but since I'm over jQuery anyway, it didn't bug me too much. But then I asked myself, is there anything like smoothState, but vanilla? After a quick googling session, I couldn't find anything.And that's how jazzer was born.It aims to be more or less the same as smoothState, enabling you to smoothly go from page to page, but way less bulky and easier to use. And, yeah, that's basically all.But I'd love some feedback, as little as it may be. Seeing as this is my first package ever, I'm sure there's a lot of room for improvement. Some part of the code could be more efficient?The code I'm the most unsure of are the following sections:window.addEventListener('jazzerChanged', (event) => {    // check the container for elements that might not have been loaded yet    let blockers = containerNode.querySelectorAll('img, picture, image, video, audio, script, style'),        toLoad = blockers.length;    // show the new contents if all blockers have fired a load event    const blockerLoaded = () => {        toLoad--;        if (toLoad === 0) {            emitCustomEvent('jazzerDone');        }    };    if (toLoad === 0) {        emitCustomEvent('jazzerDone');    } else {        for (let i = 0; i < blockers.length; i++) {            blockers[i].addEventListener('load', blockerLoaded);        }    }});This snippet basically first scans a section of the DOM for images and other stuff that may delay the the page load. It attaches a load event handler to each of them and, if all of them fired, shows the new node. Could this be more efficient somehow? I strongly feel it could. Especially since it gets called on every page load.Another section is this:let newDocument = document.implementation.createHTMLDocument('');// populate the new document with the dom from ajaxnewDocument.documentElement.innerHTML = newDom;// out with the old, in with the new markupcontainerNode.innerHTML = newDocument.querySelector(container).innerHTML;Is that the fastest way to safely extract a node with its contents out of a string? For context, I wanna replace all the contents of a given node with all the contents of a node with the same identifier, class or id or whatever, from another HTML file I've gotten via AJAX.GitHub / Demo
jazzer npm package
javascript;performance;ecmascript 6