google-code-export / swfobject

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

Problem swfobject with javascript code use class #553

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

Problem swfobject with multibox javascript code

around the line equivalent at:
#else if (k.toLowerCase() == "styleclass") { // 'class' is an ECMA4 #reserved 
keyword
#                       #e.setAttribute("class", attObj[k]);
                    }

why the interest to put the class attObj[k] at the object element created?

What steps will reproduce the problem?
1. i use a javascript code to reach the element $$('myClass')
2. the problem is the code take the object created by swfobject
3. It s the failure of the code because my code look for a attribute 'rel=' who 
doesn t exist on the swfobject created 

I recommand to delete 
all reference at 
e.setAttribute("class", attObj[k]); 

It s not good to work with other javascript code!!

Simon

Original issue reported on code.google.com by simon.ge...@free.Fr on 23 Apr 2011 at 9:51

GoogleCodeExporter commented 9 years ago
if you specify a class in the attributes object, it will be passed to the 
<object> when it's created.  however, since 'class' is a reserved word, you'd 
have to use 'styleclass' in the attributes object, like this:

var attributes = { styleclass: "myClass" };

which gets passed down as <object class="myClass">

if you need to add the 'rel' attribute, you can do it, too:

var attributes = { styleclass: "myClass", rel: "myRel" };

which gets passed down as <object class="myClass" rel="myRel" >

The e.setAttribute("class", attObj[k]); code you referenced is only used if you 
specify a styleclass in the swfobject attributes object. It should have no 
effect on your 3rd party libraries like jQuery.

This is not a bug in SWFObject

Original comment by platelu...@gmail.com on 16 May 2011 at 5:47