Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Dec 2007
    Posts
    23
    Vote Rating
    0
    kyr0 is on a distinguished road

      0  

    Default [FIXED]Patch for Ext.core.Element.removeCls

    [FIXED]Patch for Ext.core.Element.removeCls


    Hi!

    I traced a bug through the library back to the core method named above.
    The bug can be recognized in action in the pagination examples of Ext4 pr1 for example.
    You will see that the prev,next,first,last buttons will not be en/disabled either if the
    store has more items to display etc.

    This behaviour belongs to the fact that Ext.Component's this.disabledCls can be consist of more than
    one CSS class name. e.g. "x4-btn-disabled x4-btn-toolbar-disabled". This is e.g. the case when
    components get encapsulated in container instances. (like here: Button in PaginationToolbar)

    Ext.Container calls enable() and disable() correctly, but the internal call to this.el.removeCls()
    has no effect since removeCls() does checking, if the given class name is an Array but doesn't split class name lists, devided by spaces before.

    Currently the code is (pr1):

    if (!Ext.isArray(className)){
    className = [className];
    }

    You can imagine that this will not work with class names given as string but devided with spaces, since the following code of the methods expects each CSS class name to be _single_ class name inside of the className Array.

    To fix that, simply replace this line by:
    className = className.split(spacesRe);

    Also you should add a check for undefined input values before checking className to be Array or not,
    since Ext.Component can provide implicit this.el.removeCls(undefined); (which seems to be another bug at the other hand..)

    The patched method fixes all multiple-encapsulated enable()/disable() component bugs in ExtJS4 pr-1:

    /**
    * Removes one or more CSS classes from the element.
    * @param {String/Array} className The CSS class to remove, or an array of classes
    * @return {Ext.core.Element} this
    */
    removeCls : function(className){
    var me = this,
    i,
    idx,
    len,
    cls,
    elClasses;

    if (!Ext.isDefined(className)) {
    return me;
    }
    if (!Ext.isArray(className)){
    className = className.split(spacesRe);
    }
    if (me.dom && me.dom.className) {
    elClasses = me.dom.className.replace(trimRe, '').split(spacesRe);
    for (i = 0, len = className.length; i < len; i++) {
    cls = className[i];
    if (typeof cls == 'string') {
    cls = cls.replace(trimRe, '');
    idx = Ext.Array.indexOf(elClasses, cls);
    if (idx != -1) {
    elClasses.splice(idx, 1);
    }
    }
    }
    me.dom.className = elClasses.join(" ");
    }
    return me;
    },


    You will find this method in pr1 in the core-debug and core-debug-sandbox files at e.g line: 10070.

    Hope I saved a little of your time && enjoy!

    Best regards from munich,
    Aron

  2. #2
    Sencha User
    Join Date
    Dec 2007
    Posts
    23
    Vote Rating
    0
    kyr0 is on a distinguished road

      0  

    Default


    Okay - pr2 solves the bug in nearly the same approach =)
    Good work!

    Thread can be closed.

    Best regards,
    Aron

Similar Threads

  1. [FIXED]Ext.core.Element.removeCls issue
    By Greendrake in forum Ext:Bugs
    Replies: 1
    Last Post: 19 Feb 2011, 4:17 AM
  2. [FIXED][CORE 3.0r114] Bug report and patch
    By andrebraga in forum Ext 3.x: Bugs
    Replies: 7
    Last Post: 16 Dec 2009, 4:36 AM
  3. [FIXED][3.0 Core svn310] Element
    By stever in forum Ext 3.x: Bugs
    Replies: 4
    Last Post: 21 May 2009, 5:09 PM
  4. [FIXED][Core 3.0 Beta] Element InsertAfter IE6
    By Rowan in forum Ext 3.x: Bugs
    Replies: 3
    Last Post: 20 May 2009, 12:32 AM
  5. Replies: 1
    Last Post: 21 Apr 2009, 8:00 AM
Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi