Bug Tracker

Opened 13 years ago

Closed 13 years ago

#5405 closed enhancement (invalid)

Use of "class" key in "attr()" properties object caused Safari to fail to load

Reported by: acoleman616 Owned by:
Priority: major Milestone: 1.4
Component: core Version: 1.3.2
Keywords: attribute, attr, class Cc:
Blocked by: Blocking:

Description

I had the following line of code in my JS file:

$(object).attr({ class: 'myClass' });

It caused Safari to fail to load my entire page. When I changed class to className, it worked:

$(object).attr({ className: 'myClass' });

I feel this should either be well documented or fixed in the code to account for the use of the "class" key name.

Change History (2)

comment:1 Changed 13 years ago by pbcomm

You should use the proper api: .addClass().removeClass()

comment:2 Changed 13 years ago by dmethvin

Resolution: invalid
Status: newclosed

Javascript defines class as a reserved word so it's bad Javascript syntax to say {class: "blah"} regardless of whether jQuery is used on the page or not.

Note: See TracTickets for help on using tickets.