Skip to main content

Bug Tracker

Side navigation

#9804 closed enhancement (worksforme)

Opened July 12, 2011 07:04AM UTC

Closed July 25, 2011 11:37AM UTC

Last modified March 14, 2012 04:40AM UTC

.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:
Description

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

Attachments (0)
Change History (4)

Changed July 12, 2011 02:27PM UTC by rwaldron comment:1

component: unfiledattributes
owner: → 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.

Changed July 12, 2011 02:50PM UTC by gulgil comment:2

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

Changed July 25, 2011 11:37AM UTC by addyosmani comment:3

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.

Changed July 25, 2011 01:01PM UTC by rwaldron comment:4

@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.