This is what has me confused, in those tickets and from the github link there is indication of opposition, and near as i can tell the only argument against it is how much space it takes up...I can't say of other programmers but I deal with checking for the existence of attributes enough it's worth having as a function (and convenient). In my own code i have to include it anyways....
It's also unclear as to if the job will be done, I seriously doubt adding the little bit I've added will take up noticeable space or break anything...
Just my thoughts/questions...
Edit: I spoke a little too soon, i notice that indeed both tickets are closed as opposed to just the older one...
When in doubt, follow the most efficient pattern: the pattern nature created. Life's greatest problems are often solved by small and simple means.
But I'm sure it's leading a lot of people to believe that they must check that typeof attr() != undefined AND !==false. I thought jquery's entire purpose was to resolve browser inconsistencies and make things easier for us?
We don't control bad or outdated advice on StackOverflow. If you think the answer on the thread is wrong, ask the author or a mod to correct it.
Not sure how the "browser inconsistencies" dig is supposed to be relevant here.
That would add to it's use and versatility, but here's the thing:
After the last three months I've been working with JSON data much more than I ever had before (authoring my own jQuery plugins too) and it's just come to make so much more sense to me to compare the existence of an attribute the exact same way I would check for a property being set on an object. The same is even true of determining whether an optional parameter was passed in a function call.
I almost now expect to see something like typeof(variable) !== 'undefined', and jQuery has already gone the step of making a defined constant for undefined, that's plenty if not too much :)
and EDIT: This thread is more like almost if not over 2 years old, lol (still shows up as just 1 year apparently)
--------- When in doubt, follow the most efficient pattern: the pattern nature created. Life's greatest problems are often solved by small and simple means.
Leave a comment on vitzkrieg's reply
Change topic type
Link this topic
Provide the permalink of a topic that is related to this topic