Package org.w3c.dom.html

Examples of org.w3c.dom.html.HTMLDocument


        ((EventTarget)elem).addEventListener("click",this,false);
    }

    public void handleEvent(Event evt)
    {
        HTMLDocument doc = (HTMLDocument)itsNatDoc.getDocument();
        Element p = doc.createElement("p");
        p.appendChild(doc.createTextNode("Clicked"));
        doc.getBody().appendChild(p);
    }
View Full Code Here


    }

    public void  FAST_AND_SLOW_LOADING_MODES()
    {
        ItsNatHTMLDocument itsNatDoc = null;
        HTMLDocument doc = itsNatDoc.getHTMLDocument();
        HTMLTableElement tableElem = (HTMLTableElement)doc.createElement("table");
        doc.getBody().appendChild(tableElem);

        EventListener listener = new EventListener()
        {
            public void handleEvent(Event evt) { }
        };

        ((EventTarget)tableElem).addEventListener("click",listener,false);

        ((EventTarget)tableElem).removeEventListener("click",listener,false);

        doc.getBody().removeChild(tableElem);
    }
View Full Code Here

        code.append("  alert('ERROR TestIgnoreIntrusiveNodes EndOfHeadOrBody 1'); throw 'ERROR';");
        code.append("}");
        itsNatDoc.addCodeToSend(code.toString());
        code = null;

        HTMLDocument doc = itsNatDoc.getHTMLDocument();
        Element parentNode = (Element)doc.getElementsByTagName(tagName).item(0);
        Element validChildElem1 = doc.createElement("input"); // Para que si algo falla sea muy visible en el documento (por defecto suele ser un "text")
        parentNode.appendChild(validChildElem1);
        Element validChildElem2 = doc.createElement("textarea"); // Para que si algo falla sea muy visible en el documento (por defecto suele ser un "text")
        parentNode.insertBefore(validChildElem2,validChildElem1);

        ClientDocumentStfulImpl clientDoc = (ClientDocumentStfulImpl)itsNatDoc.getClientDocumentOwner();
        // Es necesario acceder a las tripas de ItsNat para asegurarnos que est� cacheado
        NodeCacheRegistryImpl nodeCache = clientDoc.getNodeCacheRegistry();
View Full Code Here

        this.logElem = itsNatDoc.getDocument().getElementById("logId");
    }

    public void handleEvent(Event evt)
    {
        HTMLDocument doc = itsNatDoc.getHTMLDocument();
        Element infoElem = doc.createElement("div");
        infoElem.appendChild(doc.createTextNode("clicked"));
        logElem.appendChild(infoElem);
    }
View Full Code Here

    //

    /** Main. */
    public static void main(String[] argv) throws Exception {
        DOMFragmentParser parser = new DOMFragmentParser();
        HTMLDocument document = new HTMLDocumentImpl();
        for (int i = 0; i < argv.length; i++) {
            DocumentFragment fragment = document.createDocumentFragment();
            parser.parse(argv[i], fragment);
            print(fragment, "");
        }
    } // main(String[])
View Full Code Here

    }

    public void handleEvent(Event evt)
    {
        // Este test es especialmente interesante en BlackBerry
        HTMLDocument doc = itsNatDoc.getHTMLDocument();

        final HTMLInputElement input1 = (HTMLInputElement)doc.createElement("input");
        input1.setAttribute("type","file");
        input1.setAttribute("value","HOLA");
        doc.getBody().appendChild(input1); // Se usar�n m�todos DOM
        input1.setAttribute("value","ADIOS");

        final Element div = doc.createElement("div");
        doc.getBody().appendChild(div);

        HTMLInputElement input2 = (HTMLInputElement)doc.createElement("input");
        input2.setAttribute("type","file");
        input2.setAttribute("value","Test TestInputFileInsertion");
        div.appendChild(input2); // Seguramente se usar� innerHTML

        EventListener listener = new EventListenerSerial()
View Full Code Here

    {
        // El atributo "name" es pu�etero en MSIE
        // http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/properties/name_2.asp
        // El caso es que en MSIE 6 funciona bien (parece)

        HTMLDocument doc = (HTMLDocument)itsNatDoc.getDocument();
        Element elem = doc.getElementById("nameTestId");
        Element anchor = doc.createElement("a");
        anchor.setAttribute("name","nameExample");
        anchor.appendChild(doc.createTextNode("anchor"));
        elem.appendChild(anchor); // El padre tiene ya un nodo de texto se evita que se use innerHTML que no nos interesa
    }
View Full Code Here

{
    public TestFastLoadErrors(ItsNatHTMLDocument itsNatDoc)
    {
        if (false) // Poner a true si queremos detectar en modo fast load un uso ilegal, autoCleanEventListener y debugMode deben estar a true
        {
            HTMLDocument doc = (HTMLDocument)itsNatDoc.getDocument();
            Element elem = doc.createElement("div");
            doc.getBody().appendChild(elem);
            EventListener evtListener = new EventListenerSerial()
            {
                public void handleEvent(Event evt)
                {
                }
            };
            ((EventTarget)elem).addEventListener("click", evtListener, false);
            doc.getBody().removeChild(elem); // Produce el error
        }
        if (false) // Idem, esta vez por el cacheado del nodo, debe ser fast load y debugMode debe estar a true
        {
            HTMLDocument doc = (HTMLDocument)itsNatDoc.getDocument();
            Element elem = doc.createElement("div");
            doc.getBody().appendChild(elem);
            String elemRef = itsNatDoc.getScriptUtil().getNodeReference(elem); // Produce el cacheo del nodo
            String code = elemRef + ".style.visibility = 'visible';"; // Por hacer algo
            itsNatDoc.addCodeToSend(code);
            doc.getBody().removeChild(elem)// Produce el error
        }
    }
View Full Code Here

        }

        code.append("</script>");

        DocumentFragment frag = itsNatDoc.toDOM(code.toString());
        HTMLDocument doc = itsNatDoc.getHTMLDocument();
        doc.getBody().appendChild(frag);
    }
View Full Code Here

        this.itsNatDoc = itsNatDoc;
    }

    public void outText(String msg)
    {
        HTMLDocument doc = (HTMLDocument)itsNatDoc.getDocument();
        Element parent = doc.getElementById("logId");
        parent.appendChild(doc.createTextNode(msg)); // Para que se vea
    }
View Full Code Here

TOP

Related Classes of org.w3c.dom.html.HTMLDocument

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.