Bug Tracker

Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#7500 closed bug (fixed)

attr() fails for non DOM element nodes

Reported by: jitter Owned by: jitter
Priority: blocker Milestone: 1.5
Component: attributes Version: 1.4.4
Keywords: regression attr non DOM element Cc:
Blocked by: Blocking:

Description

With the changes for 1.4.3 a regression was introduced which prevented the use of attr() on anything but DOM element nodes (where nodeType is 1) see #7451 and the fix in 1.4.4 commit #a64dc0

But now attr(name) and attr(name, value) fails in various circumstances.

test case switch from version 1.4.2 to 1.4.3 to 1.4.4 to see how the behavior changed from working, to partially working to breaking with exceptions.

Change History (20)

comment:1 Changed 13 years ago by jitter

pull request

There is much noise from whitespace changes use diff -w to see the what's really going on

Last edited 13 years ago by jitter (previous) (diff)

comment:2 Changed 13 years ago by addyosmani

Component: unfiledattributes
Keywords: attr non DOM element nodes added
Priority: undecidedlow
Status: newopen

comment:3 Changed 13 years ago by dmethvin

Keywords: regression added; nodes removed

comment:4 Changed 13 years ago by Rick Waldron

Milestone: 1.51.4.5
Priority: lowblocker

Addy, I'm gonna change this to a blocker until we get a consensus on the behaviour regression.

comment:5 Changed 13 years ago by Rick Waldron

#7497 is a duplicate of this ticket.

comment:6 Changed 13 years ago by SlexAxton

#7505 is a duplicate of this ticket.

comment:7 Changed 13 years ago by addyosmani

#7517 is a duplicate of this ticket.

comment:8 Changed 13 years ago by Rick Waldron

Owner: set to jitter
Status: openpending

comment:9 Changed 13 years ago by jitter

Status: pendingopen

Why pending?

comment:10 Changed 13 years ago by Rick Waldron

@jitter - weird, I don't remember doing that at all... But check this out: I DID post this... 28 hours ago: http://bugs.jquery.com/ticket/7582

comment:11 Changed 13 years ago by snover

Status: openassigned

comment:13 Changed 13 years ago by jitter

#7591 is a duplicate of this ticket.

comment:14 Changed 13 years ago by Rick Waldron

#7605 is a duplicate of this ticket.

comment:15 Changed 13 years ago by Rick Waldron

#7665 is a duplicate of this ticket.

comment:16 Changed 13 years ago by jitter

#7503 is a duplicate of this ticket.

comment:17 Changed 13 years ago by john

Resolution: fixed
Status: assignedclosed

Landed

comment:18 Changed 12 years ago by jitter

Milestone: 1.4.51.5

Move fixed tickets to appropriate milestone

comment:19 Changed 12 years ago by shepik

The bug reappeared again 1.5.2: everything ok 1.6.0: Getting attribute foo failed for node of type plainjsobject elem.getAttribute is not a function

http://jsfiddle.net/A9auC/22/

comment:20 Changed 12 years ago by Timmy Willison

As the docs for http://api.jquery.com/attr states, do not use attr on the document or plain objects. http://api.jquery.com/prop will work instead, but for the document I suggest attaching data with http://api.jquery.com/data unless property manipulation is necessary.

Note: See TracTickets for help on using tickets.