question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

classList + polyfill error

See original GitHub issue

After 44e875c79059322821916ebaefaa43cd2d2c9c9a i got errors in elem.classList.add(classes[i]); if i have already polifylled array.

See example (see console)

https://jsfiddle.net/Illiax/ad3quksn/9/

I don’t know if i this is intended or not.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
samturrellcommented, Jul 18, 2016

Ok, so this issue appears to be user error, as seen here, you shouldn’t be doing what you’re doing: http://stackoverflow.com/a/948379/1375989

Fix:

if (!Array.prototype.contains) {
    Object.defineProperty(Array.prototype, 'contains', {
        enumerable: false,
        writable: true,
        value: function(element) {
            return !!~this.indexOf(element);
        }
    });
}
if (!Array.prototype.last){
    Object.defineProperty(Array.prototype, 'last', {
        enumerable: false,
        writable: true,
        value: function() {
            return this[this.length - 1];
        }
    })
};
0reactions
fmierescommented, Jul 18, 2016

And thanks for also giving me advice 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular4.x Module not found: Error: Can't resolve 'classlist.js'
// Run `npm install --save classlist.js`. The same goes for the web-animations-js polyfill if you haven't done so already.
Read more >
Element.classList polyfill not working · Issue #1454 · mdn/sprints
ClassList polyfill is throwing the following error in IE 11. Error: 'ele' is undefined. Polyfill is taken from below link
Read more >
classlist-polyfill - npm
Cross-browser JavaScript shim that fully implements element.classList (referenced on MDN). Latest version: 1.2.0, last published: 6 years ...
Read more >
Can't resolve 'classless.js' error in existing projects
Dear Radzen Team, I get a compile error in all my “older” projects which I started in a 1.x version of Radzen. The...
Read more >
HTML DOM Element classList Property - W3Schools
The classList property returns the CSS classnames of an element. ... The classList property is read-only, but you can use the methods listed...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found