diff options
| author | Philipp Tanlak <philipp.tanlak@gmail.com> | 2025-11-24 20:54:57 +0100 |
|---|---|---|
| committer | Philipp Tanlak <philipp.tanlak@gmail.com> | 2025-11-24 20:57:48 +0100 |
| commit | b1e2c8fd5cb5dfa46bc440a12eafaf56cd844b1c (patch) | |
| tree | 49d360fd6cbc6a2754efe93524ac47ff0fbe0f7d /node_modules/autoprefixer/lib/hacks/place-self.js | |
Docs
Diffstat (limited to 'node_modules/autoprefixer/lib/hacks/place-self.js')
| -rw-r--r-- | node_modules/autoprefixer/lib/hacks/place-self.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/node_modules/autoprefixer/lib/hacks/place-self.js b/node_modules/autoprefixer/lib/hacks/place-self.js new file mode 100644 index 0000000..e0ce3e8 --- /dev/null +++ b/node_modules/autoprefixer/lib/hacks/place-self.js @@ -0,0 +1,32 @@ +let Declaration = require('../declaration') +let utils = require('./grid-utils') + +class PlaceSelf extends Declaration { + /** + * 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 + } +} + +PlaceSelf.names = ['place-self'] + +module.exports = PlaceSelf |