Bug Tracker

Ticket #7500 (closed bug: fixed)

Opened 4 years ago

Last modified 3 years ago

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:
Blocking: Blocked by:

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

comment:1 Changed 4 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 4 years ago by jitter (previous) (diff)

comment:2 Changed 4 years ago by addyosmani

  • Keywords attr non DOM element nodes added
  • Priority changed from undecided to low
  • Status changed from new to open
  • Component changed from unfiled to attributes

comment:3 Changed 4 years ago by dmethvin

  • Keywords regression added; nodes removed

comment:4 Changed 4 years ago by rwaldron

  • Priority changed from low to blocker
  • Milestone changed from 1.5 to 1.4.5

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

comment:5 Changed 4 years ago by rwaldron

#7497 is a duplicate of this ticket.

comment:6 Changed 4 years ago by SlexAxton

#7505 is a duplicate of this ticket.

comment:7 Changed 4 years ago by addyosmani

#7517 is a duplicate of this ticket.

comment:8 Changed 4 years ago by rwaldron

  • Owner set to jitter
  • Status changed from open to pending

comment:9 Changed 4 years ago by jitter

  • Status changed from pending to open

Why pending?

comment:10 Changed 4 years ago by rwaldron

@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 4 years ago by snover

  • Status changed from open to assigned

comment:12 Changed 4 years ago by snover

comment:13 Changed 4 years ago by jitter

#7591 is a duplicate of this ticket.

comment:14 Changed 4 years ago by rwaldron

#7605 is a duplicate of this ticket.

comment:15 Changed 4 years ago by rwaldron

#7665 is a duplicate of this ticket.

comment:16 Changed 4 years ago by jitter

#7503 is a duplicate of this ticket.

comment:17 Changed 4 years ago by john

  • Status changed from assigned to closed
  • Resolution set to fixed

Landed

comment:18 Changed 4 years ago by jitter

  • Milestone changed from 1.4.5 to 1.5

Move fixed tickets to appropriate milestone

comment:19 Changed 3 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 3 years ago by timmywil

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.