source: node_modules/autoprefixer/lib/hacks/writing-mode.js@ 505f39a

Last change on this file since 505f39a was 2058e5c, checked in by istevanoska <ilinastevanoska@…>, 6 months ago

Working / before login

  • Property mode set to 100644
File size: 1002 bytes
Line 
1let Declaration = require('../declaration')
2
3class WritingMode extends Declaration {
4 insert(decl, prefix, prefixes) {
5 if (prefix === '-ms-') {
6 let cloned = this.set(this.clone(decl), prefix)
7
8 if (this.needCascade(decl)) {
9 cloned.raws.before = this.calcBefore(prefixes, decl, prefix)
10 }
11 let direction = 'ltr'
12
13 decl.parent.nodes.forEach(i => {
14 if (i.prop === 'direction') {
15 if (i.value === 'rtl' || i.value === 'ltr') direction = i.value
16 }
17 })
18
19 cloned.value = WritingMode.msValues[direction][decl.value] || decl.value
20 return decl.parent.insertBefore(decl, cloned)
21 }
22
23 return super.insert(decl, prefix, prefixes)
24 }
25}
26
27WritingMode.names = ['writing-mode']
28
29WritingMode.msValues = {
30 ltr: {
31 'horizontal-tb': 'lr-tb',
32 'vertical-lr': 'tb-lr',
33 'vertical-rl': 'tb-rl'
34 },
35 rtl: {
36 'horizontal-tb': 'rl-tb',
37 'vertical-lr': 'bt-lr',
38 'vertical-rl': 'bt-rl'
39 }
40}
41
42module.exports = WritingMode
Note: See TracBrowser for help on using the repository browser.