/** * Retrieves the parent element for the given text range. * The parent element is the element that completely encloses the text in the range. * If the text range spans text in more than one element, this method returns the smallest element that encloses * all the elements. When you insert text into a range that spans multiple elements, the text is placed in the * parent element rather than in any of the contained elements. * * @see <a href="http://msdn.microsoft.com/en-us/library/ms536654.aspx">MSDN doc</a> * @return the parent element object if successful, or null otherwise. */ public Object jsxFunction_parentElement() { final org.w3c.dom.Node parent = range_.getCommonAncestorContainer(); return getScriptableFor(parent); }
/** * Retrieves the parent element for the given text range. * The parent element is the element that completely encloses the text in the range. * If the text range spans text in more than one element, this method returns the smallest element that encloses * all the elements. When you insert text into a range that spans multiple elements, the text is placed in the * parent element rather than in any of the contained elements. * * @see <a href="http://msdn.microsoft.com/en-us/library/ms536654.aspx">MSDN doc</a> * @return the parent element object if successful, or null otherwise. */ public Object jsxFunction_parentElement() { final org.w3c.dom.Node parent = range_.getCommonAncestorContainer(); return getScriptableFor(parent); }
/** * Retrieves the parent element for the given text range. * The parent element is the element that completely encloses the text in the range. * If the text range spans text in more than one element, this method returns the smallest element that encloses * all the elements. When you insert text into a range that spans multiple elements, the text is placed in the * parent element rather than in any of the contained elements. * * @see <a href="http://msdn.microsoft.com/en-us/library/ms536654.aspx">MSDN doc</a> * @return the parent element object if successful, or null otherwise. */ public Object jsxFunction_parentElement() { final org.w3c.dom.Node parent = range_.getCommonAncestorContainer(); return getScriptableFor(parent); }
_commonAncestor = _range.getCommonAncestorContainer();
/** * Retrieves the HTML fragment contained within the range. * @return the HTML fragment contained within the range */ @JsxGetter public String getHtmlText() { final org.w3c.dom.Node node = range_.getCommonAncestorContainer(); if (null == node) { return ""; } final HTMLElement element = (HTMLElement) getScriptableFor(node); return element.getOuterHTML(); // TODO: not quite right, but good enough for now }
/** * Retrieves the HTML fragment contained within the range. * @return the HTML fragment contained within the range */ @JsxGetter public String getHtmlText() { final org.w3c.dom.Node node = range_.getCommonAncestorContainer(); if (null == node) { return ""; } final HTMLElement element = (HTMLElement) getScriptableFor(node); return element.getOuterHTML(); // TODO: not quite right, but good enough for now }
/** * Retrieves the parent element for the given text range. * The parent element is the element that completely encloses the text in the range. * If the text range spans text in more than one element, this method returns the smallest element that encloses * all the elements. When you insert text into a range that spans multiple elements, the text is placed in the * parent element rather than in any of the contained elements. * * @see <a href="http://msdn.microsoft.com/en-us/library/ms536654.aspx">MSDN doc</a> * @return the parent element object if successful, or null otherwise. */ @JsxFunction public Node parentElement() { final org.w3c.dom.Node parent = range_.getCommonAncestorContainer(); if (null == parent) { if (null == range_.getStartContainer() || null == range_.getEndContainer()) { try { final Window window = (Window) getParentScope(); final HtmlPage page = (HtmlPage) window.getDomNodeOrDie(); return (Node) getScriptableFor(page.getBody()); } catch (final Exception e) { // ok bad luck } } return null; } return (Node) getScriptableFor(parent); }
.getCommonAncestorContainer(), NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_CDATA_SECTION, f, false); Box box;
.getCommonAncestorContainer(), NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_CDATA_SECTION, f, false); Box box;
.getCommonAncestorContainer(), NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_CDATA_SECTION, f, false); Box box = getElementContainerBox(t1);
/** * Retrieves the parent element for the given text range. * The parent element is the element that completely encloses the text in the range. * If the text range spans text in more than one element, this method returns the smallest element that encloses * all the elements. When you insert text into a range that spans multiple elements, the text is placed in the * parent element rather than in any of the contained elements. * * @see <a href="http://msdn.microsoft.com/en-us/library/ms536654.aspx">MSDN doc</a> * @return the parent element object if successful, or null otherwise. */ @JsxFunction public Node parentElement() { final org.w3c.dom.Node parent = range_.getCommonAncestorContainer(); if (null == parent) { if (null == range_.getStartContainer() || null == range_.getEndContainer()) { try { final Window window = (Window) getParentScope(); final HtmlPage page = (HtmlPage) window.getDomNodeOrDie(); return (Node) getScriptableFor(page.getBody()); } catch (final Exception e) { // ok bad luck } } return null; } return (Node) getScriptableFor(parent); }