Has jQuery's attr method *really* been fixed?

R

RobG

It seems the jQuery developers finally listened to criticism of the
attr() method so that in version 1.6 it returns the value of HTML
attributes, not DOM properties. New prop() and removeProp() methods
have been introduced for properties.

This seems to address one of the more important criticisms of jQuery -
that it confuses attributes and properties. Does this move jQuery
toward becoming a recommendable library, or do the cons still out
weigh the pros?

It seems to me that they still have a little way to go - they need a
removeAttr() method to match removeProp(), and the other two methods
should be getAttr() and getProp(). If they'd done that, they could
have deprecated attr() for this release so that it kept backward
compatability and flagged it for removal in 1.7 or whatever comes
next.
 
M

Michael Haufe (\TNO\)

It seems the jQuery developers finally listened to criticism of the
attr() method so that in version 1.6 it returns the value of HTML
attributes, not DOM properties. New prop() and removeProp() methods
have been introduced for properties.

This seems to address one of the more important criticisms of jQuery -
that it confuses attributes and properties. Does this move jQuery
toward becoming a recommendable library, or do the cons still out
weigh the pros?

It seems to me that they still have a little way to go - they need a
removeAttr() method to match removeProp(), and the other two methods
should be getAttr() and getProp(). If they'd done that, they could
have deprecated attr() for this release so that it kept backward
compatability and flagged it for removal in 1.7 or whatever comes
next.

Go ahead and take one for the team and use jQuery for everything under
the sun and tell us how it goes.
 
D

David Mark

It seems the jQuery developers finally listened to criticism of the
attr() method so that in version 1.6 it returns the value of HTML
attributes, not DOM properties. New prop() and removeProp() methods
have been introduced for properties.

Correction: they heard, but did not listen. And did they really add a
"removeProp" method as well? That makes no sense at all. Just how do
you remove a property? :)

In short, they botched it (see recent related posts).

Then they almost immediately reversed it as it confused the hell out
of jQuery-land (as predicted).

http://groups.google.com/group/comp.lang.javascript/msg/637f8620db28d3db

So after three years (and a cloud of dust), they are right back to
where they started. :(
This seems to address one of the more important criticisms of jQuery -
that it confuses attributes and properties.

If only they had realized they didn't need attribute-related methods
(properties do just fine, thank you very much).

http://www.cinsoft.net/attributes.html

Once again, they copied, but didn't understand what they were
copying. Pretty slow about it too. And trying to write attribute
method wrappers in 2011, but tripping all over IE legacy bugs (which
date back to 1999) is just too much.
Does this move jQuery
toward becoming a recommendable library, or do the cons still out
weigh the pros?

It will never be any good because the developers are clueless and
jealous of anyone who seems to know more than they do (a large segment
of the JS community). And it's hemmed in by a botched design anyway.
It seems to me that they still have a little way to go - they need a
removeAttr() method to match removeProp(), and the other two methods
should be getAttr() and getProp().

They already had a (badly botched) removeAttr method that did not go
with the old attr method at all. None of it has ever made any sense
and their comments and documentation do not indicate that they
realized that.
If they'd done that, they could
have deprecated attr() for this release so that it kept backward
compatability and flagged it for removal in 1.7 or whatever comes
next.

They should have just fixed attr (even though the name would always be
an embarrassment) and dumped removeAttr.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top