Skip to content

Commit 5556782

Browse files
authored
Forbid deprecated break-word in CSS (#30934)
Forbid [deprecated](https://drafts.csswg.org/css-text-3/#word-break-property) `break-word` and fix all occurences. Regarding `overflow-wrap: break-word` vs `overflow-wrap: anywhere`: Example of difference: https://jsfiddle.net/silverwind/1va6972r/ [Here](https://stackoverflow.com/questions/77651244) it says: > The differences between normal, break-word and anywhere are only clear if you are using width: min-content on the element containing the text, and you also set a max-width. A pretty rare scenario. I don't think this difference will make any practical impact as we are not hitting this rare scenario.
1 parent 7424f27 commit 5556782

File tree

5 files changed

+5
-7
lines changed

5 files changed

+5
-7
lines changed

stylelint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ export default {
150150
'declaration-property-unit-allowed-list': null,
151151
'declaration-property-unit-disallowed-list': {'line-height': ['em']},
152152
'declaration-property-value-allowed-list': null,
153-
'declaration-property-value-disallowed-list': null,
153+
'declaration-property-value-disallowed-list': {'word-break': ['break-word']},
154154
'declaration-property-value-no-unknown': true,
155155
'font-family-name-quotes': 'always-where-recommended',
156156
'font-family-no-duplicate-names': true,

web_src/css/features/console.css

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
color: var(--color-console-fg);
66
font-family: var(--fonts-monospace);
77
border-radius: var(--border-radius);
8-
word-break: break-word;
9-
overflow-wrap: break-word;
8+
overflow-wrap: anywhere;
109
}
1110

1211
.console img { max-width: 100%; }

web_src/css/helpers.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ Gitea's private styles use `g-` prefix.
55

66
.gt-word-break {
77
word-wrap: break-word !important;
8-
word-break: break-word; /* compat: Safari */
98
overflow-wrap: anywhere;
109
}
1110

web_src/css/repo.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ td .commit-summary {
410410
}
411411

412412
.repository.file.list .non-diff-file-content .plain-text pre {
413-
word-break: break-word;
413+
overflow-wrap: anywhere;
414414
white-space: pre-wrap;
415415
}
416416

web_src/css/shared/flex-list.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
color: var(--color-text);
6060
font-size: 16px;
6161
font-weight: var(--font-weight-semibold);
62-
word-break: break-word;
62+
overflow-wrap: anywhere;
6363
min-width: 0;
6464
}
6565

@@ -74,7 +74,7 @@
7474
flex-wrap: wrap;
7575
gap: .25rem;
7676
color: var(--color-text-light-2);
77-
word-break: break-word;
77+
overflow-wrap: anywhere;
7878
}
7979

8080
.flex-item .flex-item-body a {

0 commit comments

Comments
 (0)