Skip to main content

Bug Tracker

Side navigation

#6012 closed bug (fixed)

Opened February 02, 2010 07:19PM UTC

Closed February 13, 2010 07:24AM UTC

.attr uncomatibility between 1.3.x and 1.4.x

Reported by: snop Owned by:
Priority: major Milestone: 1.4.2
Component: attributes Version: 1.4.1
Keywords: Attributes Cc:
Blocked by: Blocking:
Description

Hi dev,

in 1.3.x .attr method returned undefined when element didn't exist, but in 1.4.x .attr return null

And this isn't in documentation!

I don't know if it's bug or feature

Attachments (0)
Change History (5)

Changed February 02, 2010 09:04PM UTC by john comment:1

resolution: → wontfix
status: newclosed

Hard to tell without a specific test case but this was likely done intentionally. Please re-open if you have a specific test case.

Changed February 03, 2010 02:03PM UTC by snop comment:2

resolution: wontfix
status: closedreopened

Replying to [comment:1 john]:

Hard to tell without a specific test case but this was likely done intentionally. Please re-open if you have a specific test case.

Hi John,

it's definitively the bug.

test case is very simple, just test this on the site where is jQuery 1.4 ( #foo element doesn't exist ):

$('#foo').val() - return value is undefined

and then try

$('#foo').attr('value') - return value is null

And then try the same on the site where is jQuery 1.3:

$('#foo').val() - return value is undefined

and then try

$('#foo').attr('value') - return value is undefined

It's inconsistency, because the methods are doing the same, so they must return the same value when domelement doesn't exist.

Changed February 03, 2010 02:38PM UTC by john comment:3

Ah, it wasn't clear that the element didn't exist in this case, I can check in to that.

Changed February 03, 2010 03:29PM UTC by snop comment:4

Replying to [comment:3 john]:

Ah, it wasn't clear that the element didn't exist in this case, I can check in to that.

Hi,

ok, John can you add me to the cc pls ? I forgot

I thought, that if I craete ticket, i will added to the CC automatically, this could be changed too.

Thank you

Changed February 13, 2010 07:24AM UTC by john comment:5

component: coreattributes
resolution: → fixed
status: reopenedclosed