Skip to main content

Bug Tracker

Side navigation

#11527 closed bug (invalid)

Opened March 27, 2012 10:05AM UTC

Closed April 20, 2012 08:51PM UTC

Last modified May 02, 2012 12:41PM UTC

attr('href') returns object

Reported by: info@matriz.it Owned by: rwaldron
Priority: blocker Milestone: None
Component: attributes Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:
Description

jQuery 1.7.1

aTag.attr('href') return the URL of aTag

aTag.prop('href') return the full URL of aTag

jQuery 1.7.2

aTag.attr('href') return aTag

aTag.prop('href') return the full URL of aTag

Example

http://jsfiddle.net/VZLsH/1/

Attachments (0)
Change History (26)

Changed March 27, 2012 10:16AM UTC by sindresorhus comment:1

component: unfiledattributes
owner: → info@matriz.it
priority: undecidedlow
status: newpending

Can you please state the browser and version you're experiencing this in?

I've tried the testcase in IE6-9, Firefox 36, 11, Chrome, Opera 11.62 with jQuery 1.7.1 and 1.7.2 and I couldn't reproduce the described issue.

Duplicate of #11516, but keeping this, since it's the only one with testcase.

Changed March 27, 2012 11:20AM UTC by sindresorhus comment:2

#11516 is a duplicate of this ticket.

Changed March 27, 2012 02:17PM UTC by rwaldron comment:3

In support of @sindresorhus

Chrome...

[[Image(http://gyazo.com/828bf2ed411b3aa03f9ad0129a0e0587.png)]]

IE8...

[[Image(http://gyazo.com/0394a3326d3a5b0636c50d783cad3f93.png)]]

I can post more if nec

Changed March 27, 2012 04:13PM UTC by info@matriz.it comment:4

status: pendingnew

It doesn't work with Firefox 11 on Windows XP.

Changed March 27, 2012 05:40PM UTC by rwaldron comment:5

Changed March 27, 2012 05:40PM UTC by rwaldron comment:6

status: newpending

Changed March 28, 2012 11:01AM UTC by sindresorhus comment:7

#11529 is a duplicate of this ticket.

Changed March 28, 2012 01:18PM UTC by mikesherov comment:8

Just tossing this out there randomly: might compatibility view have something to do with this? Whenever I encounter an IE that's sometimes reproducible (maybe), I make sure I check with compatibility view on and compatibility view off.

Maybe it's just noise I'm adding, but it's worth a shot

Changed March 28, 2012 03:15PM UTC by rwaldron comment:9

@info@matriz.it

When you created the jsfiddle - did the bug reproduce?

Changed March 28, 2012 08:24PM UTC by rwaldron comment:10

owner: info@matriz.itrwaldron
priority: lowblocker
status: pendingassigned

Changed March 28, 2012 09:34PM UTC by rwaldron comment:11

#11512 is a duplicate of this ticket.

Changed March 28, 2012 09:35PM UTC by rwaldron comment:12

#11519 is a duplicate of this ticket.

Changed March 28, 2012 09:45PM UTC by ajpiano comment:13

I have a feeling this might be TinyMCE. Given both the nature of the several reports we've gotten, and also because of the fact that TinyMCE is a widely used WYSIWYG editor with a jQuery adapter that duckpunches attr. Take a look at line 215 of this gist https://gist.github.com/92a2c3631be1d35bb5e2, which is the beautified version of the minified jQuery plugin they ship in their zip file.

Changed March 28, 2012 09:48PM UTC by ajpiano comment:14

For anyone reading this's reference, research earlier today by mikesherov yielded this fiddle: http://jsfiddle.net/7u7cN/2/ which demonstrated that plugins that are redefining .attr and then calling it later on with .call would created unexpected results for people using attr in chains between 1.7.1 and 1.7.2. I believe rwaldron and davemethvin have come up with a path forward here that I'll leave it to them to document

Changed March 29, 2012 01:29AM UTC by ajpiano comment:15

#11531 is a duplicate of this ticket.

Changed March 29, 2012 07:04AM UTC by gnarf comment:16

Left a comment on the gist for anyone interested in the actual fix in TinyMCE's punch.

Changed March 30, 2012 03:52PM UTC by fj@flashjunior.ch comment:17

Checkout "Version 3.5b3" @ http://www.tinymce.com/develop/changelog/index.php?type=tinymce

"Fixed bug where the jQuery plugin would break the attr method of jQuery 1.7.2.".

Changed March 30, 2012 03:58PM UTC by rwaldron comment:18

Awesome!

Changed April 02, 2012 07:43AM UTC by anonymous comment:19

jQuery.fn.attr looks at arguments.length regardless of whether the last argument was undefined, so if you make a function that passes all of it's arguments to .attr, it would fail.

Changed April 02, 2012 02:59PM UTC by dmethvin comment:20

Yes, so if you want .attr() to act as a getter, pass it *one* string argument representing the attribute to be retrieved. That is the way it is documented. It was never documented to act as a getter when undefined was passed as a second argument. Behavior for that case is not specified, and may change from version to version as it did here.

Changed April 06, 2012 10:42AM UTC by sindresorhus comment:21

#11562 is a duplicate of this ticket.

Changed April 10, 2012 04:40AM UTC by rwaldron comment:22

#11572 is a duplicate of this ticket.

Changed April 20, 2012 08:51PM UTC by dmethvin comment:23

resolution: → invalid
status: assignedclosed

Turns out TinyMCE broke this before in #7284, and as before they have fixed it again in Version 3.5b3. Lurkers and Google searchers, please update your TinyMCE and hope they don't break it a third time. http://www.tinymce.com/download/download.php

Changed April 20, 2012 09:34PM UTC by dmethvin comment:24

#11615 is a duplicate of this ticket.

Changed April 27, 2012 02:40PM UTC by mikesherov comment:25

#11665 is a duplicate of this ticket.

Changed May 02, 2012 12:41PM UTC by rwaldron comment:26

#11683 is a duplicate of this ticket.