Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use msg more in documentation code snippets #325

Open
mybearworld opened this issue Apr 30, 2023 · 3 comments
Open

Use msg more in documentation code snippets #325

mybearworld opened this issue Apr 30, 2023 · 3 comments
Labels
help wanted Extra attention is needed scope: docs Related to the documentation (Scratch Addons Docs) type: enhancement New feature or request

Comments

@mybearworld
Copy link
Contributor

mybearworld commented Apr 30, 2023

For example, https://scratchaddons.com/docs/develop/userscripts/best-practices/ has the following code snippet:

// Do this instead:
document.querySelector(".remix-button").addEventListener("click", () => {
  prompt("Are you sure you want to remix?");
});

Which probably should be something like:

// Do this instead:
document.querySelector(".remix-button").addEventListener("click", () => {
  prompt(msg("remix-confirm"));
});
@mxmou mxmou added type: enhancement New feature or request scope: docs Related to the documentation (Scratch Addons Docs) labels Apr 30, 2023
@WorldLanguages
Copy link
Member

That specific example is about XSS, so using msg() there can make it confusing. It becomes more complicated to explain because safeMsg would also be worth mentioning. Also, the reader might incorrectly interpret that msg() avoids XSS, instead of el.textContent.

I guess we could add a code comment such as: // Note: real userscript code should use msg() here

@mybearworld
Copy link
Contributor Author

That specific example is about XSS, so using msg() there can make it confusing. It becomes more complicated to explain because safeMsg would also be worth mentioning. Also, the reader might incorrectly interpret that msg() avoids XSS, instead of el.textContent.

I guess we could add a code comment such as: // Note: real userscript code should use msg() here

True, that specific example was poorly chosen, I'll replace it with another one.

@WorldLanguages
Copy link
Member

I believe we should keep the current examples, but we could add a comment such as // Note: real userscript code should use msg() here next to the lines that use hardcoded strings.

@Hans5958 Hans5958 added the help wanted Extra attention is needed label Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed scope: docs Related to the documentation (Scratch Addons Docs) type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants