Skip to content

postcss-text-decoration-shorthand: reduce redundant fallbacks#1776

Merged
romainmenke merged 2 commits into
mainfrom
postcss-text-decoration-shorthand--compassionate-grasshopper-d3cac36a7d
Feb 6, 2026
Merged

postcss-text-decoration-shorthand: reduce redundant fallbacks#1776
romainmenke merged 2 commits into
mainfrom
postcss-text-decoration-shorthand--compassionate-grasshopper-d3cac36a7d

Conversation

@romainmenke

Copy link
Copy Markdown
Member

No description provided.

@lukhanina

lukhanina commented Feb 4, 2026

Copy link
Copy Markdown

@romainmenke , thank you, it makes sense, but there is still 1 minor issue (it's edge case), that when there is a comment next to the css property, e.g.:

	text-decoration: underline; /* 2 */
	text-decoration: underline dotted;

the condition passed:

	if (!next || next.type !== 'decl' || next.prop.toLowerCase() !== 'text-decoration') {
		decl.cloneBefore({
			prop: '-webkit-text-decoration',
			value: nonShortHandValue,
		});
	}

because next.type !== 'decl', next.type === 'comment'
and webkit prefix is added, so in the end we get:

	-webkit-text-decoration: underline;
	text-decoration: underline; /* 2 */
	-webkit-text-decoration: underline dotted;
	        text-decoration: underline dotted; /* 2 */

what is wrong, because without a comment it matches a condition next.prop.toLowerCase() !== 'text-decoration' and doesn't add -webkit-text-decoration: underline;

so if next.type === 'comment' we need to check next.next().prop.toLowerCase() to make sure it's not text-decoration, before we do clone

@romainmenke

Copy link
Copy Markdown
Member Author

@lukhanina I see, thank you.

I've pushed a patch that should account for this.

@lukhanina

Copy link
Copy Markdown

@romainmenke thank you!

@romainmenke romainmenke merged commit c93111d into main Feb 6, 2026
12 checks passed
@romainmenke romainmenke deleted the postcss-text-decoration-shorthand--compassionate-grasshopper-d3cac36a7d branch February 6, 2026 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants