com.gargoylesoftware.htmlunit.javascript.host.Window.jsxGet_document()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 JavaScript  
字(10.7k)|赞(0)|评价(0)|浏览(125)

本文整理了Java中com.gargoylesoftware.htmlunit.javascript.host.Window.jsxGet_document()方法的一些代码示例,展示了Window.jsxGet_document()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Window.jsxGet_document()方法的具体详情如下:
包路径:com.gargoylesoftware.htmlunit.javascript.host.Window
类名称:Window
方法名:jsxGet_document

Window.jsxGet_document介绍

[英]Returns the JavaScript property "document".
[中]返回JavaScript属性“document”。

代码示例

代码示例来源:origin: org.jenkins-ci/htmlunit

/**
 * Returns the document.
 * @return the document
 */
public HTMLDocument jsxGet_document() {
  return getWindow().jsxGet_document();
}

代码示例来源:origin: org.jvnet.hudson/htmlunit

/**
 * Returns the document.
 * @return the document
 */
public HTMLDocument jsxGet_document() {
  return getWindow().jsxGet_document();
}

代码示例来源:origin: net.disy.htmlunit/htmlunit

/**
 * Returns the document.
 * @return the document
 */
public HTMLDocument jsxGet_document() {
  return getWindow().jsxGet_document();
}

代码示例来源:origin: org.jenkins-ci/htmlunit

/**
 * Returns the document the frame contains, if any.
 * @return <code>null</code> if no document is contained
 * @see <a href="http://www.mozilla.org/docs/dom/domref/dom_frame_ref4.html">
 * Gecko DOM Reference</a>
 */
public HTMLDocument jsxGet_contentDocument() {
  return ((Window) getFrame().getEnclosedWindow().getScriptObject()).jsxGet_document();
}

代码示例来源:origin: net.disy.htmlunit/htmlunit

/**
 * Returns the document the frame contains, if any.
 * @return <code>null</code> if no document is contained
 * @see <a href="http://www.mozilla.org/docs/dom/domref/dom_frame_ref4.html">
 * Gecko DOM Reference</a>
 */
public HTMLDocument jsxGet_contentDocument() {
  return ((Window) getFrame().getEnclosedWindow().getScriptObject()).jsxGet_document();
}

代码示例来源:origin: org.jvnet.hudson/htmlunit

/**
 * Returns the document the frame contains, if any.
 * @return <code>null</code> if no document is contained
 * @see <a href="http://www.mozilla.org/docs/dom/domref/dom_frame_ref4.html">Gecko DOM Reference</a>
 */
public HTMLDocument jsxGet_contentDocument() {
  return ((Window) getFrame().getEnclosedWindow().getScriptObject()).jsxGet_document();
}

代码示例来源:origin: org.jvnet.hudson/htmlunit

/**
 * Returns the document the frame contains, if any.
 * @return <code>null</code> if no document is contained
 * @see <a href="http://www.mozilla.org/docs/dom/domref/dom_frame_ref4.html">
 * Gecko DOM Reference</a>
 */
public HTMLDocument jsxGet_contentDocument() {
  return ((Window) getFrame().getEnclosedWindow().getScriptObject()).jsxGet_document();
}

代码示例来源:origin: org.jenkins-ci/htmlunit

/**
 * Returns the document the frame contains, if any.
 * @return <code>null</code> if no document is contained
 * @see <a href="http://www.mozilla.org/docs/dom/domref/dom_frame_ref4.html">Gecko DOM Reference</a>
 */
public HTMLDocument jsxGet_contentDocument() {
  return ((Window) getFrame().getEnclosedWindow().getScriptObject()).jsxGet_document();
}

代码示例来源:origin: net.disy.htmlunit/htmlunit

/**
 * Returns the document the frame contains, if any.
 * @return <code>null</code> if no document is contained
 * @see <a href="http://www.mozilla.org/docs/dom/domref/dom_frame_ref4.html">Gecko DOM Reference</a>
 */
public HTMLDocument jsxGet_contentDocument() {
  return ((Window) getFrame().getEnclosedWindow().getScriptObject()).jsxGet_document();
}

代码示例来源:origin: net.disy.htmlunit/htmlunit

/**
 * Returns the current document instance, using <tt>thisObj</tt> as a hint.
 * @param thisObj a hint as to the current document (may be the prototype when function is used without "this")
 * @return the current document instance
 */
private static HTMLDocument getDocument(final Scriptable thisObj) {
  // if function is used "detached", then thisObj is the top scope (ie Window), not the real object
  // cf unit test DocumentTest#testDocumentWrite_AssignedToVar
  // may be the prototype too
  // cf DocumentTest#testDocumentWrite_AssignedToVar2
  if (thisObj instanceof HTMLDocument && thisObj.getPrototype() instanceof HTMLDocument) {
    return (HTMLDocument) thisObj;
  }
  final Window window = getWindow(thisObj);
  final BrowserVersion browser = window.getWebWindow().getWebClient().getBrowserVersion();
  if (browser.isIE()) {
    return window.jsxGet_document();
  }
  throw Context.reportRuntimeError("Function can't be used detached from document");
}

代码示例来源:origin: net.disy.htmlunit/htmlunit

/**
 * Sets the object as active without setting focus to the object.
 * @see <a href="http://msdn.microsoft.com/en-us/library/ms536738.aspx">MSDN documentation</a>
 */
public void jsxFunction_setActive() {
  final Window window = getWindow();
  final HTMLDocument document = window.jsxGet_document();
  document.setActiveElement(this);
  if (window.getWebWindow() == window.getWebWindow().getWebClient().getCurrentWindow()) {
    final HtmlElement element = getDomNodeOrDie();
    ((HtmlPage) element.getPage()).setFocusedElement(element);
  }
}

代码示例来源:origin: org.jenkins-ci/htmlunit

/**
 * Sets the object as active without setting focus to the object.
 * @see <a href="http://msdn.microsoft.com/en-us/library/ms536738.aspx">MSDN documentation</a>
 */
public void jsxFunction_setActive() {
  final Window window = getWindow();
  final HTMLDocument document = window.jsxGet_document();
  document.setActiveElement(this);
  if (window.getWebWindow() == window.getWebWindow().getWebClient().getCurrentWindow()) {
    final HtmlElement element = getDomNodeOrDie();
    ((HtmlPage) element.getPage()).setFocusedElement(element);
  }
}

代码示例来源:origin: org.jvnet.hudson/htmlunit

/**
 * Document functions invoked on the window end up executing on the document prototype -- and
 * this is supposed to work when we're emulating IE! So when {@link #getDomNodeOrDie()} or
 * {@link #getDomNodeOrNull()} are invoked on the document prototype (which would usually fail),
 * we need to actually return the real document's DOM node so that other functions which rely
 * on these two functions work. See {@link HTMLDocumentTest#documentMethodsWithoutDocument()}
 * for sample JavaScript code.
 *
 * @return the real document's DOM node, or <tt>null</tt> if we're not emulating IE
 */
private DomNode getDomNodeOrNullFromRealDocument() {
  DomNode node = null;
  final boolean ie = getWindow().getWebWindow().getWebClient().getBrowserVersion().isIE();
  if (ie) {
    final Scriptable scope = getParentScope();
    if (scope instanceof Window) {
      final Window w = (Window) scope;
      final HTMLDocument realDocument = w.jsxGet_document();
      if (realDocument != this) {
        node = realDocument.getDomNodeOrDie();
      }
    }
  }
  return node;
}

代码示例来源:origin: org.jvnet.hudson/htmlunit

/**
 * Returns the current document instance, using <tt>thisObj</tt> as a hint.
 * @param thisObj a hint as to the current document (may be the prototype when function is used without "this")
 * @return the current document instance
 */
private static HTMLDocument getDocument(final Scriptable thisObj) {
  // if function is used "detached", then thisObj is the top scope (ie Window), not the real object
  // cf unit test DocumentTest#testDocumentWrite_AssignedToVar
  // may be the prototype too
  // cf DocumentTest#testDocumentWrite_AssignedToVar2
  if (thisObj instanceof HTMLDocument && thisObj.getPrototype() instanceof HTMLDocument) {
    return (HTMLDocument) thisObj;
  }
  final Window window = getWindow(thisObj);
  final BrowserVersion browser = window.getWebWindow().getWebClient().getBrowserVersion();
  if (browser.isIE()) {
    return window.jsxGet_document();
  }
  throw Context.reportRuntimeError("Function can't be used detached from document");
}

代码示例来源:origin: org.jenkins-ci/htmlunit

/**
 * Returns the current document instance, using <tt>thisObj</tt> as a hint.
 * @param thisObj a hint as to the current document (may be the prototype when function is used without "this")
 * @return the current document instance
 */
private static HTMLDocument getDocument(final Scriptable thisObj) {
  // if function is used "detached", then thisObj is the top scope (ie Window), not the real object
  // cf unit test DocumentTest#testDocumentWrite_AssignedToVar
  // may be the prototype too
  // cf DocumentTest#testDocumentWrite_AssignedToVar2
  if (thisObj instanceof HTMLDocument && thisObj.getPrototype() instanceof HTMLDocument) {
    return (HTMLDocument) thisObj;
  }
  final Window window = getWindow(thisObj);
  final BrowserVersion browser = window.getWebWindow().getWebClient().getBrowserVersion();
  if (browser.isIE()) {
    return window.jsxGet_document();
  }
  throw Context.reportRuntimeError("Function can't be used detached from document");
}

代码示例来源:origin: org.jenkins-ci/htmlunit

/**
 * Document functions invoked on the window end up executing on the document prototype -- and
 * this is supposed to work when we're emulating IE! So when {@link #getDomNodeOrDie()} or
 * {@link #getDomNodeOrNull()} are invoked on the document prototype (which would usually fail),
 * we need to actually return the real document's DOM node so that other functions which rely
 * on these two functions work. See {@link HTMLDocumentTest#documentMethodsWithoutDocument()}
 * for sample JavaScript code.
 *
 * @return the real document's DOM node, or <tt>null</tt> if we're not emulating IE
 */
private DomNode getDomNodeOrNullFromRealDocument() {
  DomNode node = null;
  final boolean ie = getWindow().getWebWindow().getWebClient().getBrowserVersion().isIE();
  if (ie) {
    final Scriptable scope = getParentScope();
    if (scope instanceof Window) {
      final Window w = (Window) scope;
      final HTMLDocument realDocument = w.jsxGet_document();
      if (realDocument != this) {
        node = realDocument.getDomNodeOrDie();
      }
    }
  }
  return node;
}

代码示例来源:origin: net.disy.htmlunit/htmlunit

/**
 * Document functions invoked on the window end up executing on the document prototype -- and
 * this is supposed to work when we're emulating IE! So when {@link #getDomNodeOrDie()} or
 * {@link #getDomNodeOrNull()} are invoked on the document prototype (which would usually fail),
 * we need to actually return the real document's DOM node so that other functions which rely
 * on these two functions work. See {@link HTMLDocumentTest#documentMethodsWithoutDocument()}
 * for sample JavaScript code.
 *
 * @return the real document's DOM node, or <tt>null</tt> if we're not emulating IE
 */
private DomNode getDomNodeOrNullFromRealDocument() {
  DomNode node = null;
  final boolean ie = getWindow().getWebWindow().getWebClient().getBrowserVersion().isIE();
  if (ie) {
    final Scriptable scope = getParentScope();
    if (scope instanceof Window) {
      final Window w = (Window) scope;
      final HTMLDocument realDocument = w.jsxGet_document();
      if (realDocument != this) {
        node = realDocument.getDomNodeOrDie();
      }
    }
  }
  return node;
}

代码示例来源:origin: org.jvnet.hudson/htmlunit

/**
 * Sets the object as active without setting focus to the object.
 * @see <a href="http://msdn.microsoft.com/en-us/library/ms536738.aspx">MSDN documentation</a>
 */
public void jsxFunction_setActive() {
  final Window window = getWindow();
  final HTMLDocument document = window.jsxGet_document();
  document.setActiveElement(this);
  if (window.getWebWindow() == window.getWebWindow().getWebClient().getCurrentWindow()) {
    final HtmlElement element = getDomNodeOrDie();
    ((HtmlPage) element.getPage()).setFocusedElement(element);
  }
}

代码示例来源:origin: org.jvnet.hudson/htmlunit

final Window jsWindow = (Window) window.getScriptObject();
jsWindow.setDomNode(openerPage);
jsWindow.jsxGet_document().setDomNode(openerPage);

代码示例来源:origin: net.disy.htmlunit/htmlunit

final Window jsWindow = (Window) window.getScriptObject();
jsWindow.setDomNode(openerPage);
jsWindow.jsxGet_document().setDomNode(openerPage);

相关文章

微信公众号