1. #1
    Ext JS Premium Member
    Join Date
    Feb 2010
    Location
    Vancouver, BC
    Posts
    216
    Vote Rating
    1
    rkim is on a distinguished road

      0  

    Post valid id

    Below is the code from extjs 4.1 RC3 api.
    Looking at validIdRe, you guys are disallowing id start with number. Is there any reason for this?

    {
    xtype:"panel",
    id:"099890-333"
    }


    Code:
     escapeId: (function()
    {
            var validIdRe = /^[a-zA-Z_][a-zA-Z0-9_\-]*$/i,
                escapeRx = /([\W]{1})/g,
                escapeFn = function(match, capture){
                    return "\\" + capture;
                };
    
            return function(id) {
                return validIdRe.test(id)
                    ? id
                    : id.replace(escapeRx, escapeFn);
            };
        }())

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,341
    Vote Rating
    490
    scottmartin has a spectacular aura about scottmartin has a spectacular aura about scottmartin has a spectacular aura about

      0  

    Default

    We are just following the rules

    ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".")

    Regards,
    Scott.

  3. #3
    Ext JS Premium Member
    Join Date
    Feb 2010
    Location
    Vancouver, BC
    Posts
    216
    Vote Rating
    1
    rkim is on a distinguished road

      0  

    Default

    Thanks...

    Quote Originally Posted by scottmartin View Post
    We are just following the rules

    ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".")

    Regards,
    Scott.

Thread Participants: 1