summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-05-23 13:20:38 -0400
committerGitHub <noreply@github.com>2021-05-23 13:20:38 -0400
commit24d43c123dbb79db97e4a28f4e92d697c2aac1b2 (patch)
tree5bda00b30afa1ae174d1ad33c4bd603188630540
parent41c0132c59a31c6d8bcc711b94b0859349e88f9b (diff)
Fix incorrect selector causing invalid headword index to be used (#1705)
-rw-r--r--ext/js/display/display-audio.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/js/display/display-audio.js b/ext/js/display/display-audio.js
index 4a1f6305..d8553547 100644
--- a/ext/js/display/display-audio.js
+++ b/ext/js/display/display-audio.js
@@ -283,7 +283,7 @@ class DisplayAudio {
}
_getAudioPlayButtonHeadwordIndex(button) {
- const headwordNode = button.closest('.expression');
+ const headwordNode = button.closest('.headword');
if (headwordNode !== null) {
const headwordIndex = parseInt(headwordNode.dataset.index, 10);
if (Number.isFinite(headwordIndex)) { return headwordIndex; }
@@ -297,7 +297,7 @@ class DisplayAudio {
if (dictionaryEntryIndex >= 0 && dictionaryEntryIndex < dictionaryEntryNodes.length) {
const node = dictionaryEntryNodes[dictionaryEntryIndex];
const button1 = (headwordIndex === 0 ? node.querySelector('.action-play-audio') : null);
- const button2 = node.querySelector(`.expression:nth-of-type(${headwordIndex + 1}) .action-play-audio`);
+ const button2 = node.querySelector(`.headword:nth-of-type(${headwordIndex + 1}) .action-play-audio`);
if (button1 !== null) { results.push(button1); }
if (button2 !== null) { results.push(button2); }
}