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 User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,050
    Vote Rating
    1381
      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
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    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
  •