htmx
htmx copied to clipboard
Get rid of latest usages of substr
Description
Follow up to #2951.
Replace more usages of deprecated String.prototype.substr.
Should I just keep making these, or perhaps we could make this a lint check or something?
Testing
Trivial change
Checklist
- [x] I have read the contribution guidelines
- [x] I have targeted this PR against the correct branch (
masterfor website changes,devfor source changes) - [x] This is either a bugfix, a documentation update, or a new feature that has been explicitly approved via an issue
- [x] I ran the test suite locally (
npm run test) and verified that it succeeded
Added commit to also update affected test file
Once this is merged I'll create another PR to add an eslint rule to enforce it in the future:
"no-restricted-properties": ["error", {
"property": "substr",
"message": "Use .slice or .substring instead of .substr"
}],
Corresponding eslint docs: https://eslint.org/docs/latest/rules/no-restricted-properties