Element.boxWrap convenience tweak - Ext JS

Most of the time, the class is going to be "x-box"...

    boxWrap : function(cls){
        var el = Ext.get(this.insertHtml('beforeBegin', String.format('<div class="{0}"><div class="{0}-tl"><div class="{0}-tr"><div class="{0}-tc"></div></div></div><div class="{0}-ml"><div class="{0}-mr"><div class="{0}-mc"></div></div></div><div class="{0}-bl"><div class="{0}-br"><div class="{0}-bc"></div></div></div></div>', cls)));
        el.child('.'+cls+'-mc').dom.appendChild(this.dom);
        return el;
    },
to

    boxWrap : function(cls){
        var c = cls || 'x-box';
        var el = Ext.get(this.insertHtml('beforeBegin', String.format('<div class="{0}"><div class="{0}-tl"><div class="{0}-tr"><div class="{0}-tc"></div></div></div><div class="{0}-ml"><div class="{0}-mr"><div class="{0}-mc"></div></div></div><div class="{0}-bl"><div class="{0}-br"><div class="{0}-bc"></div></div></div></div>', c)));
        el.child('.'+c+'-mc').dom.appendChild(this.dom);
        return el;
    },
:?:
  # 2  
03-09-2007, 04:23 PM

Nice suggestion. Seems like a no brainer.

你可能感兴趣的:(C++,c,C#,ext)