|
Last change
on this file was 2058e5c, checked in by istevanoska <ilinastevanoska@…>, 6 months ago |
|
Working / before login
|
-
Property mode
set to
100644
|
|
File size:
907 bytes
|
| Rev | Line | |
|---|
| [2058e5c] | 1 | let Declaration = require('../declaration')
|
|---|
| 2 | let flexSpec = require('./flex-spec')
|
|---|
| 3 |
|
|---|
| 4 | class Order extends Declaration {
|
|---|
| 5 | /**
|
|---|
| 6 | * Return property name by final spec
|
|---|
| 7 | */
|
|---|
| 8 | normalize() {
|
|---|
| 9 | return 'order'
|
|---|
| 10 | }
|
|---|
| 11 |
|
|---|
| 12 | /**
|
|---|
| 13 | * Change property name for 2009 and 2012 specs
|
|---|
| 14 | */
|
|---|
| 15 | prefixed(prop, prefix) {
|
|---|
| 16 | let spec
|
|---|
| 17 | ;[spec, prefix] = flexSpec(prefix)
|
|---|
| 18 | if (spec === 2009) {
|
|---|
| 19 | return prefix + 'box-ordinal-group'
|
|---|
| 20 | }
|
|---|
| 21 | if (spec === 2012) {
|
|---|
| 22 | return prefix + 'flex-order'
|
|---|
| 23 | }
|
|---|
| 24 | return super.prefixed(prop, prefix)
|
|---|
| 25 | }
|
|---|
| 26 |
|
|---|
| 27 | /**
|
|---|
| 28 | * Fix value for 2009 spec
|
|---|
| 29 | */
|
|---|
| 30 | set(decl, prefix) {
|
|---|
| 31 | let spec = flexSpec(prefix)[0]
|
|---|
| 32 | if (spec === 2009 && /\d/.test(decl.value)) {
|
|---|
| 33 | decl.value = (parseInt(decl.value) + 1).toString()
|
|---|
| 34 | return super.set(decl, prefix)
|
|---|
| 35 | }
|
|---|
| 36 | return super.set(decl, prefix)
|
|---|
| 37 | }
|
|---|
| 38 | }
|
|---|
| 39 |
|
|---|
| 40 | Order.names = ['order', 'flex-order', 'box-ordinal-group']
|
|---|
| 41 |
|
|---|
| 42 | module.exports = Order
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.