if ( this.maxwidth < width ) this.maxwidth=width; this.axis = a; this.sizeAxis = a == "x" ? "width" : "height" this.updateDelegate.register( newsub, "on" + this.sizeAxis); this.updateDelegate.register( newsub, "onvisible" ); //this is an optimization to avoid calling update in the simple case //where a single subview was just added if ( ! this.locked && this.subviews.length ){ var s= this.subviews[ this.subviews.length-1 ]; var p = s[ this.axis ] + s[ this.sizeAxis ] + this.spacing; newsub.setAttribute( this.axis , p ) ; } this.counter += 1; if( this.counter % 2 == 1 ) setMaxwidth(newsub["width"]); super.addSubview( newsub );