main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
496 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | var units = {};
|
---|
4 | var unitList = 'px,cm,mm,in,pt,pc,em,ex,ch,rem,vw,vh,deg,vmin,vmax'.split(',');
|
---|
5 |
|
---|
6 | function f (unit, val) {
|
---|
7 | return val + unit;
|
---|
8 | }
|
---|
9 |
|
---|
10 | for (var i = 0; i < unitList.length; i++) {
|
---|
11 | var unit = unitList[i];
|
---|
12 |
|
---|
13 | units[unit] = f.bind(null, unit);
|
---|
14 | }
|
---|
15 |
|
---|
16 | units.inch = function (val) {
|
---|
17 | return val + 'in';
|
---|
18 | };
|
---|
19 |
|
---|
20 | units.pct = function (val) {
|
---|
21 | return val + '%';
|
---|
22 | };
|
---|
23 |
|
---|
24 | exports.addon = function (renderer) {
|
---|
25 | renderer.assign(renderer, units);
|
---|
26 | renderer.units = units;
|
---|
27 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.