fn base_pathname() -> String {
    match web_sys::window()
        .unwrap_throw()
        .document()
        .unwrap_throw()
        .query_selector("base[href]")
    {
        Ok(Some(base)) => {
            let base = base.unchecked_into::<HtmlBaseElement>().href();

            let url = web_sys::Url::new(&base).unwrap_throw();
            let mut pathname = url.pathname();
            // Strip trailing `/` character from the pathname.
            pathname.ends_with('/');
            pathname.pop(); // Pop the `/` character.
            pathname
        }
        _ => "".to_string(),
    }
}
/// Gets the base pathname from `document.baseURI`.
Gets the base pathname from `document.baseURI`.
Gets the base pathname from ` document . baseURI ` .
fn base_pathname() -> String {
    match web_sys::window()
        .unwrap_throw()
        .document()
        .unwrap_throw()
        .query_selector("base[href]")
    {
        Ok(Some(base)) => {
            let base = base.unchecked_into::<HtmlBaseElement>().href();
            let url = web_sys::Url::new(&base).unwrap_throw();
            let mut pathname = url.pathname();
            // Strip trailing `/` character from the pathname.
            pathname.ends_with('/');
            pathname.pop(); // Pop the `/` character.
            pathname
        }
        _ => "".to_string(),
    }
}
fn base_pathname ( ) -> String { match web_sys :: window ( ) . unwrap_throw ( ) . document ( ) . unwrap_throw ( ) . query_selector ( " " ) { Ok ( Some ( base ) ) => { let base = base . unchecked_into :: < HtmlBaseElement > ( ) . href ( ) ; let url = web_sys :: Url :: new ( & base ) . unwrap_throw ( ) ; let mut pathname = url . pathname ( ) ; // Strip trailing `/` character from the pathname. pathname . ends_with ( '/' ) ; pathname . pop ( ) ; // Pop the `/` character. pathname } _ => " " . to_string ( ) , } }
Gets the base pathname from `document.baseURI`.
Gets the base pathname from ` document . baseURI ` .