robnyman / domassistant

Automatically exported from code.google.com/p/domassistant
1 stars 0 forks source link

setAttributes change all attributes names to lower case #13

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

var x=DOMAssistant.Content.create("div");
x.setAttributes({"camelCaseAttr":"foo"});
alert(x.attributes[0].nodeName);

What is the expected output? What do you see instead?

nodeName should be
camelCaseAttr
while appear as
camelcaseattr

What version of the product are you using? On what operating system?
DOMAssistantComplete-2.7.1.1.js
linux
firefox 3

Please provide any additional information below.

In XML attributes are case sensitive, so they shouldn't be changed
automatically to lowercase. The bug is due to the use of
setAttribute
which, in firefox at least, lower each attribute name.

The use of
setAttributeNS
using the default namespace like in
setAttributeNS(null,"camelCaseAttr","foo")
solves the problem

however setAttributeNS is not available in explorer 6

Original issue reported on code.google.com by riqu...@gmail.com on 7 Aug 2008 at 5:34

GoogleCodeExporter commented 9 years ago
If you have the HTML code 

<div ID="x" camelCaseAttr="foo"></div>

DOM inspection reveals that all attributes are actually created in lower case, 
so you
get attributes[0].nodeName == "id" and attributes[1].nodeName == 
"camelcaseattr".

As such, it does not seem useful for DOMAssistant to hack around the case issue 
when
the whole DOM tree is representing its attributes in lowercase.

Original comment by chengh...@gmail.com on 8 Aug 2008 at 12:48