Opened 9 years ago
Closed 9 years ago
#15145 closed bug (notabug)
img tag with empty src, prop('src') returns URL of page
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.11.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
<img src> attr('src') returns empty string prop('src') returns the URL of the page
Change History (3)
comment:1 Changed 9 years ago by
Owner: | set to [email protected]… |
---|---|
Status: | new → pending |
comment:2 Changed 9 years ago by
Status: | pending → new |
---|
I was writing a little routine to reload images in the event they fail to load, by setting img src back to itself.
I guess I was expecting prop('src') to return null.
comment:3 Changed 9 years ago by
Resolution: | → notabug |
---|---|
Status: | new → closed |
Definitely check those expectations against the standard. Most of the time reflected properties return an empty string rather than a null
or undefined
when the attribute is missing but we're not going to do something counter to the spec.
Note: See
TracTickets for help on using
tickets.
Corrected for the incorrect selector syntax and a bare-property output added:
http://jsfiddle.net/g9DBR/1/
It seems to be reflecting the
src
attribute to thesrc
property correctly using the process described in http://www.w3.org/TR/html5/infrastructure.html#reflectWhat value were you expecting for .prop(), and why?