Bug 1080030 - Trim the whitespace surrounding option/optgroup text when displaying a drop-down in e10s; r=felipe
authorEhsan Akhgari <ehsan@mozilla.com>
Sat, 11 Oct 2014 09:40:45 -0400
changeset 209968 94e7f3c3969c899f753098afb6639b811fbc7d1c
parent 209967 4ef90fdc2c5895c81cdf6434ce54a88dd7b3d499
child 209969 c6af18bbbafa95040e66f4e81297a4237800f3ee
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersfelipe
bugs1080030
milestone35.0a1
Bug 1080030 - Trim the whitespace surrounding option/optgroup text when displaying a drop-down in e10s; r=felipe
toolkit/modules/SelectContentHelper.jsm
--- a/toolkit/modules/SelectContentHelper.jsm
+++ b/toolkit/modules/SelectContentHelper.jsm
@@ -87,18 +87,18 @@ this.SelectContentHelper.prototype = {
 }
 
 function buildOptionListForChildren(node) {
   let result = [];
   for (let child = node.firstChild; child; child = child.nextSibling) {
     if (child.tagName == 'OPTION' || child.tagName == 'OPTGROUP') {
       let info = {
         tagName: child.tagName,
-        textContent: child.tagName == 'OPTGROUP' ? child.getAttribute("label")
-                                                 : child.textContent,
+        textContent: child.tagName == 'OPTGROUP' ? child.getAttribute("label").trim()
+                                                 : child.textContent.trim(),
         // XXX this uses a highlight color when this is the selected element.
         // We need to suppress such highlighting in the content process to get
         // the option's correct unhighlighted color here.
         // We also need to detect default color vs. custom so that a standard
         // color does not override color: menutext in the parent.
         // backgroundColor: computedStyle.backgroundColor,
         // color: computedStyle.color,
         children: child.tagName == 'OPTGROUP' ? buildOptionListForChildren(child) : []