Closed Bug 1169645 Opened 10 years ago Closed 10 years ago

getAttribute() returns null for attributes containing upper case characters in attribute name

Categories

(Core :: DOM: Core & HTML, defect)

38 Branch
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1165851

People

(Reporter: jrscott, Unassigned)

References

()

Details

(Keywords: testcase)

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.81 Safari/537.36 Steps to reproduce: <input type='text' Choices='abc' maxlength='1' id='foo'> function Validate(){ var choices = document.getElementById('foo').getAttribute('Choices'); ...... } Actual results: choices returns null. When I changed the attribute name to all lower case, I got the expected results. Using $("#foo").attr("Choices") in jQuery I get the same return as document.getElementById('foo'). Expected results: The variable choices should have returned 'abc'. (From what I can tell trying to research this problem, it is occurring everywhere and websites utilizing JavaScript are breaking everywhere.)
Severity: normal → critical
OS: Unspecified → Windows
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0 20150513174244 Works for me. Have you actually tested just the code you posted, without anything else on the page? If yes, please test in a brand new profile. https://support.mozilla.org/kb/profile-manager-create-and-remove-firefox-profiles
Severity: critical → normal
Component: Untriaged → DOM: Core & HTML
Keywords: testcase
OS: Windows → All
Product: Firefox → Core
Hardware: Unspecified → All
I did not, in fact, test the exact code I posted when I created the issue report. That was code simplified from the actual code I had a problem with. I just created a simple test that should have failed and did not. It definitely happens in my "real" code that would not be at all convenient to share since it depends on a lot of other moving parts. Others have reported the same symptoms however, so I ask you not to close this issue just yet. I will look through my production code and try to find out what else happens to trigger the behavior I have reported and try to create a test case that fails so you can find this. Give me a couple of hours.
Ok, I see what happened in the real code. I used createAttribute() and setNamedAttribute() (code was written 8 years ago). That function has been deprecated, but should still function properly and still needs fixing. I will attach a test case to show you what is actually occurring.
Attached file createAttributeError.html (deleted) —
John, thanks for hunting that down. This is the same as bug 1165851, then. Per the spec for createAttribute what you're doing should in fact not work (because createAttribute creates the attribute with that case, but getAttribute lower-cases its argument before doing case-sensitive compares), but it sounds like the spec needs changing...
Blocks: 1075702
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: