Last Comment Bug 717826 - implement @important rule to reduce need for redundant !important
: implement @important rule to reduce need for redundant !important
Status: NEW
:
Product: Core
Classification: Components
Component: CSS Parsing and Computation (show other bugs)
: unspecified
: All All
: -- enhancement with 2 votes (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
: Jet Villegas (:jet)
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-01-12 18:04 PST by Felix Miata
Modified: 2013-05-21 08:06 PDT (History)
2 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments

Description Felix Miata 2012-01-12 18:04:52 PST
[As suggested by www-style mailing list thread beginning at: http://lists.w3.org/Archives/Public/www-style/2012Jan/0182.html started by Marat Tanalin]

As it is now, user stylesheet rules that omit !important are all but worthless. This proposal should not be limited to user stylesheets though.

It would be much more usable to have at-rule of the same name to prevent redundant multiple "!important" word duplication.

For example, currently we write:

	#statusbar-display {
		left:  0 !important;
		right: auto !important;
	}

	#statusbar-display .statuspanel-label {
		border-left-style:  none !important;
		border-right-style: solid !important;
	}

Instead we could wrap the rules to one @important rule, thus avoiding repeating "!important" multiple times:

	@important {
		#statusbar-display {
			left:  0;
			right: auto;
		}

		#statusbar-display .statuspanel-label {
			border-left-style:  none;
			border-right-style: solid;
		}
	}
Comment 1 Marat Tanalin | tanalin.com 2012-01-13 00:18:04 PST
Thanks, Felix.

In addition: since the feature is nonstandard yet, it probably should be -moz-prefixed:

	@-moz-important {
		...
	}

Note You need to log in before you can comment on or make changes to this bug.