Search with ignore keys on focus, without match highlighting. draft
authorTylerM <maklebus@msu.edu>
Thu, 13 Oct 2016 13:03:56 -0400
changeset 424929 11302ddd439eb615b911bbe67d16e014e736203d
parent 424928 d37a3064400e333cda4880c928698aa0b740e418
child 424930 8233ed556f112f788e5b80eca573c2ab803db5ef
push id32293
push userbmo:maklebus@msu.edu
push dateThu, 13 Oct 2016 20:34:31 +0000
milestone52.0a1
Search with ignore keys on focus, without match highlighting. MozReview-Commit-ID: 8vRH7gURFJ5
toolkit/modules/SelectParentHelper.jsm
--- a/toolkit/modules/SelectParentHelper.jsm
+++ b/toolkit/modules/SelectParentHelper.jsm
@@ -226,20 +226,17 @@ function populateChildren(menulist, opti
     searchbox.setAttribute("type", "search");
     searchbox.addEventListener("input", onSearchInput);
     element.insertBefore(searchbox, element.childNodes[0]);
   }
 
 }
 
 function onSearchInput(){
-  let doc = this.ownerDocument;
-  let win = doc.defaultView;
-  let selection = doc.defaultView.getSelection();
-  selection.removeAllRanges();
+
   let searchObj = this;
 
   // Get input from search field, set to all lower case for comparison
   let input = searchObj.value.toLowerCase();
 
   // Get all items in dropdown (could be options or optgroups)
   let menupopup = searchObj.parentElement;
   let menuItems = menupopup.querySelectorAll("menuitem, menucaption");
@@ -276,29 +273,16 @@ function onSearchInput(){
         }
         prevCaption = null;
         allHidden = true;
       }
 
       if(itemLabel.includes(input) || itemTooltip.includes(input)){
         currentItem.setAttribute("hidden", "false");
 
-        // Set range and selection for character match underlining
-        let start = itemLabel.indexOf(input);
-        if(start!=-1){
-          // Assumes label is first child, not the case in OSX!
-          let label = currentItem.boxObject.firstChild;
-          let textNode = label.firstChild;
-          let range = new win.Range();
-          range.setStart(textNode, start);
-          range.setEnd(textNode, (start+input.length));
-          let selection = doc.defaultView.getSelection();
-          selection.addRange(range);
-        }
-
         allHidden = false;
       } else{
         currentItem.setAttribute("hidden", "true");
       }
     }
 
   }
   if(prevCaption!=null && allHidden){