Menu

#257 Style and Class confusion

open
nobody
5
2005-08-31
2005-08-31
No

dynlayer_base.js contains this code:

p.setClass = function(c,noInlineStyle){
this._className=c;
if(this.css) this.css.className=cn;
else {
this._cssClass=(c)? 'class="'+c+'"':'';
this._noStyle=noInlineStyle;
}
};

This function is doing two different and unrelated things:
1. it is setting the _className attibute of the
DynObject. This is normally set in the
DynObject.setPrototype method and I see no reason why
it should ever change. The _className attribute
indicates a DynObjects type.
2. it also sets the className attribute of the
stylesheet object that belongs to the DOM element
associated with the DynLayer object.

The setClass method should do 2 and not 1. When I want
to alter the appearance of an element by changing its
style, I should not be forced to also change the
DynLayers object type.

p.setClass = function(c,noInlineStyle){
if(this.css) this.css.className=cn;
else {
this._cssClass=(c)? 'class="'+c+'"':'';
this._noStyle=noInlineStyle;
}
};

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.