Skip to content

Commit 1694300

Browse files
authored
text-decoration : fix shorthand in Safari with single node values (#794)
* text-decoration : fix shorthand in Safari with single node values * update changelog
1 parent 88de686 commit 1694300

20 files changed

+43
-81
lines changed

package-lock.json

+7-71
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugin-packs/postcss-preset-env/test/basic.autoprefixer.expect.css

+1
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@
195195
table-layout: auto;
196196
text-align: left;
197197
text-align-last: auto;
198+
-webkit-text-decoration: none;
198199
text-decoration: none;
199200
text-indent: 0;
200201
text-shadow: none;

plugin-packs/postcss-preset-env/test/basic.autoprefixer.false.expect.css

+1
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@
195195
table-layout: auto;
196196
text-align: left;
197197
text-align-last: auto;
198+
-webkit-text-decoration: none;
198199
text-decoration: none;
199200
text-indent: 0;
200201
text-shadow: none;

plugin-packs/postcss-preset-env/test/basic.expect.css

+1
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@
209209
text-align: left;
210210
-moz-text-align-last: auto;
211211
text-align-last: auto;
212+
-webkit-text-decoration: none;
212213
text-decoration: none;
213214
text-indent: 0;
214215
text-shadow: none;

plugin-packs/postcss-preset-env/test/basic.nesting.false.expect.css

+1
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ h6.test-custom-selectors {
227227
text-align: left;
228228
-moz-text-align-last: auto;
229229
text-align-last: auto;
230+
-webkit-text-decoration: none;
230231
text-decoration: none;
231232
text-indent: 0;
232233
text-shadow: none;

plugin-packs/postcss-preset-env/test/basic.preserve.true.expect.css

+1
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ h6.test-custom-selectors {
438438
text-align: left;
439439
-moz-text-align-last: auto;
440440
text-align-last: auto;
441+
-webkit-text-decoration: none;
441442
text-decoration: none;
442443
text-indent: 0;
443444
text-shadow: none;

plugin-packs/postcss-preset-env/test/basic.stage0.expect.css

+1
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ h6.test-custom-selectors {
234234
text-align: left;
235235
-moz-text-align-last: auto;
236236
text-align-last: auto;
237+
-webkit-text-decoration: none;
237238
text-decoration: none;
238239
text-indent: 0;
239240
text-shadow: none;

plugin-packs/postcss-preset-env/test/basic.vendors-1.expect.css

+1
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@
213213
text-align: left;
214214
-moz-text-align-last: auto;
215215
text-align-last: auto;
216+
-webkit-text-decoration: none;
216217
text-decoration: none;
217218
text-indent: 0;
218219
text-shadow: none;

plugin-packs/postcss-preset-env/test/basic.vendors-2.expect.css

+1
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@
205205
text-align: left;
206206
-moz-text-align-last: auto;
207207
text-align-last: auto;
208+
-webkit-text-decoration: none;
208209
text-decoration: none;
209210
text-indent: 0;
210211
text-shadow: none;

plugin-packs/postcss-preset-env/test/layers-basic.expect.css

+1
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@ h6.test-custom-selectors:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):n
385385
text-align: left;
386386
-moz-text-align-last: auto;
387387
text-align-last: auto;
388+
-webkit-text-decoration: none;
388389
text-decoration: none;
389390
text-indent: 0;
390391
text-shadow: none;

plugin-packs/postcss-preset-env/test/layers-basic.preserve.true.expect.css

+1
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,7 @@ h6.test-custom-selectors:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):n
455455
text-align: left;
456456
-moz-text-align-last: auto;
457457
text-align-last: auto;
458+
-webkit-text-decoration: none;
458459
text-decoration: none;
459460
text-indent: 0;
460461
text-shadow: none;

plugins/css-has-pseudo/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,11 @@ or
148148

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

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

158158
[PostCSS Has Pseudo] works in all major browsers, including

plugins/css-has-pseudo/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "css-has-pseudo",
33
"description": "Style elements relative to other elements in CSS",
4-
"version": "4.0.1",
4+
"version": "4.0.2",
55
"contributors": [
66
{
77
"name": "Antonio Laguna",

plugins/postcss-text-decoration-shorthand/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
### Unreleased (major)
44

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

78
### 1.0.0 (August 15, 2022)
89

Original file line numberDiff line numberDiff line change
@@ -1 +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;
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){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;

0 commit comments

Comments
 (0)