Skip to content

Commit 653de05

Browse files
committed
Fixed the github edit page breakage
1 parent e6173bd commit 653de05

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

content.js

+12-2
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,23 @@ function getBackToDefaultScrollbars() {
1212
var ruleSet = sheet.rules || sheet.cssRules;
1313
for (var i = 0; i < ruleSet.length; ++i) {
1414
var rule = ruleSet[i];
15-
if (/scrollbar/.test(rule.selectorText)) {
15+
if (!rule.selectorText) {
16+
continue;
17+
}
18+
if (rule.selectorText.indexOf("::-webkit-scrollbar") >= 0) {
1619
console.log("deleting scrollbar css rule at", sheet.href);
20+
console.debug("css rule deleted is", rule);
1721
sheet.deleteRule(i--);
22+
} else if (rule.selectorText.indexOf("scrollbar") >= 0) {
23+
// Github has some classes that are called "scrollbar"
24+
// that if we delete them will break the file edit page.
25+
// So this section is an attempt to debug similar cases if
26+
// they arise.
27+
console.debug("fishy scrollbar selector rule, but not deleting", rule);
1828
}
1929
}
2030
} catch (e) {
21-
console.warn("Can't read the css rules of: " + sheet.href, e);
31+
console.debug("Can't read the css rules of: " + sheet.href, e);
2232
failedSheets[sheet.href] = true;
2333
}
2434
};

0 commit comments

Comments
 (0)