Bug Tracker

Modify

Ticket #5006 (closed bug: worksforme)

Opened 4 years ago

Last modified 15 months ago

$('iframe').attr('src') != $('iframe')[0].src

Reported by: cwolves Owned by:
Priority: major Milestone: 1.4
Component: selector Version: 1.3.2
Keywords: iframe src Cc:
Blocking: Blocked by:

Description

Somewhat a weird bug, but if the src is ' http://www.google.com', one has a trailing slash, the other doesn't...

Worse, if the src is blank, src="", one has the src set to the parent root and the other doesn't (firefox)

The specific issue that I'm running into is this:

<iframe src="">

$('iframe').filter('[src=]') no results

FF 3.5.2

Change History

comment:1 Changed 4 years ago by cwolves

Oh, the reason I referenced the DOM object is that .filter and .find seem to be getting results based on the DOM value whereas .attr('src') seems to be doing something else...

comment:2 Changed 4 years ago by jerone

Do you've got a testcase?

comment:3 Changed 3 years ago by dmethvin

  • Component changed from unfiled to selector

comment:4 Changed 3 years ago by addyosmani

  • Keywords iframe src added
  • Status changed from new to closed
  • Resolution set to worksforme

For the two cases submitted, ie $('iframe').attr('src') != $('iframe')[0].src, these are both working fine in jQuery 1.4.3 as demonstrated here  Live Test Case. This also demonstrates filter working fine when filtering by the src attribute. In addition, src="" will work fine as per here  http://jsfiddle.net/addyosmani/BKZVG/2/ but you shouldn't be querying with [src=] if you're specifically looking for those elements with an empty-string src attribute.

comment:5 Changed 3 years ago by anonymous

This isn't fixed...

In your test case, one method has a trailing slash, the other doesn't. Also, please see the test case for empty src's:

 http://jsfiddle.net/rwq7E/1/

I'm not sure what the correct behavior should be here, nor do I care any longer (15 month old ticket), but it's not fixed :)

MacOS Chrome & FF

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.