Skip to content

Replace deprecated substr with slice#39771

Merged
wbamberg merged 1 commit intomdn:mainfrom
karelbilek:patch-1
Jun 3, 2025
Merged

Replace deprecated substr with slice#39771
wbamberg merged 1 commit intomdn:mainfrom
karelbilek:patch-1

Conversation

@karelbilek
Copy link
Copy Markdown
Contributor

string.substr() is deprecated; string.slice() is not


Description

This replaces substr, which is deprecated, with slice, which is not deprecated.

Motivation

Substr is deprecated, slice is not deprecated.

Additional details

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr

Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

string.substr() is deprecated; string.slice() is not
@karelbilek karelbilek requested a review from a team as a code owner June 3, 2025 14:47
@karelbilek karelbilek requested review from wbamberg and removed request for a team June 3, 2025 14:47
@github-actions github-actions bot added Content:WebAPI Web API docs size/xs [PR only] 0-5 LoC changed labels Jun 3, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jun 3, 2025

Preview URLs

Copy link
Copy Markdown
Collaborator

@wbamberg wbamberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 thank you @karelbilek !

@wbamberg wbamberg merged commit e1bf895 into mdn:main Jun 3, 2025
7 checks passed
estelle pushed a commit that referenced this pull request Jun 6, 2025
string.substr() is deprecated; string.slice() is not
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:WebAPI Web API docs size/xs [PR only] 0-5 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants