use of com.gargoylesoftware.htmlunit.javascript.configuration.JsxGetter in project htmlunit by HtmlUnit.
the class HTMLTemplateElement method getContent.
/**
* @return the value of the {@code content} property
*/
@JsxGetter
public DocumentFragment getContent() {
final DocumentFragment result = new DocumentFragment();
result.setPrototype(getPrototype(result.getClass()));
result.setParentScope(getParentScope());
result.setDomNode(((HtmlTemplate) getDomNodeOrDie()).getContent());
return result;
}
use of com.gargoylesoftware.htmlunit.javascript.configuration.JsxGetter in project htmlunit by HtmlUnit.
the class CSSStyleSheet method getHref.
/**
* Returns the URL of the stylesheet.
* @return the URL of the stylesheet
*/
@JsxGetter
public String getHref() {
if (ownerNode_ != null) {
final DomNode node = ownerNode_.getDomNodeOrDie();
if (node instanceof HtmlStyle) {
return null;
}
if (node instanceof HtmlLink) {
// <link rel="stylesheet" type="text/css" href="..." />
final HtmlLink link = (HtmlLink) node;
final String href = link.getHrefAttribute();
if ("".equals(href) && getBrowserVersion().hasFeature(STYLESHEET_HREF_EMPTY_IS_NULL)) {
return null;
}
// Expand relative URLs.
try {
final HtmlPage page = (HtmlPage) link.getPage();
final URL url = page.getFullyQualifiedUrl(href);
return url.toExternalForm();
} catch (final MalformedURLException e) {
// Log the error and fall through to the return values below.
LOG.warn(e.getMessage(), e);
}
}
}
return getUri();
}
use of com.gargoylesoftware.htmlunit.javascript.configuration.JsxGetter in project htmlunit by HtmlUnit.
the class Document method getReferrer.
/**
* Returns the value of the {@code referrer} property.
* @return the value of the {@code referrer} property
*/
@JsxGetter
public String getReferrer() {
String referrer = "";
final WebResponse webResponse = getPage().getWebResponse();
if (webResponse != null) {
referrer = webResponse.getWebRequest().getAdditionalHeaders().get(HttpHeader.REFERER);
if (referrer == null) {
referrer = "";
}
}
return referrer;
}
use of com.gargoylesoftware.htmlunit.javascript.configuration.JsxGetter in project htmlunit by HtmlUnit.
the class MediaQueryList method isMatches.
/**
* Returns whether the document currently matches the media query list or not.
* @return whether the document currently matches the media query list or not
*/
@JsxGetter
public boolean isMatches() {
final CSSErrorHandler errorHandler = getWindow().getWebWindow().getWebClient().getCssErrorHandler();
final MediaListImpl mediaList = CSSStyleSheet.parseMedia(errorHandler, media_);
return CSSStyleSheet.isActive(this, mediaList);
}
use of com.gargoylesoftware.htmlunit.javascript.configuration.JsxGetter in project htmlunit by HtmlUnit.
the class Node method getChildNodes.
/**
* Returns the child nodes of the current element.
* @return the child nodes of the current element
*/
@JsxGetter
public NodeList getChildNodes() {
if (childNodes_ == null) {
final DomNode node = getDomNodeOrDie();
childNodes_ = new NodeList(node, false) {
@Override
protected List<DomNode> computeElements() {
final List<DomNode> response = new ArrayList<>();
for (final DomNode child : node.getChildren()) {
response.add(child);
}
return response;
}
};
}
return childNodes_;
}
Aggregations