Skip to content

Implementation of the Document Object Model (DOM) in Rust.

License

Notifications You must be signed in to change notification settings

adebola-io/tarantula

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tarantula 🕷

status

This (experimental) project hopes be a (somewhat) faithful implementation of the WHATWG Document Object Model 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.

Theoretical Usage

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(())
}

About

Implementation of the Document Object Model (DOM) in Rust.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published