Opened 12 years ago

Closed 12 years ago

#9903 closed defect (invalid)

dojo.create with "class" attribute fails in IE

Reported by: olore Owned by: anonymous
Priority: high Milestone: tbd
Component: General Version: 1.3.2
Keywords: Cc:
Blocked By: Blocking:


Setting "class" via dojo.attr works (see workarond below) as was fixed in #6957, however dojo.create with a "class" attribute fails with "Expected identifier, string or number"


                function bug() {
                        var node = dojo.create("div", {
                                id: "mytest"
                                , class: "myclass" //Results in "Expected identifier, string or number"
                                , innerHTML : 'Test 123'
                        alert("this won't alert in IE6");


                function workaround() {
                        var node = dojo.create("div", {
                                id: "mytest"
                                , innerHTML : 'Test 123'
                        //set "class" via dojo.attr
                        dojo.attr(node, "class", "myclass");

Change History (1)

comment:1 Changed 12 years ago by dante

Resolution: invalid
Status: newclosed

class is a reserved word, and IE throws that error anytime it encounters the word class unquoted. Because of this, if you use className:"foo" your test [should] work. (className is the appropriate attribute to set for class="" values.) other reserved words IE dies on: "for", "default", "float" to name a couple.

Note: See TracTickets for help on using tickets.