2

I have a HTML file like this:

<html>
<head>
    <title>Test</title>
    <script language="javascript">
    function removeElements() {
        alert( document.getElementById("FileArea").innerHTML );
        var RemoveElms = document.getElementsByTagName("p");
        for (i = 0; i < RemoveElms.length; ++i) {
            var newelm = document.createElement("SubScript");
            newelm.innerHTML = "1";
            RemoveElms[i].parentNode.insertBefore(newelm, RemoveElms[i]);
        }
        alert( document.getElementById("FileArea").innerHTML );
    }
    </script>

</head>
<body id="BodyID">
    <h2>Test</h2>
    <input type="button" value="Remove elements" onmousedown="removeElements(); return false" unselectable="on">
    <div id="FileArea"><p>Here is a test</p></div>

</body>

I am trying to add an element <SuperScript>. In the alert all the characters of this element changed into lowercase <superscript>. Can I control this? This is mainly happening in Chrome.

Dominic
  • 77
  • 10

1 Answers1

1

Chrome parses all elements and adds them to the document in an uniform way. This also happens with newlines and such.

See this: Case conventions on element names?

Community
  • 1
  • 1
  • 1
    On searching SOverflow before posting this Q I came across that page. But how do I retain the Camelcase in DOM/JScript? – Dominic Feb 28 '13 at 11:52
  • (old question but still relevant) The issue is with Chrome (and now everything *is* chrome) converting everything to lowercase but retaining a case-sensitive JS name match. Eg. if the server returns a header "Foo", it's internally "foo", but any JS [ response.getResponseHeader.Foo ] will no longer match because Chrome screwed with the response. – Ricky Nov 01 '22 at 02:49