-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Use hasOwnProperty throughout the code #1792
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hmm, interesting, I suspect it's mostly my fault.
I guess then it's better to change all such loops to a regular Selfnote: L1956 is already fixed in #1764 |
yes lets switch on the jshint option too for it |
@seven-phases-max are you working on this? |
No, I'm not. Honestly I don't know how to find all such loops (I did not know that jshint has an options or this). So if you are going to take it, cool! But let me know if you prefer me to do that. |
😞 Tried it with |
|
Also, IIRC, there's no performance improvement to using |
I don't care of perfomance I just hate cluttered |
and if you do want to go forwards you need the extra var, and the model is:
|
we had around 10 places using for-in and only 1 that was on an array. the 2nd place mentioned in the description was already fixed. I replaced the array one with a the for-in for object doesn't have a browser compatible replacement afaik since Object.keys isn't in older browsers. Could rely on a polyfill, but thought I may as well leave as-is and add a hasOwnProperty to protect against hostile environments where a plonker has addded something to the object prototype. |
Hi there,
I just upgraded less from 1.4.1 to 1.6.0 and it did not work immediately. In my environment, the Array.prototype was extended with a "unique" function, which resulted in a lot of error messages, for example in those two lines (in the compiled less-1.6.0.js):
Adding
to all for ... in loops made it work for me.
Yours, David
The text was updated successfully, but these errors were encountered: