That sounds good and inline with what Raymond started with his TenplateDesigner, which is very close to be a DynCSSClass.
Raymond, are you planning on continuing in that direction ?


Benoit

On Tuesday, March 4, 2003, at 04:15 PM, Joshua Kifer wrote:

How about some methods to add and remove style classes from divs?

Such as:

in DynLayer constructor:
this.styleClasses = [];

in child constructor:
this._applyStyleClasses();

DynLayer.prototype._applyStyleClasses = function()  // private
{
  var str = "";
  for (var i = 0; i < this.styleClasses.length; i++) {
    if (i > 0) str += " ";
    str += this.styleClasses[i];
  }
  this.elm.className = str;
};

DynLayer.prototype.addStyleClass = function(cls)
{
  this.styleClasses[this.styleClasses.length] = cls;
  if (this.elm != null) {
    this._applyStyleClasses();
  }
};

DynLayer.prototype.removeStyleClass = function(cls)
{
  var classes = [];
  for (var i = 0; i < this.styleClasses.length; i++) {
    if (this.styleClasses[i] != cls) {
      classes[classes.length] = this.styleClasses[i];
    }
  }
  this.styleClasses = classes;
  if (this.elm != null) {
    this._applyStyleClasses();
  }
};

-------------------
"The key to performance is elegance, not battalions of special cases."
- Jon Bentley and Doug McIlroy



-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. > www.etnus.com
_______________________________________________
Dynapi-Dev mailing list
[EMAIL PROTECTED]
http://www.mail-archive.com/[EMAIL PROTECTED]/





-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com
_______________________________________________
Dynapi-Dev mailing list
[EMAIL PROTECTED]
http://www.mail-archive.com/[EMAIL PROTECTED]/

Reply via email to