htmx icon indicating copy to clipboard operation
htmx copied to clipboard

Replace deprecated String.prototype.substr usage

Open scrhartley opened this issue 1 year ago • 0 comments

Description

Inspired by the already merged in extensions PR #100.

On String, the substr method is deprecated and is not part of the main ECMAScript specification (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr). Replace with the alternatives slice and substring, which are both already used in the codebase.

Testing

I made sure that giving bad values caused the existing test cases to fail. I temporarily added additionally logging to verify that it was doing what I expected. I checked that most of the changes are trivial so that this could be considered as a single change.

Checklist

  • [x] I have read the contribution guidelines
  • [x] I have targeted this PR against the correct branch (master for website changes, dev for 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

scrhartley avatar Oct 07 '24 21:10 scrhartley