Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use word-wrap instead of overflow-wrap when targeting ie11 #2391

Merged
merged 1 commit into from
Oct 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions __tests__/fixtures/tailwind-output-ie11.css
Original file line number Diff line number Diff line change
Expand Up @@ -9012,12 +9012,12 @@ video {
}

.break-normal {
overflow-wrap: normal;
word-wrap: normal;
word-break: normal;
}

.break-words {
overflow-wrap: break-word;
word-wrap: break-word;
}

.break-all {
Expand Down Expand Up @@ -19482,12 +19482,12 @@ video {
}

.sm\:break-normal {
overflow-wrap: normal;
word-wrap: normal;
word-break: normal;
}

.sm\:break-words {
overflow-wrap: break-word;
word-wrap: break-word;
}

.sm\:break-all {
Expand Down Expand Up @@ -29922,12 +29922,12 @@ video {
}

.md\:break-normal {
overflow-wrap: normal;
word-wrap: normal;
word-break: normal;
}

.md\:break-words {
overflow-wrap: break-word;
word-wrap: break-word;
}

.md\:break-all {
Expand Down Expand Up @@ -40362,12 +40362,12 @@ video {
}

.lg\:break-normal {
overflow-wrap: normal;
word-wrap: normal;
word-break: normal;
}

.lg\:break-words {
overflow-wrap: break-word;
word-wrap: break-word;
}

.lg\:break-all {
Expand Down Expand Up @@ -50802,12 +50802,12 @@ video {
}

.xl\:break-normal {
overflow-wrap: normal;
word-wrap: normal;
word-break: normal;
}

.xl\:break-words {
overflow-wrap: break-word;
word-wrap: break-word;
}

.xl\:break-all {
Expand Down
8 changes: 5 additions & 3 deletions src/plugins/wordBreak.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
export default function() {
return function({ addUtilities, variants }) {
return function({ addUtilities, variants, target }) {
const wrapPropertyName = target('wordBreak') === 'ie11' ? 'word-wrap' : 'overflow-wrap'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left this using overflow-wrap when not targeting ie11 since that's the official name of the property now. Technically it would be fine to just use word-wrap instead of overflow-wrap if I'm reading https://css-tricks.com/almanac/properties/o/overflow-wrap/#the-historical-word-wrap-property right. Do ya'll think I made the right call here?


addUtilities(
{
'.break-normal': {
'overflow-wrap': 'normal',
[wrapPropertyName]: 'normal',
'word-break': 'normal',
},
'.break-words': { 'overflow-wrap': 'break-word' },
'.break-words': { [wrapPropertyName]: 'break-word' },
'.break-all': { 'word-break': 'break-all' },

'.truncate': {
Expand Down