liquid.js icon indicating copy to clipboard operation
liquid.js copied to clipboard

Extending native JavaScript objects is a bad practice

Open mauteri opened this issue 9 years ago • 5 comments

I noticed in a few spots that JavaScript's native Array and String objects are being extended by Liquid with clear, first, last, etc.

With Liquid on our site, we ran into some pretty nasty bugs due to this and had to roll code back. Is there a reason this needs to be done as a property rather than creating helpers for this functionality? I'd be happy to provide a pull request to change this bit of code.

mauteri avatar Dec 18 '15 13:12 mauteri

Added pull request that just sets enumerable to false to prevent Liquid properties from showing up in for...in loops.

mauteri avatar Dec 21 '15 18:12 mauteri

I hit this issue too... would be an easy merge. May I ask why this has not been accepted?

maxfrigge avatar Feb 10 '17 11:02 maxfrigge

Ok.. so it seems to be fixed in master. Are there any known issues in master?

maxfrigge avatar Feb 10 '17 12:02 maxfrigge

Yeah, whats the status of this issue?

h0jeZvgoxFepBQ2C avatar Feb 26 '18 10:02 h0jeZvgoxFepBQ2C

Project looks pretty much abandoned to me... Last commit was December 5, 2016... :-/

mauteri avatar Feb 26 '18 14:02 mauteri