Side navigation
#9185 closed bug (invalid)
Opened May 09, 2011 08:21AM UTC
Closed May 09, 2011 02:21PM UTC
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.
Attachments (0)
Change History (2)
Changed May 09, 2011 09:24AM UTC by comment:1
Changed May 09, 2011 02:21PM UTC by comment:2
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.
Github pull request -- make
attr
returnundefined
(as for comment and text nodes).