Add partial grid-area support, improve grid-row and grid-column#938
Add partial grid-area support, improve grid-row and grid-column#938ai merged 1 commit intopostcss:masterfrom alex7kom:master
Conversation
|
Tests fall. Seems like you fix can’t clean own prefixes. In this case, you can create separated test case just for |
|
Done! I also have figured out 'doubling prefixes' check. |
|
@alex7kom just increase limit in |
| const parser = require('postcss-value-parser'); | ||
|
|
||
| const Declaration = require('../declaration'); | ||
| const translateShorthand = require('./grid-shorthand'); |
There was a problem hiding this comment.
If you use it only in the single file, it will be better to put ./grid-shorthand.js content to grid-area.js.
| */ | ||
| insert(decl, prefix) { | ||
| if (prefix !== '-ms-') { | ||
| return; |
There was a problem hiding this comment.
I think
return super.insert(decl, prefix)is more future-proof :).
| const [rowStart, rowSpan] = translateShorthand(values, 0, 2); | ||
| const [columnStart, columnSpan] = translateShorthand(values, 1, 3); | ||
|
|
||
| rowStart && decl.cloneBefore({ |
There was a problem hiding this comment.
if (rowStart) is more simple construction. It will be better to future developers.
| for (const i in decl.parent.nodes) { | ||
| if (decl.parent.nodes.hasOwnProperty(i)) { | ||
| const element = decl.parent.nodes[i]; | ||
| if (element.prop === '-ms-grid-row') { |
There was a problem hiding this comment.
Not future-proof. It is better to have this test in insert.
|
Fixed everything noted, also added |
|
Awesome! |
|
Released in 7.2 |
Another take on #883
While the original issue suggested only translation of span syntax, this is an attempt to translate
grid-areashorthand to-ms-properties as fully as possible. It is also applied togrid-rowandgrid-columnshorthands.Tests are failing:1) 'removes unnecessary prefixes': presumably because it also should remove-ms-properties and currently it doesn't.2) 'prevents doubling prefixes': it adds properties again.Currently I'm trying to figure it out.