| 170 | // the "padding" CSS property |
| 171 | // https://developer.mozilla.org/en-US/docs/Web/CSS/padding |
| 172 | function unpackPadding(value) { |
| 173 | if (typeof(value) === "number") |
| 174 | value = [value]; |
| 175 | if (value.length === 1) { |
| 176 | return {top: value[0], right: value[0], bottom: value[0], left: value[0]}; |
| 177 | } |
| 178 | if (value.length === 2) { |
| 179 | return {top: value[0], right: value[1], bottom: value[0], left: value[1]}; |
| 180 | } |
| 181 | if (value.length === 3) { |
| 182 | return {top: value[0], right: value[1], bottom: value[2], left: value[1]}; |
| 183 | } |
| 184 | if (value.length === 4) { |
| 185 | return {top: value[0], right: value[1], bottom: value[2], left: value[3]}; |
| 186 | } |
| 187 | } |
| 188 | |
| 189 | // Convert an unpacked padding object to a CSS value |
| 190 | function paddingToCss(paddingObj) { |