Cleanup and simplify JS code
Change-Id: I393e22763c1a1d18878026bf459b747b150429fb
diff --git a/dev/js/src/hint/foundries.js b/dev/js/src/hint/foundries.js
index 67a6a88..8ece056 100644
--- a/dev/js/src/hint/foundries.js
+++ b/dev/js/src/hint/foundries.js
@@ -3,7 +3,7 @@
define(function () {
- var ah = KorAP.annotationHelper;
+ const ah = KorAP.annotationHelper;
ah["getDesc"] = function (foundryLayer, value) {
diff --git a/dev/js/src/hint/item.js b/dev/js/src/hint/item.js
index 66819c6..c39c3c2 100644
--- a/dev/js/src/hint/item.js
+++ b/dev/js/src/hint/item.js
@@ -1,7 +1,7 @@
/**
* Hint menu item based on MenuItem
*/
-define(['menu/item'], function (itemClass) {
+define(['menu/item', 'util'], function (itemClass) {
return {
/**
@@ -100,7 +100,7 @@
// Create title
var name = document.createElement("span");
- name.appendChild(document.createTextNode(this._name));
+ name.addT(this._name);
li.appendChild(name);
@@ -108,7 +108,7 @@
if (this._desc !== undefined) {
var desc = document.createElement("span");
desc.classList.add('desc');
- desc.appendChild(document.createTextNode(this._desc));
+ desc.addT(this._desc);
li.appendChild(desc);
};
return this._element = li;
diff --git a/dev/js/src/hint/lengthField.js b/dev/js/src/hint/lengthField.js
index 0662b89..541b917 100644
--- a/dev/js/src/hint/lengthField.js
+++ b/dev/js/src/hint/lengthField.js
@@ -1,4 +1,4 @@
-define(['menu/lengthField'], function (lengthFieldClass) {
+define(['menu/lengthField', 'util'], function (lengthFieldClass) {
return {
/**
@@ -6,19 +6,18 @@
*/
create : function () {
return Object.create(lengthFieldClass).
- upgradeTo(this)._init();
+ upgradeTo(this)._init();
},
/**
* Override the prefix action.
*/
add : function (param) {
- this._element.appendChild(document.createElement('span'))
- .appendChild(document.createTextNode(param[0] + '--'));
+ this._element.addE('span').addT(param[0] + '--');
- var desc = this._element.appendChild(document.createElement('span'));
+ var desc = this._element.addE('span');
desc.classList.add("desc");
- desc.appendChild(document.createTextNode(param[2] + '--'));
+ desc.addT(param[2] + '--');
this._element.appendChild(desc);
}
};