content icon indicating copy to clipboard operation
content copied to clipboard

Deprecation notice without providing a recommended "use instead"

Open EdmundsEcho opened this issue 3 years ago • 3 comments

MDN URL

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

What specific section or headline is this issue about?

Deprecation notice

What information was incorrect, unhelpful, or incomplete?

Generally I am used to seeing a deprecation notice combined with a "use instead". I would propose a specific fix myself but don't know the recommended way to accomplish a string substitution operation. I'll be figuring that out next... and thus the suggested update. My guess would be to use replace.

What did you expect to see?

At minimum links at the bottom of the page that suggests "see also". Better would be to include something in the deprecation notice.

Do you have any supporting links, references, or citations?

No response

Do you have anything more you want to share?

No response

MDN metadata

Page report details
  • Folder: en-us/web/javascript/reference/global_objects/string/sub
  • MDN URL: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/sub
  • GitHub URL: https://github.com/mdn/content/blob/main/files/en-us/web/javascript/reference/global_objects/string/sub/index.md
  • Last commit: https://github.com/mdn/content/commit/ce2909126eb09e44c9f48d9f65d072acae827749
  • Document last modified: 2022-09-13T07:09:29.000Z

EdmundsEcho avatar Sep 21 '22 14:09 EdmundsEcho

accomplish a string substitution operation

sub() is not "substitution". If you read below, it's for turning a string into a <sub> element string. You should use createElement() for that. You are looking for replace().

Josh-Cena avatar Sep 21 '22 14:09 Josh-Cena

This info should be added to this page.

teoli2003 avatar Sep 21 '22 14:09 teoli2003

Add the note that we should use createElement instead?

Josh-Cena avatar Sep 21 '22 14:09 Josh-Cena