Results 1 to 3 of 3

Thread: Abuse of !important in theme styles

    Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-7440 in 4.2.0.663.
  1. #1
    Sencha User
    Join Date
    Jul 2011
    Location
    San Francisco, CA
    Posts
    103
    Vote Rating
    7
      2  

    Default Abuse of !important in theme styles

    REQUIRED INFORMATIONExt version tested:
    • Ext 4.1.0
    Browser versions tested against:
    • Chrome
    • IE8/9
    DOCTYPE tested against:
    • irrelevant
    Description:
    • In styling framework code, !important flags used in places that don't seem necessary. e.g. See it used in grid icon styles:
      Code:
          //grid icons
          .#{$prefix}tbar-page-first {
              background-image: theme-background-image($theme-name, 'grid/page-first.gif') !important;
          }
      
      
          .#{$prefix}tbar-loading {
              background-image: theme-background-image($theme-name, 'grid/refresh.gif') !important;
          }
      toolbar bg styles:
      Code:
          @if not $supports-gradients or $compile-all {
              @if $background-gradient != null {
                  .#{$prefix}nlg {
                      .#{$prefix}toolbar-#{$ui} {
                          background-image: theme-background-image($theme-name, 'toolbar/toolbar-#{$ui}-bg.gif') !important;
                          background-repeat: repeat-x;
                      }
                  }
              }
          }
    • This makes it harder for us to write rules to override those bg with our own, since we have to put !important to beat the specificity. Also it's impossible to use Compass spriting mixins to override those icons.
    Possible fix:
    • Remove !important flags in framework code to make code more extensible and reduce specificity wars.
    Operating System:
    • Win 7

  2. #2
    Sencha User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    18,968
    Vote Rating
    931
      0  

    Default

    I doubt we'll be able to remove them all, but it's something worth looking into.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  3. #3
    Sencha User Phil Guerrant's Avatar
    Join Date
    May 2011
    Location
    Colorado
    Posts
    352
    Vote Rating
    104
      0  

    Default

    As of 4.2.0 we've removed most all of the unnecessary !important rules. There are a few exceptions that remain, but most all of them have a good reason to be there. Marking this one as fixed.
    Phil Guerrant
    Ext JS - Development Team

Tags for this Thread

Posting Permissions

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