Akron | c744873 | 2016-04-27 14:06:58 +0200 | [diff] [blame^] | 1 | define({ |
| 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 | /** |
| 18 | * Add string to lengthField. |
| 19 | */ |
| 20 | add : function (string) { |
| 21 | this._element.appendChild(document.createElement('span')) |
| 22 | .appendChild(document.createTextNode(string + '-')); |
| 23 | }, |
| 24 | |
| 25 | /** |
| 26 | * Get the associated dom element. |
| 27 | */ |
| 28 | element : function () { |
| 29 | return this._element; |
| 30 | } |
| 31 | }); |