Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit fbb6b28

Browse files
jelbournThomasBurleson
authored andcommitted
fix(css): remove styles that could apply to user-controlled elements.
BREAKING CHANGE: modify scope of `box-sizing: border-box` to be specific to only to elements owned by ngMaterial. Before: ```css *,*:before,*:after { box-sizing: border-box; } .md-container { } ``` After ```css .md-container { box-sizing: border-box; } ``` Refs #3516. Closes #4222
1 parent 912bcef commit fbb6b28

File tree

5 files changed

+14
-28
lines changed

5 files changed

+14
-28
lines changed

src/components/button/button.scss

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,6 @@ $icon-button-margin: rem(0.600) !default;
5757
transition: box-shadow $swift-ease-out-duration $swift-ease-out-timing-function,
5858
background-color $swift-ease-out-duration $swift-ease-out-timing-function;
5959

60-
*,
61-
*:before,
62-
*:after {
63-
box-sizing: border-box;
64-
}
6560
&:focus {
6661
outline: none;
6762
}

src/components/checkbox/checkbox.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ angular
4646
* </hljs>
4747
*
4848
*/
49-
function MdCheckboxDirective(inputDirective, $mdInkRipple, $mdAria, $mdConstant, $mdTheming, $mdUtil, $timeout) {
49+
function MdCheckboxDirective(inputDirective, $mdAria, $mdConstant, $mdTheming, $mdUtil, $timeout) {
5050
inputDirective = inputDirective[0];
5151
var CHECKED_CSS = 'md-checked';
5252

src/components/checkbox/checkbox.scss

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@ md-checkbox {
2121
min-width: $checkbox-width;
2222
min-height: $checkbox-width;
2323

24-
*,
25-
*:before,
26-
*:after {
27-
box-sizing: border-box;
28-
}
29-
3024
&.md-focused:not([disabled]) {
3125
.md-container:before {
3226
left: -8px;
@@ -46,13 +40,17 @@ md-checkbox {
4640
position: absolute;
4741
top: 50%;
4842
transform: translateY(-50%);
43+
44+
box-sizing: border-box;
4945
display: inline-block;
46+
5047
width: $checkbox-width;
5148
height: $checkbox-height;
5249
@include rtl(left, 0, auto);
5350
@include rtl(right, auto, 0);
5451

5552
&:before {
53+
box-sizing: border-box;
5654
background-color: transparent;
5755
border-radius: 50%;
5856
content: '';
@@ -68,6 +66,7 @@ md-checkbox {
6866
}
6967

7068
&:after {
69+
box-sizing: border-box;
7170
content: '';
7271
position: absolute;
7372
top: -10px;
@@ -94,6 +93,7 @@ md-checkbox {
9493

9594
// unchecked
9695
.md-icon {
96+
box-sizing: border-box;
9797
transition: 240ms;
9898
position: absolute;
9999
top: 0;
@@ -116,6 +116,7 @@ md-checkbox {
116116

117117

118118
&.md-checked .md-icon:after {
119+
box-sizing: border-box;
119120
transform: rotate(45deg);
120121
position: absolute;
121122
left: $checkbox-width / 3;
@@ -131,6 +132,7 @@ md-checkbox {
131132
}
132133

133134
.md-label {
135+
box-sizing: border-box;
134136
position: relative;
135137
display: inline-block;
136138
vertical-align: middle;

src/components/radioButton/radio-button.scss

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,8 @@ md-radio-button,
1111
white-space: nowrap;
1212
cursor: pointer;
1313

14-
*,
15-
*:before,
16-
*:after {
17-
box-sizing: border-box;
18-
}
19-
20-
input {
21-
display: none;
22-
}
23-
2414
.md-container {
15+
box-sizing: border-box;
2516
position: relative;
2617
top: 4px;
2718
display: inline-block;
@@ -39,6 +30,7 @@ md-radio-button,
3930
}
4031

4132
&:before {
33+
box-sizing: border-box;
4234
background-color: transparent;
4335
border-radius: 50%;
4436
content: '';
@@ -59,6 +51,7 @@ md-radio-button,
5951
}
6052

6153
.md-off {
54+
box-sizing: border-box;
6255
position: absolute;
6356
top: 0;
6457
left: 0;
@@ -71,6 +64,7 @@ md-radio-button,
7164
}
7265

7366
.md-on {
67+
box-sizing: border-box;
7468
position: absolute;
7569
top: 0;
7670
left: 0;
@@ -86,6 +80,7 @@ md-radio-button,
8680
}
8781

8882
.md-label {
83+
box-sizing: border-box;
8984
position: relative;
9085
display: inline-block;
9186

src/components/sidenav/sidenav.scss

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@ md-sidenav {
1414
background-color: white;
1515
overflow: auto;
1616

17-
*,
18-
*:before,
19-
*:after {
20-
box-sizing: border-box;
21-
}
22-
2317
ul {
2418
list-style: none;
2519
}

0 commit comments

Comments
 (0)