Skip to content

text-decoration : fix shorthand in Safari with single node values #794

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

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
78 changes: 7 additions & 71 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@
table-layout: auto;
text-align: left;
text-align-last: auto;
-webkit-text-decoration: none;
text-decoration: none;
text-indent: 0;
text-shadow: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@
table-layout: auto;
text-align: left;
text-align-last: auto;
-webkit-text-decoration: none;
text-decoration: none;
text-indent: 0;
text-shadow: none;
Expand Down
1 change: 1 addition & 0 deletions plugin-packs/postcss-preset-env/test/basic.expect.css
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@
text-align: left;
-moz-text-align-last: auto;
text-align-last: auto;
-webkit-text-decoration: none;
text-decoration: none;
text-indent: 0;
text-shadow: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ h6.test-custom-selectors {
text-align: left;
-moz-text-align-last: auto;
text-align-last: auto;
-webkit-text-decoration: none;
text-decoration: none;
text-indent: 0;
text-shadow: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ h6.test-custom-selectors {
text-align: left;
-moz-text-align-last: auto;
text-align-last: auto;
-webkit-text-decoration: none;
text-decoration: none;
text-indent: 0;
text-shadow: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ h6.test-custom-selectors {
text-align: left;
-moz-text-align-last: auto;
text-align-last: auto;
-webkit-text-decoration: none;
text-decoration: none;
text-indent: 0;
text-shadow: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@
text-align: left;
-moz-text-align-last: auto;
text-align-last: auto;
-webkit-text-decoration: none;
text-decoration: none;
text-indent: 0;
text-shadow: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@
text-align: left;
-moz-text-align-last: auto;
text-align-last: auto;
-webkit-text-decoration: none;
text-decoration: none;
text-indent: 0;
text-shadow: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ h6.test-custom-selectors:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):n
text-align: left;
-moz-text-align-last: auto;
text-align-last: auto;
-webkit-text-decoration: none;
text-decoration: none;
text-indent: 0;
text-shadow: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ h6.test-custom-selectors:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):n
text-align: left;
-moz-text-align-last: auto;
text-align-last: auto;
-webkit-text-decoration: none;
text-decoration: none;
text-indent: 0;
text-shadow: none;
Expand Down
4 changes: 2 additions & 2 deletions plugins/css-has-pseudo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,11 @@ or

```html
<!-- When using a CDN url you will have to manually update the version number -->
<script src="https://unpkg.com/[email protected].1/dist/browser-global.js"></script>
<script src="https://unpkg.com/[email protected].2/dist/browser-global.js"></script>
<script>cssHasPseudo(document)</script>
```

⚠️ Please use a versioned url, like this : `https://unpkg.com/[email protected].1/dist/browser-global.js`
⚠️ Please use a versioned url, like this : `https://unpkg.com/[email protected].2/dist/browser-global.js`
Without the version, you might unexpectedly get a new major version of the library with breaking changes.

[PostCSS Has Pseudo] works in all major browsers, including
Expand Down
2 changes: 1 addition & 1 deletion plugins/css-has-pseudo/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "css-has-pseudo",
"description": "Style elements relative to other elements in CSS",
"version": "4.0.1",
"version": "4.0.2",
"contributors": [
{
"name": "Antonio Laguna",
Expand Down
1 change: 1 addition & 0 deletions plugins/postcss-text-decoration-shorthand/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### Unreleased (major)

- Updated: Support for Node v14+ (major).
- Add: `-webkit-text-decoration` shorthand for single value `text-decoration: underline;`. [autoprefixer 1473](https://github.com/postcss/autoprefixer/issues/1473#issuecomment-1243370592)

### 1.0.0 (August 15, 2022)

Expand Down
2 changes: 1 addition & 1 deletion plugins/postcss-text-decoration-shorthand/dist/index.cjs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"use strict";var e=require("postcss-value-parser");const creator=t=>{const a=Object.assign({preserve:!1},t);return{postcssPlugin:"postcss-text-decoration-shorthand",prepare(){const t=new Map;return{OnceExit:()=>{t.clear()},Declaration:n=>{if("text-decoration"!==n.prop.toLowerCase())return;const i=n.parent.index(n);if(n.parent.nodes.some((e=>"decl"===e.type&&"text-decoration"===e.prop.toLowerCase()&&t.get(n.value)===e.value&&n.parent.index(e)!==i)))return;const s=e(n.value).nodes.filter((e=>"space"!==e.type&&"comment"!==e.type));if(s.length>4)return;if(s.find((e=>"var"===e.value.toLowerCase()&&"function"===e.type)))return;if(s.find((e=>"word"===e.type&&r.includes(e.value))))return;const u={line:null,style:null,color:null,thickness:null};for(let e=0;e<s.length;e++){const r=s[e];"word"===r.type&&l.includes(r.value.toLowerCase())?u.line=r:"word"===r.type&&o.includes(r.value.toLowerCase())?u.style=r:nodeIsAColor(r)?u.color=r:"word"!==r.type||"none"!==r.value.toLowerCase()?u.thickness=r:(u.color||(u.color=r),u.line||(u.line=r))}u.line||(u.line={type:"word",value:"none"}),u.style||(u.style={type:"word",value:"solid"}),u.color||(u.color={type:"word",value:"currentColor"});try{const r=e.unit(u.thickness.value);r&&"%"===r.unit&&(u.thickness={type:"function",value:"calc",nodes:[{type:"word",value:"0.01em"},{type:"space",value:" "},{type:"word",value:"*"},{type:"space",value:" "},{type:"word",value:r.number}]})}catch(e){}const d=e.stringify(u.line);if(n.value.toLowerCase()===d)return;const c=e.stringify([u.line,{type:"space",value:" "},u.style,{type:"space",value:" "},u.color]);n.cloneBefore({prop:"text-decoration",value:d}),(u.thickness||3!==s.length)&&n.cloneBefore({prop:"text-decoration",value:c}),u.thickness&&n.cloneBefore({prop:"text-decoration-thickness",value:e.stringify([u.thickness])}),t.set(n.value,d),t.set(c,d),a.preserve||n.remove()}}}}};function nodeIsAColor(e){return!("word"!==e.type||!e.value.startsWith("#"))||(!("word"!==e.type||!a.includes(e.value.toLowerCase()))||!("function"!==e.type||!t.includes(e.value.toLowerCase())))}creator.postcss=!0;const r=["unset","inherit","initial","revert","revert-layer"],l=["underline","overline","line-through","blink","spelling-error","grammar-error"],o=["solid","double","dotted","dashed","wavy"],t=["rgb","rgba","hsl","hsla","hwb","lch","lab","color","oklch","oklab"],a=["currentcolor","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"];module.exports=creator;
"use strict";var e=require("postcss-value-parser");const creator=t=>{const a=Object.assign({preserve:!1},t);return{postcssPlugin:"postcss-text-decoration-shorthand",prepare(){const t=new Map;return{OnceExit:()=>{t.clear()},Declaration:n=>{if("text-decoration"!==n.prop.toLowerCase())return;const i=n.parent.index(n);if(n.parent.nodes.some((e=>"decl"===e.type&&"text-decoration"===e.prop.toLowerCase()&&t.get(n.value)===e.value&&n.parent.index(e)!==i)))return;const s=e(n.value).nodes.filter((e=>"space"!==e.type&&"comment"!==e.type));if(s.length>4)return;if(s.find((e=>"var"===e.value.toLowerCase()&&"function"===e.type)))return;if(s.find((e=>"word"===e.type&&r.includes(e.value))))return;const u={line:null,style:null,color:null,thickness:null};for(let e=0;e<s.length;e++){const r=s[e];"word"===r.type&&l.includes(r.value.toLowerCase())?u.line=r:"word"===r.type&&o.includes(r.value.toLowerCase())?u.style=r:nodeIsAColor(r)?u.color=r:"word"!==r.type||"none"!==r.value.toLowerCase()?u.thickness=r:(u.color||(u.color=r),u.line||(u.line=r))}u.line||(u.line={type:"word",value:"none"}),u.style||(u.style={type:"word",value:"solid"}),u.color||(u.color={type:"word",value:"currentColor"});try{const r=e.unit(u.thickness.value);r&&"%"===r.unit&&(u.thickness={type:"function",value:"calc",nodes:[{type:"word",value:"0.01em"},{type:"space",value:" "},{type:"word",value:"*"},{type:"space",value:" "},{type:"word",value:r.number}]})}catch(e){}const d=e.stringify(u.line);if(n.value.toLowerCase()===d){const e=n.next();return void(e&&"decl"===e.type&&"text-decoration"===e.prop.toLowerCase()||n.cloneBefore({prop:"-webkit-text-decoration",value:d}))}n.cloneBefore({prop:"text-decoration",value:d});const c=e.stringify([u.line,{type:"space",value:" "},u.style,{type:"space",value:" "},u.color]);(u.thickness||3!==s.length)&&n.cloneBefore({prop:"text-decoration",value:c}),u.thickness&&n.cloneBefore({prop:"text-decoration-thickness",value:e.stringify([u.thickness])}),t.set(n.value,d),t.set(c,d),a.preserve||n.remove()}}}}};function nodeIsAColor(e){return!("word"!==e.type||!e.value.startsWith("#"))||(!("word"!==e.type||!a.includes(e.value.toLowerCase()))||!("function"!==e.type||!t.includes(e.value.toLowerCase())))}creator.postcss=!0;const r=["unset","inherit","initial","revert","revert-layer"],l=["underline","overline","line-through","blink","spelling-error","grammar-error"],o=["solid","double","dotted","dashed","wavy"],t=["rgb","rgba","hsl","hsla","hwb","lch","lab","color","oklch","oklab"],a=["currentcolor","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"];module.exports=creator;
Loading