Package com.gargoylesoftware.htmlunit.html

Examples of com.gargoylesoftware.htmlunit.html.DomDocumentFragment


    /**
     * Creates an empty {@link DomDocumentFragment} object.
     * @return a newly created {@link DomDocumentFragment}
     */
    public DomDocumentFragment createDomDocumentFragment() {
        return new DomDocumentFragment(this);
    }
View Full Code Here


     * @return a document fragment
     * @see <a href="http://developer.mozilla.org/en/docs/DOM:range.createContextualFragment">Mozilla documentation</a>
     */
    public Object jsxFunction_createContextualFragment(final String valueAsString) {
        final SgmlPage page = startContainer_.<DomNode>getDomNodeOrDie().getPage();
        final DomDocumentFragment fragment = new DomDocumentFragment(page);
        HTMLElement.parseHtmlSnippet(fragment, true, valueAsString);
        return fragment.getScriptObject();
    }
View Full Code Here

            //if the parentNode has null parentNode in IE,
            //create a DocumentFragment to be the parentNode's parentNode.
            if (!(parentNode instanceof SgmlPage)
                    && !(this instanceof DocumentFragment) && parentNode.getParentNode() == null
                    && getBrowserVersion().isIE()) {
                final DomDocumentFragment fragment = parentNode.getPage().createDomDocumentFragment();
                fragment.appendChild(parentNode);
            }
        }
        return appendedChild;
    }
View Full Code Here

                }
                throw Context.reportRuntimeError("Node cannot be inserted at the specified point in the hierarchy");
            }

            if (newChildNode instanceof DomDocumentFragment) {
                final DomDocumentFragment fragment = (DomDocumentFragment) newChildNode;
                for (final DomNode child : fragment.getChildren()) {
                    jsxFunction_insertBefore(new Object[] {child.getScriptObject(), refChildObject});
                }
                return newChildObject;
            }
            final DomNode refChildNode;
            // IE accepts non standard calls with only one arg
            if (refChildObject == Undefined.instance) {
                if (getBrowserVersion().isIE()) {
                    if (args.length > 1) {
                        throw Context.reportRuntimeError("Invalid argument.");
                    }
                    refChildNode = null;
                }
                else {
                    if (args.length == 2) {
                        refChildNode = null;
                    }
                    else {
                        throw Context.reportRuntimeError("insertBefore: not enough arguments");
                    }
                }
            }
            else if (refChildObject != null) {
                refChildNode = ((Node) refChildObject).getDomNodeOrDie();
            }
            else {
                refChildNode = null;
            }

            final DomNode domNode = getDomNodeOrDie();
            // Append the child to the parent node
            if (refChildNode != null) {
                refChildNode.insertBefore(newChildNode);
                appendedChild = newChildObject;
            }
            else {
                domNode.appendChild(newChildNode);
                appendedChild = newChildObject;
            }

            //if parentNode is null in IE, create a DocumentFragment to be the parentNode
            if (domNode.getParentNode() == null
                    && getWindow().getWebWindow().getWebClient().getBrowserVersion().isIE()) {
                final DomDocumentFragment fragment = domNode.getPage().createDomDocumentFragment();
                fragment.appendChild(domNode);
            }
        }
        return appendedChild;
    }
View Full Code Here

            }
        }

        // Build the document fragment using the cloned nodes, and return it.
        final SgmlPage page = ancestor.getPage();
        final DomDocumentFragment fragment = new DomDocumentFragment(page);
        for (DomNode n : ancestorClone.getChildNodes()) {
            fragment.appendChild(n);
        }
        return fragment;
    }
View Full Code Here

    /**
     * Creates a new document fragment.
     * @return a newly created document fragment
     */
    public Object jsxFunction_createDocumentFragment() {
        final DomDocumentFragment fragment = this.<DomNode>getDomNodeOrDie().getPage().createDomDocumentFragment();
        final DocumentFragment node = new DocumentFragment();
        node.setParentScope(getParentScope());
        node.setPrototype(getPrototype(node.getClass()));
        node.setDomNode(fragment);
        return getScriptableFor(fragment);
View Full Code Here

     */
    public DocumentFragment jsxFunction_transformToFragment(
            final Node source, final Object output) {
        final SgmlPage page = ((Document) output).getDomNodeOrDie();

        final DomDocumentFragment fragment = page.createDomDocumentFragment();
        final DocumentFragment rv = new DocumentFragment();
        rv.setPrototype(getPrototype(rv.getClass()));
        rv.setParentScope(getParentScope());
        rv.setDomNode(fragment);

View Full Code Here

    public void jsxFunction_transform() {
        final Node input = input_;
        final SgmlPage page = input.<DomNode>getDomNodeOrDie().getPage();

        if (output_ == null || !(output_ instanceof Node)) {
            final DomDocumentFragment fragment = page.createDomDocumentFragment();
            final DocumentFragment node = new DocumentFragment();
            node.setParentScope(getParentScope());
            node.setPrototype(getPrototype(node.getClass()));
            node.setDomNode(fragment);
            output_ = fragment.getScriptObject();
        }

        transform(input_, ((Node) output_).getDomNodeOrDie());
        final XMLSerializer serializer = new XMLSerializer();
        serializer.setParentScope(getParentScope());
View Full Code Here

            parseHtmlSnippet(domNode, true, valueAsString);

            //if the parentNode has null parentNode in IE,
            //create a DocumentFragment to be the parentNode's parentNode.
            if (domNode.getParentNode() == null && ie) {
                final DomDocumentFragment fragment = ((HtmlPage) domNode.getPage()).createDomDocumentFragment();
                fragment.appendChild(domNode);
            }
        }
    }
View Full Code Here

        }

        //if the parentNode has null parentNode in IE,
        //create a DocumentFragment to be the parentNode's parentNode.
        if (domNode.getParentNode() == null && getBrowserVersion().isIE()) {
            final DomDocumentFragment fragment = ((HtmlPage) domNode.getPage()).createDomDocumentFragment();
            fragment.appendChild(domNode);
        }
    }
View Full Code Here

TOP

Related Classes of com.gargoylesoftware.htmlunit.html.DomDocumentFragment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.