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

On Stream Code Review #1

Open
braddotcoffee opened this issue Oct 28, 2023 · 0 comments
Open

On Stream Code Review #1

braddotcoffee opened this issue Oct 28, 2023 · 0 comments

Comments

@braddotcoffee
Copy link

braddotcoffee commented Oct 28, 2023

General Code Structure

  • PRACTICE BREAKING UP YOUR CODE MORE
  • Your project structure is very flat right now
  • I understand that you're writing pure vanilla JS, but as a learning exercise it would be good to try to do both of the following
    • Separate out some functionality into other vanilla JS files and make some more composable "modules" that way
    • Look into learning about some JavaScript build system like Webpack that will take multiple JS files and build them into one minified "bundle"

Security Discussion

  • In your app you use innerHTML = <div>... to set some HTML from your JavaScript
  • This current implementation is not vulnerable at all because you do not use any data that you got from a user when generating this HTML
  • If you are interested in trying to generate HTML using user input, make sure you use a framework like React, some sort of templating engine, or a XSS prevention library like DOMPurify
  • DOMPurify is how you would handle this if you were still using fully vanilla JS
  • (Overall it might be easiest to just try to avoid altering your HTML in your JS when working with vanilla JS if you need user input)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant