school/html-java-script/week11/discussion.org

19 lines
1.9 KiB
Org Mode
Raw Normal View History

2021-03-31 21:56:49 -04:00
* 3 new
** Dom core vs dom HTML spec
This would have been helpful in the previous lesson, though I did manage to figure out myDocumentImage.src does work. I actually couldn't find anything about the core style when searching around.
** Selecting all elements
It's easy to select all the elements of a specific type and put them into an array. I could see this being useful to do something like grabbing all the IMG elements and adding some sort of default alt text if the HTML developer forgot to add them.
** We can toggle classes easily
A simple toggle command can remove and activate classes quickly and easily
* 2 interesting
** Easy to swap classes
We can set a click event to a header to swap classes for it's content. One class hides everything below, a second, reveals it.
** Lot's of JavaScript seems here seems to revolve around swapping.
That is, we want to make boxes get checked, boxes get focus, expand/contract headers, etc...
Largely we just want to swap around CSS elements.
If that's all what the majority of JavaScript in the wild did/does, I think it might not be so bad. But... that's clearly not the case.
* 1 unclear
Why would I use querySelector instead of getElementBy{Id,Name,Class}? The best I can tell is that it's more generic and allows us to use the standard way of grabbing things (using a "#", for example, to grab an id instead of its own function). If that's the case, perhaps I should start using it. I do enjoy less keywords in my programming.
I'd like to add, this lesson's lecture would have helped a lot for the last unit. ZyBooks has a way of being a bit brain melting, this lecture would have helped a lot on knowing where to start with the labs last lesson. Now, to be clear, I'm not having much trouble with last weeks labs, I do pretty well at researching what I need to know, but I still think this video would be valuable for last week's lesson as well.