Skip to content

Commit 24ce0c0

Browse files
committed
Pandora: Optimisation/code readability.
1 parent 5a8ac5e commit 24ce0c0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

PandoraA11yFixes.user.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,14 @@ function fixButton(target) {
2222
var classes = target.classList;
2323
if (!classes)
2424
return;
25-
for (var cls in BUTTONS_LABELS) {
26-
if (!classes.contains(cls))
25+
for (var i = 0; i < classes.length; ++i) {
26+
var cls = classes[i];
27+
var label = BUTTONS_LABELS[cls];
28+
if (!label)
2729
continue;
2830
var button = target.firstChild;
2931
button.setAttribute("role", "button");
30-
button.setAttribute("aria-label", BUTTONS_LABELS[cls]);
32+
button.setAttribute("aria-label", label);
3133
if (cls == "thumbUpButton")
3234
button.setAttribute("aria-pressed",
3335
classes.contains("indicator") ? "true" : "false");

0 commit comments

Comments
 (0)