MCPcopy Index your code
hub / github.com/prototypejs/prototype / toDecimal

Function toDecimal

src/prototype/dom/layout.js:5–9  ·  view source on GitHub ↗
(pctString)

Source from the content-addressed store, hash-verified

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,

Callers 1

getPixelValueFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected