Releases: mild-times/localghost
v0.2.0
This patch removes dom::ElementKind
in favor of using string literals, and introduces improvements to CI and documentation.
Removal of dom::ElementKind
In the 0.1.x
release of localghost
creating DOM elements had a mandatory ElementKind
argument:
use localghost::prelude::*;
use localghost::dom::{self, Element, ElementKind};
let p = Element::with_text(ElementKind::P, "Hello world");
dom::body().append(p);
We've removed this API as part of our 0.2.0
release and replaced with with a string interface instead:
use localghost::prelude::*;
use localghost::dom::{self, Element};
let el = Element::with_text("p", "Hello world");
body().append(el);
The reason for this removal is that while it may feel less ergonomic for end-users to write, it should feel more ergonomic to use as the basis for frameworks and tooling. localghost
is in a peculiar spot where it exists to be built upon, but still useful by itself. localghost
is in an odd spot where it tries to make working with the Web platform feel first-class, but it does not try to provide more guarantees than those that are provided by the platform. In this case for example we were accidentally disallowing the creation of custom elements. We need to be able to provide maximum flexibility within the parameters of the platform.
The hope is that higher-level crates such as dodrio
can bring stronger guarantees around aliasing, naming, and typing. With localghost
being able to abstract away the platform bindings.
Removed
- Remove
dom::ElementKind
#6