Results 1 to 2 of 2

Thread: Best performance: element.applyStyles VS native style definition

  1. #1
    Sencha User
    Join Date
    Oct 2010
    Location
    Vitoria-Gasteiz (Spain)
    Posts
    55
    Vote Rating
    0
      0  

    Default Best performance: element.applyStyles VS native style definition

    Hi,

    I was wondering what I should use to change the style of the DOM element dinamically in a best way:

    First:
    Code:
    element.applyStyles({
        backgroundColor:'red',
        cursor:'default'
    });
    Second:
    Code:
    element.dom.style.backgroundColor = 'red';
    element.dom.style.cursor= 'default';
    Maybe there is a better way...

    Thanks,

    Luca

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Vote Rating
    1272
      0  

    Default

    Technically CSS would be faster. Second fastest is native except that if you are wanting to get the styles it is cached by Ext JS so then it would be faster to do it in Ext JS.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •