Bug Tracker

Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#9804 closed enhancement (worksforme)

.attr() takes only lowercase attribute names (in IE)

Reported by: gulgil Owned by: gulgil
Priority: low Milestone: None
Component: attributes Version: 1.6.2
Keywords: Cc:
Blocked by: Blocking:


By a random accident I put in "ID" (uppercase) as an attribute name and apparently IE8 and IE9 won't accept that. FF and Crome have no problem... Attributes should be case-insensitive, thou it is recommended to use lowercase by W3.

Example can be seen here: http://demo.athena-cms.dk/jqueryAttrTest.html

In short it is these 2 lines that fails div.attr("ID", "testID1") alert($(this).attr("ID"))

In IE you will get an empty value. Change "ID" to "id" and it works.

I propose a toLowerCase function to always be used on attribute names. At least in IE browsers...

Change History (4)

comment:1 Changed 8 years ago by Rick Waldron

Component: unfiledattributes
Owner: set to gulgil
Priority: undecidedlow
Status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a reduced jsFiddle test case to help us assess your ticket! If you could transfer your test to jsfiddle - that would be fantastic.

Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, I've created this boilerplate: http://jsfiddle.net/rwaldron/da3nM/ Open the link and click to "Fork" in the top menu.

comment:2 Changed 8 years ago by gulgil

Status: pendingnew

I did create create a jsFiddle here: http://jsfiddle.net/JMMfU/

But that works, so I could not use it.

Im new to jsFiddle, so maby it can create a real test page, that will fail. I just dont know how... It was easier for me to create a real page, than using hours to find out how jsFiddle works...

comment:3 Changed 8 years ago by addyosmani

Resolution: worksforme
Status: newclosed

As we've been unable to reproduce the issue you've described on jsFiddle.net using jQuery (edge/git) and it's been almost two weeks since the last response on this ticket, we're going to be closing it as worksforme. If you're able to provide us with additional information, test cases that can reproduce the behaviour experienced etc. we'll be happy to take another look at this.

comment:4 Changed 8 years ago by Rick Waldron

@gulgil jsFiddle is the easiest way for us to review code that is reported to be buggy. It's quite easy to get started if you use the boilerplate that i provided in my first comment.

Note: See TracTickets for help on using tickets.