* Use two properties for 2009 spec
(decl, prefix, prefixes)
| 6 | * Use two properties for 2009 spec |
| 7 | */ |
| 8 | insert(decl, prefix, prefixes) { |
| 9 | let spec |
| 10 | ;[spec, prefix] = flexSpec(prefix) |
| 11 | if (spec !== 2009) { |
| 12 | return super.insert(decl, prefix, prefixes) |
| 13 | } |
| 14 | let values = decl.value |
| 15 | .split(/\s+/) |
| 16 | .filter(i => i !== 'wrap' && i !== 'nowrap' && 'wrap-reverse') |
| 17 | if (values.length === 0) { |
| 18 | return undefined |
| 19 | } |
| 20 | |
| 21 | let already = decl.parent.some( |
| 22 | i => |
| 23 | i.prop === prefix + 'box-orient' || i.prop === prefix + 'box-direction' |
| 24 | ) |
| 25 | if (already) { |
| 26 | return undefined |
| 27 | } |
| 28 | |
| 29 | let value = values[0] |
| 30 | let orient = value.includes('row') ? 'horizontal' : 'vertical' |
| 31 | let dir = value.includes('reverse') ? 'reverse' : 'normal' |
| 32 | |
| 33 | let cloned = this.clone(decl) |
| 34 | cloned.prop = prefix + 'box-orient' |
| 35 | cloned.value = orient |
| 36 | if (this.needCascade(decl)) { |
| 37 | cloned.raws.before = this.calcBefore(prefixes, decl, prefix) |
| 38 | } |
| 39 | decl.parent.insertBefore(decl, cloned) |
| 40 | |
| 41 | cloned = this.clone(decl) |
| 42 | cloned.prop = prefix + 'box-direction' |
| 43 | cloned.value = dir |
| 44 | if (this.needCascade(decl)) { |
| 45 | cloned.raws.before = this.calcBefore(prefixes, decl, prefix) |
| 46 | } |
| 47 | return decl.parent.insertBefore(decl, cloned) |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | FlexFlow.names = ['flex-flow', 'box-direction', 'box-orient'] |
nothing calls this directly
no test coverage detected