sachinchoolur / lightgallery.js

Full featured JavaScript image & video gallery. No dependencies
https://sachinchoolur.github.io/lightgallery.js/
Other
5.3k stars 596 forks source link

Video play - adding multiple CSS classes breaks #35

Closed KozyLigh closed 3 years ago

KozyLigh commented 8 years ago

Greetings,

the original code for addClass breaks when adding lg-video-playing lg-has-video classes.

Using version: lightgallery.js | 0.0.2 | August 4th 2016

Error: lightgallery.min.js:7 Uncaught InvalidCharacterError: Failed to execute 'add' on 'DOMTokenList': The token provided ('lg-video-playing lg-has-video') contains HTML space characters, which are not valid in tokens.

I made a quick workaround for myself (not production code):

addClass: function addClass(el, className) { if (!el) { return; } if (el.classList) { var classArray = className.split(' '); for(var i = 0, len = classArray.length; i < len; i++){ el.classList.add(classArray[i]); }

        } else {
            el.className += ' ' + className;
        }
    },

With regards,

Marko

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. If the issue is still valid for version 2.x, please re-open. Apologize for not responding on time. Thank you for your contributions.