google-code-export / swfobject

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

you may use 'class' instead of styleclass #512

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
From the documentation:

"styleclass (used instead of class, because this is also an ECMA4 reserved 
keyword)"

Don't you know that the following is legal in JavaScript?

var o = { 'class' : '' }
alert( o['class'] )

There is no ECMA4 keyword used.

Original issue reported on code.google.com by she...@coolpage.com on 24 Oct 2010 at 12:25

GoogleCodeExporter commented 9 years ago
Deprecate styleclass and allow class.  styleclass is a semantic obfuscation 
(isn't even clear whether it means style or class or some strange thing that is 
both).

Original comment by she...@coolpage.com on 24 Oct 2010 at 12:28

GoogleCodeExporter commented 9 years ago
Hi Shelby

No change is required to the codebase to use the word "class", you can already 
use it.

Your points are valid. The documentation can be changed to reflect what you've 
said.

To add a note in defense of 'styleclass':  many newbie JavaScripters don't know 
the difference between o['class'] and o.class. The former will work in all 
browsers while the latter will throw an error in IE. It's often easier to 
simply have them avoid using the 'class' keyword in the first place.  

SWFObject doesn't prevent the use of the 'class' keyword, but simply adds a 
checker for the term 'styleclass' and replaces it with the appropriate usage of 
'class'.

Original comment by platelu...@gmail.com on 8 Nov 2010 at 7:12

GoogleCodeExporter commented 9 years ago
Updated the documentation to clarify usage of "class" and styleclass 

Original comment by platelu...@gmail.com on 18 May 2011 at 3:52