Opened 12 years ago
Closed 12 years ago
#9185 closed bug (invalid)
attr gives an unhandled error when run on a document selection
Reported by: | lonesomeday | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | 1.next |
Component: | attributes | Version: | git |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Before jQuery 1.6, it was possible (if silly) to get the properties of the document
object using attr()
. This functionality has obviously been broken in 1.6. However, it does not fail in a natural way (returning undefined
?). It calls getAttribute
on the node, which causes a JS error.
Change History (2)
comment:1 Changed 12 years ago by
comment:2 Changed 12 years ago by
Component: | unfiled → attributes |
---|---|
Priority: | undecided → low |
Resolution: | → invalid |
Status: | new → closed |
As the docs now state (http://api.jquery.com/attr), attr should not be used on the document or window. It throws an error because these do not and cannot have attributes. Failing silently may not be as helpful.
Note: See
TracTickets for help on using
tickets.
Github pull request -- make
attr
returnundefined
(as for comment and text nodes).