Simulating Visual Rendering
- Dominant language
- Go
- Stars
- 300
- Forks
- 15
- PR merge metrics
- No merged PRs in 30d
Description
> [!WARNING]
> There is no intention to support this feature! This is merely speculation.
Some parts of the [CSS Object Model] received dummy implementations to support CodeMirror. Code mirror performs quite a few checks, comparing sizes of elements against window viewport sizes, e.g., to determine if it should scroll to content.
While there is no intention the core of Gost-DOM to support this;
## The Component Model
At the time of writing this; some refactoring is taking place, moving some responsibility into "components", from a system inspired by the "Entity, Component, System" model.
Each node in the DOM is an _entity_ and entities can contain a no of "Components". A "Component" is intended to support behaviour; but have no state of its own. This is meant as a solution to the problem that the DOM spec is inherently object-oriented in nature, but Go isn't.
Different "systems" could be implemented in terms of such components; currently HTML rendering follows this, but more problems will probably have their solutions moved to this methodology.
So you could _potentially_ add a component to HTML/SVG/MathML elements that can calculate their sizes, and as such, keep the implementation of sizing completely decoupled from the code DOM implementation.
### Example: `innerHTML`/`outerHTML`
HTML rendering uses the component system to implement `` elements. Template elements render HTML differently from other elements; as they don't have children in the DOM. Instead, their content is a document fragment; and it is the contents of that fragment which is rendered.
This is implemented by adding a `Renderer` component to template elements. The implementation of HTML rendering delegates rendering to the `Renderer` if the current element has one; otherwise falls back to a default implementation.
[CSS Object Model]: https://developer.mozilla.org/en-US/docs/Web/API/CSS_Object_Model
Contributor guide
Research direction
This is a speculative design note with no implementation target, file paths, tests, or defined completion criteria. Start by reading the component model and HTML rendering described here, including the Renderer component used for template elements. The issue does not specify what would count as done.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100