Skip to content

Conversation

@BrianBorge
Copy link
Owner

@BrianBorge BrianBorge commented Jun 5, 2020

The DOM

  • The DOM is a tree of nodes 🌲 , so we will need to represent a node. oh, and a node can have child nodes.
  • We also need some node types
    • Text and Element to start and maybe Comment

To Do

  • Create a node
  • Create node types
  • Create the DOM
  • Add tests! (requires setting up a test suite)

Resources

  1. https://limpet.net/mbrubeck/2014/08/08/toy-layout-engine-1.html
  2. https://dom.spec.whatwg.org/
  3. https://dom.spec.whatwg.org/#dom-node-nodetype

@BrianBorge BrianBorge self-assigned this Jun 5, 2020
node_types.rb Outdated
@@ -0,0 +1,18 @@
module NodeTypes
class Text
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should node types inherit from Node?

dom.rb Outdated
require_relative 'node'
require_relative 'node_types'

class Dom
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should probably consider wrapping all the code in a WindowBrowser module.

- organize project folder structure
- NodeTypes inherit from Node
- wrap all the code in a WindowBrowser module
- Add some node methods:
  - first_child: fetch the node's first child
  - children?: fetch the node's children
  - type: fetch the node's type (e.g. WindowBrowser::NodeTypes::Element)
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

Successfully merging this pull request may close these issues.

2 participants