Bug Tracker

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: [email protected] Owned by: [email protected]
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/

Change History (3)

comment:1 Changed 9 years ago by dmethvin

Owner: set to [email protected]
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?

comment:2 Changed 9 years ago by [email protected]

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.

comment:3 Changed 9 years ago by dmethvin

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.

Note: See TracTickets for help on using tickets.