use crate::error::{Error, Result};
use web_sys::{Document, Element};
pub fn doc() -> Result<Document> {
let window = web_sys::window().ok_or(Error::Other("no window"))?;
let doc = window.document().ok_or(Error::Other("no document"))?;
Ok(doc)
}
pub fn lookup_id(id: &str) -> Result<Element> {
let elem = doc()?
.get_element_by_id(id)
.ok_or(Error::Other("elem not found"))?;
Ok(elem)
}