Skip to content

Simulating Visual Rendering #262

Description

@stroiman

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 <template> 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    somedayThis is a feature specified by the DOM spec, but is less useful for a modern web app.

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions