Skip to content

Commit

Permalink
Don't add :root :where for single classes, because they are already 0…
Browse files Browse the repository at this point in the history
…-1-0 specificity
  • Loading branch information
ellatrix committed May 14, 2024
1 parent ce6a064 commit 0ba0494
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 26 deletions.
2 changes: 1 addition & 1 deletion packages/block-library/src/audio/theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
@include caption-style-theme();
}

:root :where(.wp-block-audio) {
.wp-block-audio {
margin: 0 0 1em 0;
}
8 changes: 2 additions & 6 deletions packages/block-library/src/cover/style.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
// Lowest specificity styles are used to ensure that the default styles for the cover block can be overridden by global styles.
:root :where(.wp-block-cover-image, .wp-block-cover) {
min-height: 430px;
padding: 1em;
}

.wp-block-cover-image,
.wp-block-cover {
min-height: 430px;
padding: 1em;
position: relative;
background-position: center center;
display: flex;
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/embed/theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
@include caption-style-theme();
}

:root :where(.wp-block-embed) {
.wp-block-embed {
margin: 0 0 1em 0;
}
3 changes: 3 additions & 0 deletions packages/block-library/src/gallery/editor.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Adding `figure` to the selector increases the specificity above the global
// styles specificity, which is levelled at 0-1-0. We should figure out why
// `figure` is needed.
:root :where(figure.wp-block-gallery) {
// Override the default list style type _only in the editor_
// to avoid :not() selector specificity issues.
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/image/theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
@include caption-style-theme();
}

:root :where(.wp-block-image) {
.wp-block-image {
margin: 0 0 1em 0;
}
4 changes: 1 addition & 3 deletions packages/block-library/src/pullquote/theme.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
:root :where(.wp-block-pullquote) {
.wp-block-pullquote {
border-top: 4px solid currentColor;
border-bottom: 4px solid currentColor;
margin-bottom: 1.75em;
color: currentColor;
}

.wp-block-pullquote {
cite,
footer,
&__citation {
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/quote/theme.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
:root :where(.wp-block-quote) {
.wp-block-quote {
border-left: 0.25em solid currentColor;
margin: 0 0 1.75em 0;
padding-left: 1em;
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/social-links/style.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
:root :where(.wp-block-social-links) {
.wp-block-social-links {
// This block has customizable padding, border-box makes that more predictable.
box-sizing: border-box;

Expand Down
6 changes: 2 additions & 4 deletions packages/block-library/src/table/theme.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.wp-block-table {
margin: 0 0 1em 0;

td,
th {
word-break: normal;
Expand All @@ -8,7 +10,3 @@
@include caption-style-theme();
}
}

:root :where(.wp-block-table) {
margin: 0 0 1em 0;
}
12 changes: 5 additions & 7 deletions packages/block-library/src/template-part/theme.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// Same as the group block styles.
:root :where(.wp-block-template-part) {
&.has-background {
// Matches paragraph Block padding
padding: $block-bg-padding--v $block-bg-padding--h;
margin-top: 0;
margin-bottom: 0;
}
:root :where(.wp-block-template-part.has-background) {
// Matches paragraph Block padding
padding: $block-bg-padding--v $block-bg-padding--h;
margin-top: 0;
margin-bottom: 0;
}
2 changes: 1 addition & 1 deletion packages/block-library/src/video/theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
@include caption-style-theme();
}

:root :where(.wp-block-video) {
.wp-block-video {
margin: 0 0 1em 0;
}

0 comments on commit 0ba0494

Please sign in to comment.