| 1 |
let Declaration = require('../declaration') |
| 2 |
|
| 3 |
class BorderRadius extends Declaration { |
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
normalize(prop) { |
| 8 |
return BorderRadius.toNormal[prop] || prop |
| 9 |
} |
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
prefixed(prop, prefix) { |
| 15 |
if (prefix === '-moz-') { |
| 16 |
return prefix + (BorderRadius.toMozilla[prop] || prop) |
| 17 |
} |
| 18 |
return super.prefixed(prop, prefix) |
| 19 |
} |
| 20 |
} |
| 21 |
|
| 22 |
BorderRadius.names = ['border-radius'] |
| 23 |
|
| 24 |
BorderRadius.toMozilla = {} |
| 25 |
BorderRadius.toNormal = {} |
| 26 |
|
| 27 |
for (let ver of ['top', 'bottom']) { |
| 28 |
for (let hor of ['left', 'right']) { |
| 29 |
let normal = `border-${ver}-${hor}-radius` |
| 30 |
let mozilla = `border-radius-${ver}${hor}` |
| 31 |
|
| 32 |
BorderRadius.names.push(normal) |
| 33 |
BorderRadius.names.push(mozilla) |
| 34 |
|
| 35 |
BorderRadius.toMozilla[normal] = mozilla |
| 36 |
BorderRadius.toNormal[mozilla] = normal |
| 37 |
} |
| 38 |
} |
| 39 |
|
| 40 |
module.exports = BorderRadius |