https://github.com/adebola-io/tarantula
Implementation of the Document Object Model (DOM) in Rust.
https://github.com/adebola-io/tarantula
css dom html layout rust web
Last synced: about 1 month ago
JSON representation
Implementation of the Document Object Model (DOM) in Rust.
- Host: GitHub
- URL: https://github.com/adebola-io/tarantula
- Owner: adebola-io
- License: mit
- Created: 2023-05-26T09:40:28.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2023-07-21T07:03:38.000Z (almost 3 years ago)
- Last Synced: 2025-08-24T14:37:44.405Z (10 months ago)
- Topics: css, dom, html, layout, rust, web
- Language: Rust
- Homepage:
- Size: 342 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Tarantula 🕷
[](https://github.com/adebola-io/tarantula/tree/master)
This (experimental) project hopes be a (somewhat) faithful implementation of the [WHATWG Document Object Model](https://dom.spec.whatwg.org/) in Rust.
The purpose is to see how possible it is to wrangle the DOM out of Javascript and squeeze it into a Rust API, possibly for GUI clients, who knows.
Because of the differences in the languages, The API **will** diverge from the specification in situations where there is no feasible implementation. A list of all concessions and compromises so far can be seen [here](https://github.com/adebola-io/tarantula/blob/master/docs/notes.md).
## Theoretical Usage
```rust
use tarantula::prelude::*;
fn main() {
if let Err(e) = Window::new("index.html", context, None).run() {
eprintln!("{}", e);
std::process::exit(1);
};
}
fn context(mut window: Window) -> DOMResult {
let mut document = window.document();
let mut element = document.create_element("div");
element.set_inner_text("Hello, there!");
element.style_mut().set_property("color", "green");
document.body_mut().append(&mut element)?;
Ok(())
}
```