JS: use slice() instead of splice()

slice() does the same as splice() without the unintended effect of
transforming the array.
This commit is contained in:
miruka 2019-10-24 08:09:33 -04:00
parent 5522de5165
commit 756edc90dd
3 changed files with 3 additions and 4 deletions

View File

@ -45,7 +45,6 @@
- Fixes - Fixes
- Newlines and quote after newline in room subtitle - Newlines and quote after newline in room subtitle
- Remove usage of `splice()`
- Event delegates changing height don't scroll the list - Event delegates changing height don't scroll the list
- When selecting text and scrolling up, selection stops working after a while - When selecting text and scrolling up, selection stops working after a while
- Ensure all the text that should be copied is copied - Ensure all the text that should be copied is copied

View File

@ -36,7 +36,7 @@ Rectangle {
readonly property int deleteCharsOnBackspace: readonly property int deleteCharsOnBackspace:
lineTextUntilCursor.match(/^ +$/) ? lineTextUntilCursor.match(/^ +$/) ?
lineTextUntilCursor.match(/ {1,4}/g).splice(-1)[0].length : lineTextUntilCursor.match(/ {1,4}/g).slice(-1)[0].length :
1 1
// property var pr: lineTextUntilCursor // property var pr: lineTextUntilCursor

View File

@ -289,6 +289,6 @@ function copyToClipboard(text) {
function urlExtension(url) { function urlExtension(url) {
return url.toString().split("/").splice(-1)[0].split("?")[0].split(".") return url.toString().split("/").slice(-1)[0].split("?")[0].split(".")
.splice(-1)[0].toLowerCase() .slice(-1)[0].toLowerCase()
} }