Side navigation
#15145 closed bug (notabug)
Opened June 13, 2014 06:15PM UTC
Closed June 13, 2014 06:56PM UTC
img tag with empty src, prop('src') returns URL of page
Reported by: | jquery@compressedtime.com | Owned by: | jquery@compressedtime.com |
---|---|---|---|
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
Attachments (0)
Change History (3)
Changed June 13, 2014 06:40PM UTC by comment:1
owner: | → jquery@compressedtime.com |
---|---|
status: | new → pending |
Changed June 13, 2014 06:51PM UTC by comment:2
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.
Changed June 13, 2014 06:56PM UTC by comment:3
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.
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?