Bug 1375224 - Remove use of <style scoped> from SelectParentHelper.jsm. r?mconley
MozReview-Commit-ID: HeTSfqFTeVc
--- a/toolkit/modules/SelectParentHelper.jsm
+++ b/toolkit/modules/SelectParentHelper.jsm
@@ -27,27 +27,26 @@ var customStylingEnabled = Services.pref
var usedSelectBackgroundColor;
this.SelectParentHelper = {
populate(menulist, items, selectedIndex, zoom, uaBackgroundColor, uaColor,
uaSelectBackgroundColor, uaSelectColor, selectBackgroundColor, selectColor,
selectTextShadow) {
// Clear the current contents of the popup
menulist.menupopup.textContent = "";
- let stylesheet = menulist.querySelector("#ContentSelectDropdownScopedStylesheet");
+ let stylesheet = menulist.querySelector("#ContentSelectDropdownStylesheet");
if (stylesheet) {
stylesheet.remove();
}
let doc = menulist.ownerDocument;
let sheet;
if (customStylingEnabled) {
stylesheet = doc.createElementNS("http://www.w3.org/1999/xhtml", "style");
- stylesheet.setAttribute("id", "ContentSelectDropdownScopedStylesheet");
- stylesheet.scoped = true;
+ stylesheet.setAttribute("id", "ContentSelectDropdownStylesheet");
stylesheet.hidden = true;
stylesheet = menulist.appendChild(stylesheet);
sheet = stylesheet.sheet;
}
let ruleBody = "";
// Some webpages set the <select> backgroundColor to transparent,
@@ -70,17 +69,17 @@ this.SelectParentHelper = {
}
if (customStylingEnabled &&
selectTextShadow != "none") {
ruleBody += `text-shadow: ${selectTextShadow};`;
}
if (ruleBody) {
- sheet.insertRule(`menupopup {
+ sheet.insertRule(`#ContentSelectDropdown > menupopup {
${ruleBody}
}`, 0);
menulist.menupopup.setAttribute("customoptionstyling", "true");
} else {
menulist.menupopup.removeAttribute("customoptionstyling");
}
currentZoom = zoom;
@@ -292,25 +291,25 @@ function populateChildren(menulist, opti
}
if (customStylingEnabled &&
option.textShadow) {
ruleBody += `text-shadow: ${option.textShadow};`;
}
if (ruleBody) {
- sheet.insertRule(`menupopup > :nth-child(${nthChildIndex}):not([_moz-menuactive="true"]) {
+ sheet.insertRule(`#ContentSelectDropdown > menupopup > :nth-child(${nthChildIndex}):not([_moz-menuactive="true"]) {
${ruleBody}
}`, 0);
if (option.textShadow) {
// Need to explicitly disable the possibly inherited
// text-shadow rule when _moz-menuactive=true since
// _moz-menuactive=true disables custom option styling.
- sheet.insertRule(`menupopup > :nth-child(${nthChildIndex})[_moz-menuactive="true"] {
+ sheet.insertRule(`#ContentSelectDropdown > menupopup > :nth-child(${nthChildIndex})[_moz-menuactive="true"] {
text-shadow: none;
}`, 0);
}
item.setAttribute("customoptionstyling", "true");
} else {
item.removeAttribute("customoptionstyling");
}