blob: b7891c4955033b5768e94185ba73eff16bdf0871 [file] [log] [blame]
Akronc53cfc82020-10-19 11:00:58 +02001"use strict";
2
Akronc7448732016-04-27 14:06:58 +02003define({
4
5 /**
6 * Create new lengthField object.
7 */
8 create : function () {
9 return Object.create(this)._init();
10 },
11
Akronc53cfc82020-10-19 11:00:58 +020012
Akronc7448732016-04-27 14:06:58 +020013 // Initialize lengthField object
14 _init : function () {
Akron24aa0052020-11-10 11:00:34 +010015 this._el = document.createElement('div');
16 this._el.classList.add('lengthField');
Akronc7448732016-04-27 14:06:58 +020017 return this;
18 },
19
Akronc53cfc82020-10-19 11:00:58 +020020
Akronc7448732016-04-27 14:06:58 +020021 /**
Akronc7448732016-04-27 14:06:58 +020022 * Get the associated dom element.
23 */
24 element : function () {
Akron24aa0052020-11-10 11:00:34 +010025 return this._el;
Akron1ff3ac22016-04-28 16:30:45 +020026 },
27
Akronc53cfc82020-10-19 11:00:58 +020028
Akron1ff3ac22016-04-28 16:30:45 +020029 /**
30 * Add string to lengthField.
31 */
32 add : function (param) {
Akron24aa0052020-11-10 11:00:34 +010033 this._el.appendChild(document.createElement('span'))
Akron1ff3ac22016-04-28 16:30:45 +020034 .appendChild(document.createTextNode(param[0] + '--'));
Akroneaba63e2018-01-26 19:49:30 +010035 },
36
Akronc53cfc82020-10-19 11:00:58 +020037
Akroneaba63e2018-01-26 19:49:30 +010038 /**
39 * Remove all initialized values
40 */
41 reset : function () {
Akron24aa0052020-11-10 11:00:34 +010042 while (this._el.firstChild) {
43 this._el.firstChild.remove();
Akroneaba63e2018-01-26 19:49:30 +010044 };
Akronc7448732016-04-27 14:06:58 +020045 }
46});