Debian Codegraph @

autoprefixer/lib/hacks/block-logical.js

raw symbols SCIP
1 let Declaration = require('../declaration')
2
3 class BlockLogical extends Declaration {
4 /**
5 * Return property name by spec
6 */
7 normalize(prop) {
8 if (prop.includes('-before')) {
9 return prop.replace('-before', '-block-start')
10 }
11 return prop.replace('-after', '-block-end')
12 }
13
14 /**
15 * Use old syntax for -moz- and -webkit-
16 */
17 prefixed(prop, prefix) {
18 if (prop.includes('-start')) {
19 return prefix + prop.replace('-block-start', '-before')
20 }
21 return prefix + prop.replace('-block-end', '-after')
22 }
23 }
24
25 BlockLogical.names = [
26 'border-block-start',
27 'border-block-end',
28 'margin-block-start',
29 'margin-block-end',
30 'padding-block-start',
31 'padding-block-end',
32 'border-before',
33 'border-after',
34 'margin-before',
35 'margin-after',
36 'padding-before',
37 'padding-after'
38 ]
39
40 module.exports = BlockLogical