Improve hint behaviour in webkit

Change-Id: Ib0dd00e4c54764afc13423c5f514afb3f7cad4ce
diff --git a/dev/js/src/hint.js b/dev/js/src/hint.js
index c93d178..519ed26 100644
--- a/dev/js/src/hint.js
+++ b/dev/js/src/hint.js
@@ -264,8 +264,9 @@
       if (menu = this.contextMenu(ifContext)) {
 	      this.active(menu);
 
-        var c = this._inputField.container();
+        var c = this._inputField.container();        
 	      c.appendChild(menu.element());
+
 	      menu.show();
 	      menu.focus();
 	      // Focus on input field
@@ -303,6 +304,8 @@
         // This does not work for alert currently!
 	      //if (act._type !== 'alert') {
         if (!this._alert.active) {
+
+          // This does not work for webkit!
           var c = this._inputField.container();
           c.removeChild(this._active.element());
 	      }
diff --git a/dev/js/src/hint/input.js b/dev/js/src/hint/input.js
index adb74b6..e61d820 100644
--- a/dev/js/src/hint/input.js
+++ b/dev/js/src/hint/input.js
@@ -146,13 +146,14 @@
     // Create mirror for searchField
     // This is important for positioning
     // if ((this._mirror = document.getElementById("searchMirror")) === null) {
-      this._mirror = document.createElement("div");
-      this._mirror.classList.add('hint', 'mirror');
-      this._mirror.appendChild(document.createElement("span"));
-      this._container = this._mirror.appendChild(document.createElement("div"));
-      this._mirror.style.height = "0px";
-      document.getElementsByTagName("body")[0].appendChild(this._mirror);
-//    };
+    this._mirror = document.createElement("div");
+    this._mirror.classList.add('hint', 'mirror');
+    this._mirror.appendChild(document.createElement("span"));
+    this._container = document.createElement("div");
+    this._mirror.appendChild(this._container);
+    this._mirror.style.height = "0px";
+    document.getElementsByTagName("body")[0].appendChild(this._mirror);
+    //    };
 
     // Update position of the mirror
     window.addEventListener('resize', this.reposition.bind(this));
diff --git a/dev/js/src/hint/menu.js b/dev/js/src/hint/menu.js
index a7bdf57..105273e 100644
--- a/dev/js/src/hint/menu.js
+++ b/dev/js/src/hint/menu.js
@@ -1,12 +1,19 @@
 /**
  * Hint menu
  */
-define(['menu',
+define([
+  'menu',
 	'hint/item',
 	'hint/prefix',
-	'hint/lengthField'], function (menuClass, itemClass, prefixClass, lengthFieldClass) {
-  return {
+	'hint/lengthField'
+], function (
+  menuClass,
+  itemClass,
+  prefixClass,
+  lengthFieldClass) {
 
+  return {
+    
     /**
      * Create new hint helper menu.
      */
@@ -25,14 +32,20 @@
       // Make the top item always active
       obj._firstActive = true;
 
-      // This is only domspecific
       obj.element().addEventListener('blur', function (e) {
         this.menu.hideWithoutDestruction();
       });
 
       // Focus on input field on hide
       obj.onHide = function () {
-	      this._hint.unshow();
+        var h = this._hint;
+        h._inputField.element().focus();
+        if (h.active() !== null) {
+          if (h._alert.active) {
+            h._unshowAlert();
+          };
+          h.active(null);
+        };
       };
 
       return obj;
diff --git a/dev/js/src/menu.js b/dev/js/src/menu.js
index 1685da5..439adbd 100644
--- a/dev/js/src/menu.js
+++ b/dev/js/src/menu.js
@@ -535,7 +535,6 @@
      */
     onHide : function () {},
 
-
     /**
      * Get the prefix for filtering,
      * e.g. "ve" for "verb"