bug 643172 - Some searchbar cleanup found by SeaMonkey reviews - use classList, r=gavin
authorRobert Kaiser <kairo@kairo.at>
Thu, 23 Feb 2012 18:56:48 +0100
changeset 87559 0b5e42a04630745b9fbf375f62737d864e71f151
parent 87558 0d34a35066448bd31ab88b3d6880be5023df8780
child 87560 43a4ce8728ca704717b523cf4992c169b3c5b708
push id22130
push userrnewman@mozilla.com
push dateFri, 24 Feb 2012 02:35:54 +0000
treeherdermozilla-central@d23600a1d4a7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgavin
bugs643172
milestone13.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 643172 - Some searchbar cleanup found by SeaMonkey reviews - use classList, r=gavin
browser/components/search/content/search.xml
--- a/browser/components/search/content/search.xml
+++ b/browser/components/search/content/search.xml
@@ -329,17 +329,18 @@
             this.rebuildPopup();
 
           var popup = this._popup;
           // Clear any addengine menuitems, including addengine-item entries and
           // the addengine-separator.  Work backward to avoid invalidating the
           // indexes as items are removed.
           var items = popup.childNodes;
           for (var i = items.length - 1; i >= 0; i--) {
-            if (items[i].getAttribute("class").indexOf("addengine") != -1)
+            if (items[i].classList.contains("addengine-item") ||
+                items[i].classList.contains("addengine-separator"))
               popup.removeChild(items[i]);
           }
 
           var addengines = getBrowser().mCurrentBrowser.engines;
           if (addengines && addengines.length > 0) {
             const kXULNS =
                "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
 
@@ -494,17 +495,17 @@
           openUILinkIn(submission.uri.spec, aWhere, null, submission.postData);
         ]]></body>
       </method>
     </implementation>
 
     <handlers>
       <handler event="command"><![CDATA[
         const target = event.originalTarget;
-        if (target.getAttribute("class").indexOf("addengine-item") != -1) {
+        if (target.classList.contains("addengine-item")) {
           var searchService =
             Components.classes["@mozilla.org/browser/search-service;1"]
                       .getService(Components.interfaces.nsIBrowserSearchService);
           // We only detect OpenSearch files
           var type = Components.interfaces.nsISearchEngine.DATA_XML;
           searchService.addEngine(target.getAttribute("uri"), type,
                                   target.getAttribute("src"), false);
         }