Bug Tracker

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#9545 closed bug (worksforme)

fail to read attribute in A dom element

Reported by: admin@… Owned by:
Priority: low Milestone: 1.next
Component: attributes Version: 1.6.1
Keywords: Cc:
Blocked by: Blocking:

Description

<a href="" id="id" value="aaa">aa</a>

below not reponse $("#id").attr("value") $("#id").prop("value")

Change History (6)

comment:1 Changed 8 years ago by dmethvin

Resolution: worksforme
Status: newclosed

Seems okay to me. The attribute is defined but there is no property named value on a link.

http://jsfiddle.net/uK3kr/

comment:2 Changed 8 years ago by timmywil

Component: unfiledattributes
Priority: undecidedlow

comment:3 Changed 8 years ago by anonymous

hihi this bug only at 1.6.1 below jquery 1.5.2 all is work. i test your url but that jquery version is 1.5....

comment:4 Changed 8 years ago by dmethvin

I tested both 1.6 and (edge) again using the fiddle; both seem to work fine. To re-emphasize, it is correct that the *attribute* exists and is retrieved via .attr() but the *property* does not which is why .prop() returns undefined.

comment:5 in reply to:  3 Changed 8 years ago by peizguo

Replying to anonymous:

hihi this bug only at 1.6.1 below jquery 1.5.2 all is work. i test your url but that jquery version is 1.5....

Yes, it occurs at 1.6.1 caused by the attrHooks.value. Please visit http://jsfiddle.net/w9tcq/3/ and see the result at console

comment:6 Changed 8 years ago by timmywil

value is not valid on a cite tag either, but yes. This is intended behavior for value in order to make retrieving value backwards compatible, as you will notice 1.5.2 does the same thing: http://jsfiddle.net/timmywil/w9tcq/4/

Note: See TracTickets for help on using tickets.