Skip to content

Commit

Permalink
Array.from() -> Array.prototype.slice.call() in free sort and maxdiff…
Browse files Browse the repository at this point in the history
… plugins
  • Loading branch information
Max-Lovell committed Aug 6, 2024
1 parent 3906daa commit 51ebc54
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/plugin-free-sort/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ class FreeSortPlugin implements JsPsychPlugin<Info> {
let cur_in = false;

// draggable items
const draggables = Array.from(
const draggables = Array.prototype.slice.call(
display_element.querySelectorAll<HTMLImageElement>(".jspsych-free-sort-draggable")
);

Expand Down
12 changes: 6 additions & 6 deletions packages/plugin-maxdiff/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,12 @@ class MaxdiffPlugin implements JsPsychPlugin<Info> {
// check response
if (trial.required) {
// Now check if one of both left and right have been enabled to allow submission
var left_checked = Array.from(document.getElementsByName("left")).some(
(c: HTMLInputElement) => c.checked
);
var right_checked = Array.from(document.getElementsByName("right")).some(
(c: HTMLInputElement) => c.checked
);
var left_checked = Array.prototype.slice
.call(document.getElementsByName("left"))
.some((c: HTMLInputElement) => c.checked);
var right_checked = Array.prototype.slice
.call(document.getElementsByName("right"))
.some((c: HTMLInputElement) => c.checked);
if (left_checked && right_checked) {
(document.getElementById("jspsych-maxdiff-next") as HTMLInputElement).disabled =
false;
Expand Down

0 comments on commit 51ebc54

Please sign in to comment.