dom dom dom dom DOM

I’m actually catching up on my JavaScript class this week and have stumbled upon this post that I started a little while ago. While I definitely recognize the contents here, the context is a bit lost at this point. Any on lookers can simply take this as notes jotted down while trying to ingest all the information that was flowing at the time. There’s not much application included and at best this is a mere reference sheet to reflect on.

Window, Location, Document

Where you load the script in HTML matters. It affects how the page is drawn as well as whether your scripts will be able to query the objects it that it is referencing.

querySelector – find the first matching item
querySelectorAll – create an array of all matching items

Node – everything is a node
Element – a node that has been upgraded to an element with a tag

Properties
textContent – text+style contained within element that is selcted (including text that might currently be hidden with style tags)
innerText – only the rendered, human-readable text in element
innerHTML – code contained within selected element
outerHTML – code contained within selected element + surrounding HTML tag
add
remove
toggle
contains
className, classList (newer)

Methods
insertAdjacent…

Attributes
properties of HTML elements (the normally inline values)