Skip to main content

Bug Tracker

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

http://jsfiddle.net/g9DBR/

Attachments (0)
Change History (3)

Changed June 13, 2014 06:40PM UTC by dmethvin comment:1

owner: → jquery@compressedtime.com
status: newpending

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 the src property correctly using the process described in http://www.w3.org/TR/html5/infrastructure.html#reflect

What value were you expecting for .prop(), and why?

Changed June 13, 2014 06:51PM UTC by jquery@compressedtime.com comment:2

status: pendingnew

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 dmethvin comment:3

resolution: → notabug
status: newclosed

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.