(pctString)
| 3 | // Converts a CSS percentage value to a decimal. |
| 4 | // Ex: toDecimal("30%"); // -> 0.3 |
| 5 | function toDecimal(pctString) { |
| 6 | var match = pctString.match(/^(\d+)%?$/i); |
| 7 | if (!match) return null; |
| 8 | return (Number(match[1]) / 100); |
| 9 | } |
| 10 | |
| 11 | // A bare-bones version of Element.getStyle. Needed because getStyle is |
| 12 | // public-facing and too user-friendly for our tastes. We need raw, |