Switch to `&:extend(.clearfix all)` for clearfix mixin

Original discussion:
https://github.com/less/less.js/issues/1437#issuecomment-21383639.

Since we’re switching to `grunt-contrib-less`, we can take advantage of
newer LESS features than what RECESS supported. Included in that is the
ability to `:extend`, and not only that, but `:extend(.mixin-name
all)`. By doing so, we remove duplicate CSS for all our elements that
were being clearfix-ed.

Fixes #8947, #8968, #8991, #9257, #9268, #9291, #9430, #9604, #9686,
#9929, #10731, #10793, #11305, #11498, #11533, #11570, #11604, #11652.

(dem issues, tho)
This commit is contained in:
Mark Otto 2013-12-08 23:18:28 -08:00
parent 2a4621b71f
commit 0016c17f93
10 changed files with 54 additions and 239 deletions

267
dist/css/bootstrap.css vendored
View File

@ -554,22 +554,6 @@ dd {
.dl-horizontal dd {
margin-left: 180px;
}
.dl-horizontal dd:before,
.dl-horizontal dd:after {
display: table;
content: " ";
}
.dl-horizontal dd:after {
clear: both;
}
.dl-horizontal dd:before,
.dl-horizontal dd:after {
display: table;
content: " ";
}
.dl-horizontal dd:after {
clear: both;
}
}
abbr[title],
abbr[data-original-title] {
@ -684,22 +668,6 @@ pre code {
margin-right: auto;
margin-left: auto;
}
.container:before,
.container:after {
display: table;
content: " ";
}
.container:after {
clear: both;
}
.container:before,
.container:after {
display: table;
content: " ";
}
.container:after {
clear: both;
}
@media (min-width: 768px) {
.container {
width: 750px;
@ -721,42 +689,10 @@ pre code {
margin-right: auto;
margin-left: auto;
}
.container-fluid:before,
.container-fluid:after {
display: table;
content: " ";
}
.container-fluid:after {
clear: both;
}
.container-fluid:before,
.container-fluid:after {
display: table;
content: " ";
}
.container-fluid:after {
clear: both;
}
.row {
margin-right: -15px;
margin-left: -15px;
}
.row:before,
.row:after {
display: table;
content: " ";
}
.row:after {
clear: both;
}
.row:before,
.row:after {
display: table;
content: " ";
}
.row:after {
clear: both;
}
.col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 {
position: relative;
min-height: 1px;
@ -1935,22 +1871,6 @@ textarea.input-lg {
margin-right: -15px;
margin-left: -15px;
}
.form-horizontal .form-group:before,
.form-horizontal .form-group:after {
display: table;
content: " ";
}
.form-horizontal .form-group:after {
clear: both;
}
.form-horizontal .form-group:before,
.form-horizontal .form-group:after {
display: table;
content: " ";
}
.form-horizontal .form-group:after {
clear: both;
}
.form-horizontal .form-control-static {
padding-top: 7px;
}
@ -3113,22 +3033,6 @@ input[type="button"].btn-block {
.btn-group .btn-group + .btn-group {
margin-left: -1px;
}
.btn-toolbar:before,
.btn-toolbar:after {
display: table;
content: " ";
}
.btn-toolbar:after {
clear: both;
}
.btn-toolbar:before,
.btn-toolbar:after {
display: table;
content: " ";
}
.btn-toolbar:after {
clear: both;
}
.btn-toolbar .btn-group {
float: left;
}
@ -3224,22 +3128,6 @@ input[type="button"].btn-block {
width: 100%;
max-width: 100%;
}
.btn-group-vertical > .btn-group:before,
.btn-group-vertical > .btn-group:after {
display: table;
content: " ";
}
.btn-group-vertical > .btn-group:after {
clear: both;
}
.btn-group-vertical > .btn-group:before,
.btn-group-vertical > .btn-group:after {
display: table;
content: " ";
}
.btn-group-vertical > .btn-group:after {
clear: both;
}
.btn-group-vertical > .btn-group > .btn {
float: none;
}
@ -3436,22 +3324,6 @@ textarea.input-group-sm > .input-group-btn > .btn {
margin-bottom: 0;
list-style: none;
}
.nav:before,
.nav:after {
display: table;
content: " ";
}
.nav:after {
clear: both;
}
.nav:before,
.nav:after {
display: table;
content: " ";
}
.nav:after {
clear: both;
}
.nav > li {
position: relative;
display: block;
@ -3645,43 +3517,11 @@ textarea.input-group-sm > .input-group-btn > .btn {
margin-bottom: 20px;
border: 1px solid transparent;
}
.navbar:before,
.navbar:after {
display: table;
content: " ";
}
.navbar:after {
clear: both;
}
.navbar:before,
.navbar:after {
display: table;
content: " ";
}
.navbar:after {
clear: both;
}
@media (min-width: 768px) {
.navbar {
border-radius: 4px;
}
}
.navbar-header:before,
.navbar-header:after {
display: table;
content: " ";
}
.navbar-header:after {
clear: both;
}
.navbar-header:before,
.navbar-header:after {
display: table;
content: " ";
}
.navbar-header:after {
clear: both;
}
@media (min-width: 768px) {
.navbar-header {
float: left;
@ -3696,22 +3536,6 @@ textarea.input-group-sm > .input-group-btn > .btn {
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1);
-webkit-overflow-scrolling: touch;
}
.navbar-collapse:before,
.navbar-collapse:after {
display: table;
content: " ";
}
.navbar-collapse:after {
clear: both;
}
.navbar-collapse:before,
.navbar-collapse:after {
display: table;
content: " ";
}
.navbar-collapse:after {
clear: both;
}
.navbar-collapse.in {
overflow-y: auto;
}
@ -4264,22 +4088,6 @@ textarea.input-group-sm > .input-group-btn > .btn {
text-align: center;
list-style: none;
}
.pager:before,
.pager:after {
display: table;
content: " ";
}
.pager:after {
clear: both;
}
.pager:before,
.pager:after {
display: table;
content: " ";
}
.pager:after {
clear: both;
}
.pager li {
display: inline;
}
@ -4819,22 +4627,6 @@ a.list-group-item-info.active:focus {
.panel-body {
padding: 15px;
}
.panel-body:before,
.panel-body:after {
display: table;
content: " ";
}
.panel-body:after {
clear: both;
}
.panel-body:before,
.panel-body:after {
display: table;
content: " ";
}
.panel-body:after {
clear: both;
}
.panel > .list-group {
margin-bottom: 0;
}
@ -5173,22 +4965,6 @@ button.close {
text-align: right;
border-top: 1px solid #e5e5e5;
}
.modal-footer:before,
.modal-footer:after {
display: table;
content: " ";
}
.modal-footer:after {
clear: both;
}
.modal-footer:before,
.modal-footer:after {
display: table;
content: " ";
}
.modal-footer:after {
clear: both;
}
.modal-footer .btn + .btn {
margin-bottom: 0;
margin-left: 5px;
@ -5608,11 +5384,50 @@ button.close {
}
}
.clearfix:before,
.clearfix:after {
.clearfix:after,
.container:before,
.container:after,
.container-fluid:before,
.container-fluid:after,
.row:before,
.row:after,
.form-horizontal .form-group:before,
.form-horizontal .form-group:after,
.btn-toolbar:before,
.btn-toolbar:after,
.btn-group-vertical > .btn-group:before,
.btn-group-vertical > .btn-group:after,
.nav:before,
.nav:after,
.navbar:before,
.navbar:after,
.navbar-header:before,
.navbar-header:after,
.navbar-collapse:before,
.navbar-collapse:after,
.pager:before,
.pager:after,
.panel-body:before,
.panel-body:after,
.modal-footer:before,
.modal-footer:after {
display: table;
content: " ";
}
.clearfix:after {
.clearfix:after,
.container:after,
.container-fluid:after,
.row:after,
.form-horizontal .form-group:after,
.btn-toolbar:after,
.btn-group-vertical > .btn-group:after,
.nav:after,
.navbar:after,
.navbar-header:after,
.navbar-collapse:after,
.pager:after,
.panel-body:after,
.modal-footer:after {
clear: both;
}
.center-block {

File diff suppressed because one or more lines are too long

View File

@ -37,7 +37,7 @@
// Optional: Group multiple button groups together for a toolbar
.btn-toolbar {
.clearfix();
&:extend(.clearfix all);
.btn-group {
float: left;
@ -157,7 +157,7 @@
// Clear floats so dropdown menus can be properly placed
> .btn-group {
.clearfix();
&:extend(.clearfix all);
> .btn {
float: none;
}

View File

@ -597,14 +597,14 @@
margin-left: auto;
padding-left: (@grid-gutter-width / 2);
padding-right: (@grid-gutter-width / 2);
.clearfix();
&:extend(.clearfix all);
}
// Creates a wrapper for a series of columns
.make-row(@gutter: @grid-gutter-width) {
margin-left: (@gutter / -2);
margin-right: (@gutter / -2);
.clearfix();
&:extend(.clearfix all);
}
// Generate the extra small columns

View File

@ -98,7 +98,7 @@
padding: (@modal-inner-padding - 1) @modal-inner-padding @modal-inner-padding;
text-align: right; // right align buttons
border-top: 1px solid @modal-footer-border-color;
.clearfix(); // clear it in case folks use .pull-* classes on buttons
&:extend(.clearfix all); // clear it in case folks use .pull-* classes on buttons
// Properly space out buttons
.btn + .btn {

View File

@ -15,7 +15,7 @@
border: 1px solid transparent;
// Prevent floats from breaking the navbar
.clearfix();
&:extend(.clearfix all);
@media (min-width: @grid-float-breakpoint) {
border-radius: @navbar-border-radius;
@ -29,7 +29,7 @@
// styling of responsive aspects.
.navbar-header {
.clearfix();
&:extend(.clearfix all);
@media (min-width: @grid-float-breakpoint) {
float: left;
@ -54,7 +54,7 @@
padding-left: @navbar-padding-horizontal;
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255,255,255,.1);
.clearfix();
&:extend(.clearfix all);
-webkit-overflow-scrolling: touch;
&.in {

View File

@ -10,7 +10,7 @@
margin-bottom: 0;
padding-left: 0; // Override default ul/ol
list-style: none;
.clearfix();
&:extend(.clearfix all);
> li {
position: relative;

View File

@ -8,7 +8,7 @@
margin: @line-height-computed 0;
list-style: none;
text-align: center;
.clearfix();
&:extend(.clearfix all);
li {
display: inline;
> a,

View File

@ -15,7 +15,7 @@
// Panel contents
.panel-body {
padding: 15px;
.clearfix();
&:extend(.clearfix all);
}

View File

@ -202,7 +202,7 @@ dd {
}
dd {
margin-left: @component-offset-horizontal;
.clearfix(); // Clear the floated `dt` if an empty `dd` is present
&:extend(.clearfix all); // Clear the floated `dt` if an empty `dd` is present
}
}
}