blob: b05221f59c50572e9a0578dab63ab24fbbac2fe3 [file] [log] [blame]
Akronc7448732016-04-27 14:06:58 +02001define({
2
3 /**
4 * Create new lengthField object.
5 */
6 create : function () {
7 return Object.create(this)._init();
8 },
9
10 // Initialize lengthField object
11 _init : function () {
12 this._element = document.createElement('div');
13 this._element.classList.add('lengthField');
14 return this;
15 },
16
17 /**
Akron1ff3ac22016-04-28 16:30:45 +020018 * Upgrade this object to another object,
19 * while private data stays intact.
20 *
21 * @param {Object} An object with properties.
Akronc7448732016-04-27 14:06:58 +020022 */
Akron1ff3ac22016-04-28 16:30:45 +020023 upgradeTo : function (props) {
24 for (var prop in props) {
25 this[prop] = props[prop];
26 };
27 return this;
Akronc7448732016-04-27 14:06:58 +020028 },
29
30 /**
31 * Get the associated dom element.
32 */
33 element : function () {
34 return this._element;
Akron1ff3ac22016-04-28 16:30:45 +020035 },
36
37 /**
38 * Add string to lengthField.
39 */
40 add : function (param) {
41 this._element.appendChild(document.createElement('span'))
42 .appendChild(document.createTextNode(param[0] + '--'));
Akronc7448732016-04-27 14:06:58 +020043 }
44});