Bug 1080030 - Trim the whitespace surrounding option/optgroup text when displaying a drop-down in e10s; r=felipe
--- 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) : []