-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[css-grid] Implement hack for place-self property (#1144)
* [place-self] Implement place-self hack * [place-self] Add test cases * [place-self] Add test case for place-items warning * [place-self] Add check for grid status
- Loading branch information
1 parent
41e3a04
commit 6b8a25d
Showing
8 changed files
with
91 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
let Declaration = require('../declaration') | ||
let utils = require('./grid-utils') | ||
|
||
class PlaceSelf extends Declaration { | ||
static names = ['place-self'] | ||
|
||
/** | ||
* Translate place-self to separate -ms- prefixed properties | ||
*/ | ||
insert (decl, prefix, prefixes) { | ||
if (prefix !== '-ms-') return super.insert(decl, prefix, prefixes) | ||
|
||
// prevent doubling of prefixes | ||
if (decl.parent.some(i => i.prop === '-ms-grid-row-align')) { | ||
return undefined | ||
} | ||
|
||
let [[first, second]] = utils.parse(decl) | ||
|
||
if (second) { | ||
utils.insertDecl(decl, 'grid-row-align', first) | ||
utils.insertDecl(decl, 'grid-column-align', second) | ||
} else { | ||
utils.insertDecl(decl, 'grid-row-align', first) | ||
utils.insertDecl(decl, 'grid-column-align', first) | ||
} | ||
|
||
return undefined | ||
} | ||
} | ||
|
||
module.exports = PlaceSelf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters