Don't assume container node exists when loading bundle

Only look for the container node when needed
This commit is contained in:
Bruno Windels 2021-06-04 15:36:01 +02:00
parent 46bfab3eb7
commit 919542f8fc

View file

@ -14,10 +14,13 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
const container = document.querySelector(".hydrogen");
let container;
export function spinner(t, extraClasses = undefined) {
if (container.classList.contains("legacy")) {
if (container === undefined) {
container = document.querySelector(".hydrogen");
}
if (container?.classList.contains("legacy")) {
return t.div({className: "spinner"}, [
t.div(),
t.div(),