Conditionally lowered specificity of disabled inputs

Merged styles under conditions to trim the filesize a little bit and improve parsing.
This commit is contained in:
Angelos Chalaris 2017-06-05 17:42:59 +03:00
parent 826dab1ecd
commit 3bf8a25811
6 changed files with 25 additions and 28 deletions

11
dist/mini-default.css vendored
View file

@ -778,11 +778,6 @@ input:not([type="button"]):not([type="submit"]):not([type="reset"]):hover, input
box-shadow: none; box-shadow: none;
} }
input:not([type="button"]):not([type="submit"]):not([type="reset"]):disabled, input:not([type="button"]):not([type="submit"]):not([type="reset"])[disabled], textarea:disabled, textarea[disabled], select:disabled, select[disabled] {
cursor: not-allowed;
opacity: 0.75;
}
input:not([type="button"]):not([type="submit"]):not([type="reset"]):invalid, input:not([type="button"]):not([type="submit"]):not([type="reset"]):focus:invalid, textarea:invalid, textarea:focus:invalid, select:invalid, select:focus:invalid { input:not([type="button"]):not([type="submit"]):not([type="reset"]):invalid, input:not([type="button"]):not([type="submit"]):not([type="reset"]):focus:invalid, textarea:invalid, textarea:focus:invalid, select:invalid, select:focus:invalid {
border-color: #d32f2f; border-color: #d32f2f;
box-shadow: none; box-shadow: none;
@ -851,11 +846,7 @@ a[role="button"]:focus, label[role="button"]:hover, label[role="button"]:focus,
opacity: 1; opacity: 1;
} }
button:disabled, button[disabled], [type="button"]:disabled, [type="button"][disabled], [type="submit"]:disabled, [type="submit"][disabled], [type="reset"]:disabled, [type="reset"][disabled], input:disabled, input[disabled], textarea:disabled, textarea[disabled], select:disabled, select[disabled], button:disabled, button[disabled], .button:disabled, .button[disabled], [role="button"]:disabled, [role="button"][disabled] {
a.button:disabled,
a.button[disabled], label.button:disabled, label.button[disabled], .button:disabled, .button[disabled],
a[role="button"]:disabled,
a[role="button"][disabled], label[role="button"]:disabled, label[role="button"][disabled], [role="button"]:disabled, [role="button"][disabled] {
cursor: not-allowed; cursor: not-allowed;
opacity: 0.75; opacity: 0.75;
} }

File diff suppressed because one or more lines are too long

11
dist/mini-lite.css vendored
View file

@ -746,11 +746,6 @@ input:not([type="button"]):not([type="submit"]):not([type="reset"]):hover, input
box-shadow: none; box-shadow: none;
} }
input:not([type="button"]):not([type="submit"]):not([type="reset"]):disabled, input:not([type="button"]):not([type="submit"]):not([type="reset"])[disabled], textarea:disabled, textarea[disabled], select:disabled, select[disabled] {
cursor: not-allowed;
opacity: 0.75;
}
input:not([type="button"]):not([type="submit"]):not([type="reset"]):invalid, input:not([type="button"]):not([type="submit"]):not([type="reset"]):focus:invalid, textarea:invalid, textarea:focus:invalid, select:invalid, select:focus:invalid { input:not([type="button"]):not([type="submit"]):not([type="reset"]):invalid, input:not([type="button"]):not([type="submit"]):not([type="reset"]):focus:invalid, textarea:invalid, textarea:focus:invalid, select:invalid, select:focus:invalid {
border-color: #d32f2f; border-color: #d32f2f;
box-shadow: none; box-shadow: none;
@ -819,11 +814,7 @@ a[role="button"]:focus, label[role="button"]:hover, label[role="button"]:focus,
opacity: 1; opacity: 1;
} }
button:disabled, button[disabled], [type="button"]:disabled, [type="button"][disabled], [type="submit"]:disabled, [type="submit"][disabled], [type="reset"]:disabled, [type="reset"][disabled], input:disabled, input[disabled], textarea:disabled, textarea[disabled], select:disabled, select[disabled], button:disabled, button[disabled], .button:disabled, .button[disabled], [role="button"]:disabled, [role="button"][disabled] {
a.button:disabled,
a.button[disabled], label.button:disabled, label.button[disabled], .button:disabled, .button[disabled],
a[role="button"]:disabled,
a[role="button"][disabled], label[role="button"]:disabled, label[role="button"][disabled], [role="button"]:disabled, [role="button"][disabled] {
cursor: not-allowed; cursor: not-allowed;
opacity: 0.75; opacity: 0.75;
} }

File diff suppressed because one or more lines are too long

View file

@ -1212,3 +1212,4 @@
- Refer to above list in regards to the #19 feature request. - Refer to above list in regards to the #19 feature request.
- Reworked complex `tab` module selectors to utilize the functionality of `:not(:first-of-type)` on `label` elements. - Reworked complex `tab` module selectors to utilize the functionality of `:not(:first-of-type)` on `label` elements.
- Updated `tab` selectors to use new, *loose* definitions, effectively making the module `0.04KB` lighter. Not a huge difference, but good enough due to the maintenance impact it has on the module, plus the consistency fixed for `.stacked`. - Updated `tab` selectors to use new, *loose* definitions, effectively making the module `0.04KB` lighter. Not a huge difference, but good enough due to the maintenance impact it has on the module, plus the consistency fixed for `.stacked`.
- Moved `input_control`'s `disabled` styling to low-specificity behind the existing flag, saved another `0.05KB`, which is quite a big change. Parsing should also be faster than before. Good catch, **hugging cat**!

View file

@ -187,10 +187,12 @@ input:not([type]), [type="text"], [type="email"], [type="number"], [type="search
border-color: $input-focus-border-color; border-color: $input-focus-border-color;
box-shadow: none; box-shadow: none;
} }
@if $input-high-specificity-selectors or $input-disabled-opacity != $button-disabled-opacity {
&:disabled, &[disabled] { &:disabled, &[disabled] {
cursor: not-allowed; cursor: not-allowed;
opacity: $input-disabled-opacity; opacity: $input-disabled-opacity;
} }
}
&:invalid, &:focus:invalid{ &:invalid, &:focus:invalid{
border-color: $input-invalid-border-color; border-color: $input-invalid-border-color;
box-shadow: none; box-shadow: none;
@ -265,11 +267,23 @@ a[role="button"], label[role="button"], [role="button"] {
opacity: 1; opacity: 1;
} }
} }
@if $input-high-specificity-selectors or $input-disabled-opacity != $button-disabled-opacity {
&:disabled, &[disabled] { &:disabled, &[disabled] {
cursor: not-allowed; cursor: not-allowed;
opacity: $button-disabled-opacity; opacity: $button-disabled-opacity;
} }
} }
}
@if not $input-high-specificity-selectors {
@if $input-disabled-opacity == $button-disabled-opacity {
input, textarea, select, button, .#{$button-class-name}, [role="button"] { // .button[disabled] is actually higher specificity than a.button, so no need for more than that
&:disabled, &[disabled] {
cursor: not-allowed;
opacity: $button-disabled-opacity;
}
}
}
}
@if $style-link-active-state { @if $style-link-active-state {
a.#{$button-class-name}:active, a[role="button"]:active { a.#{$button-class-name}:active, a[role="button"]:active {
background: rgba($button-back-color, $button-hover-back-opacity); background: rgba($button-back-color, $button-hover-back-opacity);