davidkpiano / flipping

Flipping awesome animations.
MIT License
1.4k stars 51 forks source link

Uncaught TypeError: Cannot read property 'parentElement' of undefined #31

Open Erudition opened 3 years ago

Erudition commented 3 years ago
Uncaught TypeError: Cannot read property 'parentElement' of undefined
    at t.flip (flipping.web.js:1)

I get this every time I use the library and call flip() - no matter which js file I pick. I looked at the source code, and it compiles to lines including these:

            t.prototype.flip = function(t) {
                var e = this;
                void 0 === t && (t = {});
                var n = t.parent || this.parentElement
                  , r = this.selectActive(n)
                  , i = {};
                return r.forEach(function(t, r) {
                    var o = t.getAttribute(e.attribute);

That this.parentElement call is the problem. In every browser I've tried, this was undefined there, and you cant get the .parentElement of undefined.

The error message varies, but it's always about this...