Example usage for com.google.gwt.dom.client BaseElement as

List of usage examples for com.google.gwt.dom.client BaseElement as

Introduction

In this page you can find the example usage for com.google.gwt.dom.client BaseElement as.

Prototype

public static BaseElement as(Element elem) 

Source Link

Document

Assert that the given Element is compatible with this class and automatically typecast it.

Usage

From source file:org.chromium.distiller.PagingLinksFinder.java

License:Open Source License

public static String getBaseUrlForRelative(Element root, String original_url) {
    NodeList<Element> bases = root.getElementsByTagName("BASE");
    if (bases.getLength() == 0) {
        return original_url;
    }/* w  ww  .  jav  a  2 s  . co  m*/
    // Note that base.href can also be relative.
    // If multiple <base> elements are specified, only the first href and
    // first target value are used; all others are ignored.
    // Reference: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
    AnchorElement baseAnchor = createAnchorWithBase(original_url);
    return resolveLinkHref(BaseElement.as(bases.getItem(0)).getAttribute("href"), baseAnchor);
}