Skip to content

Commit 0f89fee

Browse files
committed
Replace use of substr
1 parent 3af54a8 commit 0f89fee

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/scripts/h5p-crossword-input.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ export default class CrosswordInput {
206206
const start = inputField.selectionStart;
207207
console.log(event.key, inputField.value, start);
208208

209-
inputField.value = `${inputField.value.substr(0, start + 1)}${inputField.value.substr(start + 1)}`;
209+
inputField.value = `${inputField.value.substring(0, start + 1)}${inputField.value.substring(start + 1)}`;
210210
inputField.selectionEnd = start + 1;
211211

212212
/*
@@ -286,7 +286,9 @@ export default class CrosswordInput {
286286
event.preventDefault();
287287

288288
const text = event.clipboardData.getData('text');
289-
this.setInputFieldValue(inputField, text.substr(0, inputField.getAttribute('maxLength')));
289+
this.setInputFieldValue(
290+
inputField, text.substring(0, inputField.getAttribute('maxLength'))
291+
);
290292
});
291293

292294
const listLabel = this.params.a11y.resultFor

src/scripts/h5p-crossword-table.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ export default class CrosswordTable {
206206
stemCells[row][column] = {
207207
row: row,
208208
column: column,
209-
solution: cell.answer.substr(i, 1),
209+
solution: cell.answer.substring(i, i + 1),
210210
solutionLength: cell.answer.length,
211211
solutionIndex: i + 1,
212212
clue: cell.clue,

0 commit comments

Comments
 (0)