nt1m / material-framework

[Unmaintained] An easy to use material design based framework.
http://nt1m.github.io/material-framework
MIT License
388 stars 86 forks source link

Dialog Code Error #196

Closed SampaioLeal closed 7 years ago

SampaioLeal commented 7 years ago

I'm getting an error on material.js:185

Uncaught TypeError: Cannot read property 'appendChild' of null

On the function createOverlay

createOverlay: function() {
        if (document.querySelector(".dialog-overlay")) {
            this.overlay = document.querySelectorAll(".dialog-overlay")[0];
            return;
        }
        var overlay = document.createElement("div");
        overlay.className = "overlay dialog-overlay";
        overlay.hidden = true;
        overlay.setAttribute("id", "mf_overlay_" + Math.floor(Math.random() * 100000));
        document.body.appendChild(overlay);
        this.overlay = overlay;
    },