Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript and the DOM Making Changes to the DOM Insert HTML at Specified Positions

Malachi Gruenhagen
Malachi Gruenhagen
3,226 Points

FYI, these DOM manipulation tutorials should probably include some discussion of code injection attacks.

FYI, these DOM manipulation tutorials should probably include some discussion of code injection attacks.

1 Answer

Steven Parker
Steven Parker
220,450 Points

I noticed the example only safely inserts user-supplied values to textContent, but a quick mention that user values should never be inserted as code wouldn't be amiss.

There are, however, separate security courses that should be part of every aspiring developer's curriculum.

Wow, okay, you've both given me a bit to think about here! Malachi Gruenhagen - nice pickup in your review of the video, and Steven Parker, as always you've been an invaluable asset to the community! I'll think about a meaningful comment to add to the Teacher's Notes for this video, and suggest that students look further into the course material that Steven has suggested! :-D

Edit: Done!