Bug Tracker

Ticket #12072 (closed bug: fixed)

Opened 2 years ago

Last modified 7 months ago

Remove Firefox deprecated nodeValue, getAttributeNode, specified

Reported by: dmethvin Owned by: timmywil
Priority: high Milestone: 1.10/2.0
Component: attributes Version: 1.7.2
Keywords: Cc:
Blocking: Blocked by:

Description

Firefox 13 generates a pretty large set of warnings in our attribute unit tests:

Use of getAttributeNode() is deprecated. Use getAttribute() instead.
Use of attributes' nodeValue attribute is deprecated. Use value instead.
Use of document.createAttribute() is deprecated. Use element.setAttribute() instead.
Use of attributes' specified attribute is deprecated. It always returns true.

The fact that .specified is already broken may already be causing some bugs. We should either 1) remove these uses entirely or 2) feature test them so we don't use them in browsers where they're unsupported.

Ideally we'd have a way to do that feature testing without making Firefox blurt something out on the console. People are really sensitive about that, and no amount of reasoning will make them understand that a warning does not equate to an error. See #4774, #7291, #7535, and #10531 for example.

Change History

comment:1 Changed 2 years ago by dmethvin

  • Priority changed from undecided to high
  • Status changed from new to open
  • Component changed from unfiled to attributes
  • Milestone changed from None to 1.9

comment:2 Changed 2 years ago by dmethvin

#11397 is a duplicate of this ticket.

comment:3 Changed 2 years ago by dmethvin

#12162 is a duplicate of this ticket.

comment:4 Changed 2 years ago by dmethvin

  • Summary changed from Remove/avoid deprecated attribute features to Remove Firefox deprecated nodeValue, getAttributeNode, specified

comment:5 Changed 2 years ago by timmywil

The only codepath in 1.8 that I can find that uses getAttributeNode in Firefox is the propHook for tabIndex. That could use a feature detect.

comment:6 Changed 2 years ago by timmywil

Also, the option valHook uses the attributes property, which is sort of the feature detect itself. However, even with the warning and specified always being true, that valHook will continue working. We could still adjust it if we want.

comment:7 Changed 2 years ago by timmywil

Btw, Neither event.js nor native Sizzle uses the attributes property in FF anymore.

comment:8 Changed 2 years ago by dmethvin

We're using .specified in Sizzle.attr, which according to the Firefox docs always returns true now. The boolHook is using .nodeValue.

comment:9 Changed 2 years ago by timmywil

@dmethvin: Actually, none of that is true.

As far as Sizzle.attr, notice that assertAttributes is true in Firefox so specified would never be used.

For the boolHook, typeof property is always "boolean" in Firefox so it would never get to it.

comment:10 Changed 2 years ago by dmethvin

Hmm, I see what you mean, it shouldn't be reaching those. So I wonder where are all these warnings coming from? I can't rebuild from master atm, so maybe this was for older code. How many warnings are you seeing in Firefox?

comment:11 Changed 2 years ago by timmywil

@dmethvin: As I said, the propHook for tabindex and the valHook for option elements. The latter is the use case for both of the tickets marked as duplicates of this ticket. There may be other cases that I missed, but I'm confident that if we adjust those two cases, we wouldn't see warnings anymore.

comment:12 Changed 2 years ago by timmywil

  • Owner set to timmywil
  • Status changed from open to assigned

comment:13 Changed 21 months ago by rhujer@…

Experiencing this issue too. Is there any progress in the last three months?

comment:14 Changed 21 months ago by jure.mav@…

Any progress on this issue?

comment:15 Changed 21 months ago by dmethvin

jure.mav, I don't know. Do you have some code to contribute?

comment:16 Changed 20 months ago by KP

I don't see any of these errors anymore in FF.

comment:17 Changed 20 months ago by dmethvin

These still occur in 1.9pre if "Show JavaScript Warnings" are enabled in Firefox 17.

 http://i.imgur.com/ugHiT.png

@timmywil can you take a look?

comment:18 Changed 20 months ago by timmywil

Yea, I need to get on top of this. Will do tomorrow morning.

comment:19 Changed 19 months ago by dmethvin

  • Milestone changed from 1.9 to 1.9.1

@timmywil another ping on this one, sorry. I'd like to get it wrapped up for 1.9.1 if possible.

comment:20 Changed 18 months ago by prashant sharma

@timmywil :- any updates on this one. Sorry to bug you for this bug :)

comment:21 Changed 18 months ago by dmethvin

  • Milestone changed from 1.9.1 to None

comment:22 Changed 18 months ago by timmywil

#13612 is a duplicate of this ticket.

comment:23 Changed 17 months ago by anonymous

Any news on that?

comment:24 Changed 17 months ago by anonymous

"I don't see any of these errors anymore in FF." - I don't know how that's possible. I see this error all the time in every version of Firefox I work with. Would be really good if someone have fixed that :)

comment:25 Changed 17 months ago by anonymous

There was no error in FF 19, but in FF 20 it showed up.

comment:26 Changed 17 months ago by anonymous

I'm seeing this error in Firefox 20

comment:27 Changed 17 months ago by Timmy Willison

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

Remove unnecessary usage of getAttributeNode(). Fixes #12072.

Changeset: 3ef7a9683b95fa334ab75458a531bb263782c748

comment:28 follow-up: ↓ 29 Changed 17 months ago by timmywil

  • Milestone changed from None to 1.10/2.0

comment:29 in reply to: ↑ 28 Changed 15 months ago by anonymous

Replying to timmywil: I still see this error in Firefox 21, jQuery 2.0.

comment:30 Changed 15 months ago by dmethvin

Try running without any add-ons. If you can repro without any add-ons using a page that simply includes jQuery, let us know.

comment:31 Changed 14 months ago by anonymous

Call to .specified near line...

jquery.js - Line: 2271

jQuery.extend({valHooks: {option: {get: function( elem ) {

attributes.value is undefined in Blackberry 4.7 but uses .value. See #6932 var val = elem.attributes.value;

return !val
val.specified ? elem.value : elem.text;

comment:32 follow-up: ↓ 33 Changed 14 months ago by dmethvin

@anonymous:31, do you have code that runs in Firefox that gets to this line? Can you share it?

comment:33 in reply to: ↑ 32 ; follow-up: ↓ 34 Changed 14 months ago by anonymous

Replying to dmethvin:

@anonymous:31, do you have code that runs in Firefox that gets to this line? Can you share it?

Apologies:

I went to put together a minimal test case to reproduce the error...and naturally double checked to make sure I was running the latest versions...and oops Feb.2013...So sorry...I see now the code has been modified in v1.10.1

comment:34 in reply to: ↑ 33 Changed 14 months ago by anonymous

Replying to anonymous:

Replying to dmethvin:

@anonymous:31, do you have code that runs in Firefox that gets to this line? Can you share it?

Apologies:

I went to put together a minimal test case to reproduce the error...and naturally double checked to make sure I was running the latest versions...and oops Feb.2013...So sorry...I see now the code has been modified in v1.10.1

v1.10.1 testing all good now.

comment:35 follow-up: ↓ 36 Changed 7 months ago by Erwan Legrand

I can reproduce this with jQuery-2.0.3 without any add-on:  http://jsfiddle.net/NKBRe/1/

(The issue appears to be fixed in 1.10.1, though.)

comment:36 in reply to: ↑ 35 Changed 7 months ago by m_gol

Replying to Erwan Legrand:

I can reproduce this with jQuery-2.0.3 without any add-on:  http://jsfiddle.net/NKBRe/1/

(The issue appears to be fixed in 1.10.1, though.)

Works fine on master:  http://jsfiddle.net/NKBRe/3/ Please, always test on  https://code.jquery.com/jquery-git2.js before reporting; on jsFiddle you can even choose "jQuery 2.x (edge)" from the list.

Note: See TracTickets for help on using tickets.