Skip to main content

Bug Tracker

Side navigation

#11665 closed bug (duplicate)

Opened April 27, 2012 12:00PM UTC

Closed April 27, 2012 02:39PM UTC

Last modified May 03, 2012 12:20PM UTC

$(this).attr("for")

Reported by: prince_ppy Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:
Description

I was following jquery from 1.5, in my websites. recently I havejust updated with 1.7.2 in my development thinking that I can use latest features to make site work better, the site started breaking.

After analysing I found that the "attr" function is the problem center.

if I switch back to 1.7.1 jquery the code

$(this).attr("for") => will give me "divMain"

and if I switch to 1.7.2 the same code is giving as [object].

I have downloaded the development version of both 1.7.1 & 1.7.2 and found that the problem is in jquery 1.7.2.js line number 2227 "return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );". I found out that for a code "$(this).attr('for')" the arguments.length = 3, again I 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.

May be when some other js code override attr function, it may be always send arguments more the one, then code's behind: return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); will go not correctly, it deal as chainable. the other auguments will be undefined. it has no problem in jquery version 1.6.2. i don't know if it should let other changing their code or change the jquery core.

So what am saying is that "with out any change in code of file in my project, if I Switch the the new verion of jquery (1.7.2). the site breaks. So their are some very minner problems.

Attachments (0)
Change History (5)

Changed April 27, 2012 02:39PM UTC by mikesherov comment:1

resolution: → duplicate
status: newclosed

Sounds like you need to update your TinyMCE.

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

Duplicate of #11527.

Changed April 27, 2012 03:45PM UTC by prince_ppy comment:3

Am not using TinyMCE.

You may think only you are smart. If you don't know how to solve it tell us we will find a way. But don't tell that we can't understand.

I am putting an open challenge that I can prove that the error is from your site.

Changed April 27, 2012 04:00PM UTC by rwaldron comment:4

There is no reason for the aggressive comments. Please provide a reduced test case on http://jsfiddle.net that reproduces the issue

Changed May 03, 2012 12:20PM UTC by anonymous comment:5

Similar problem here. $(this).attr('rel') returns an object instead of the rel value.