Bug Tracker

Opened 10 years ago

Closed 10 years ago

#6012 closed bug (fixed)

.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

Change History (5)

comment:1 Changed 10 years ago by john

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.

comment:2 in reply to:  1 Changed 10 years ago by snop

Resolution: wontfix
Status: closedreopened

Replying to 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.

comment:3 Changed 10 years ago by john

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

comment:4 in reply to:  3 Changed 10 years ago by snop

Replying to 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

comment:5 Changed 10 years ago by john

Component: coreattributes
Resolution: fixed
Status: reopenedclosed
Note: See TracTickets for help on using tickets.