<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <link rel="stylesheet" href="style.css" type="text/css"> <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> <link rel="Start" href="index.html"> <link rel="previous" href="CSS.html"> <link rel="next" href="Dom_events.html"> <link rel="Up" href="index.html"> <link title="Index of types" rel=Appendix href="index_types.html"> <link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> <link title="Index of values" rel=Appendix href="index_values.html"> <link title="Index of class methods" rel=Appendix href="index_methods.html"> <link title="Index of class types" rel=Appendix href="index_class_types.html"> <link title="Index of modules" rel=Appendix href="index_modules.html"> <link title="Index of module types" rel=Appendix href="index_module_types.html"> <link title="CSS" rel="Chapter" href="CSS.html"> <link title="Dom" rel="Chapter" href="Dom.html"> <link title="Dom_events" rel="Chapter" href="Dom_events.html"> <link title="Dom_html" rel="Chapter" href="Dom_html.html"> <link title="Event_arrows" rel="Chapter" href="Event_arrows.html"> <link title="File" rel="Chapter" href="File.html"> <link title="Firebug" rel="Chapter" href="Firebug.html"> <link title="Form" rel="Chapter" href="Form.html"> <link title="Js" rel="Chapter" href="Js.html"> <link title="Json" rel="Chapter" href="Json.html"> <link title="Lwt_js" rel="Chapter" href="Lwt_js.html"> <link title="Lwt_js_events" rel="Chapter" href="Lwt_js_events.html"> <link title="Regexp" rel="Chapter" href="Regexp.html"> <link title="Typed_array" rel="Chapter" href="Typed_array.html"> <link title="Url" rel="Chapter" href="Url.html"> <link title="WebGL" rel="Chapter" href="WebGL.html"> <link title="XmlHttpRequest" rel="Chapter" href="XmlHttpRequest.html"><link title="DOM objects" rel="Section" href="#2_DOMobjects"> <link title="Helper functions" rel="Section" href="#2_Helperfunctions"> <link title="Events" rel="Section" href="#2_Events"> <link title="Event handlers" rel="Section" href="#2_Eventhandlers"> <link title="Other DOM objects" rel="Section" href="#2_OtherDOMobjects"> <title>Dom</title> </head> <body> <div class="navbar"><a class="pre" href="CSS.html" title="CSS">Previous</a> <a class="up" href="index.html" title="Index">Up</a> <a class="post" href="Dom_events.html" title="Dom_events">Next</a> </div> <h1>Module <a href="type_Dom.html">Dom</a></h1> <pre><span class="keyword">module</span> Dom: <code class="code">sig</code> <a href="Dom.html">..</a> <code class="code">end</code></pre><div class="info"> DOM binding <p> This is a partial binding to the DOM Core API.<br> </div> <hr width="100%"> <br> <h2 id="2_DOMobjects">DOM objects</h2><br> <pre><span id="TYPEnodeList"><span class="keyword">class type</span> <code class="type">['node]</code> <a href="Dom.nodeList-c.html">nodeList</a></span> = <code class="code">object</code> <a href="Dom.nodeList-c.html">..</a> <code class="code">end</code></pre><div class="info"> Specification of <code class="code">NodeList</code> objects. </div> <pre><code><span id="TYPEnodeType"><span class="keyword">type</span> <code class="type"></code>nodeType</span> = </code></pre><table class="typetable"> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTnodeType.OTHER"><span class="constructor">OTHER</span></span></code></td> </tr> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTnodeType.ELEMENT"><span class="constructor">ELEMENT</span></span></code></td> </tr> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTnodeType.ATTRIBUTE"><span class="constructor">ATTRIBUTE</span></span></code></td> </tr> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTnodeType.TEXT"><span class="constructor">TEXT</span></span></code></td> </tr> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTnodeType.CDATA_SECTION"><span class="constructor">CDATA_SECTION</span></span></code></td> </tr> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTnodeType.ENTITY_REFERENCE"><span class="constructor">ENTITY_REFERENCE</span></span></code></td> </tr> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTnodeType.ENTITY"><span class="constructor">ENTITY</span></span></code></td> </tr> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTnodeType.PROCESSING_INSTRUCTION"><span class="constructor">PROCESSING_INSTRUCTION</span></span></code></td> </tr> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTnodeType.COMMENT"><span class="constructor">COMMENT</span></span></code></td> </tr> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTnodeType.DOCUMENT"><span class="constructor">DOCUMENT</span></span></code></td> </tr> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTnodeType.DOCUMENT_TYPE"><span class="constructor">DOCUMENT_TYPE</span></span></code></td> </tr> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTnodeType.DOCUMENT_FRAGMENT"><span class="constructor">DOCUMENT_FRAGMENT</span></span></code></td> </tr> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTnodeType.NOTATION"><span class="constructor">NOTATION</span></span></code></td> </tr></table> <pre><span id="VALdocument_position_disconnected"><span class="keyword">val</span> document_position_disconnected</span> : <code class="type">int</code></pre><pre><span id="VALdocument_position_preceding"><span class="keyword">val</span> document_position_preceding</span> : <code class="type">int</code></pre><pre><span id="VALdocument_position_following"><span class="keyword">val</span> document_position_following</span> : <code class="type">int</code></pre><pre><span id="VALdocument_position_contains"><span class="keyword">val</span> document_position_contains</span> : <code class="type">int</code></pre><pre><span id="VALdocument_position_contained_by"><span class="keyword">val</span> document_position_contained_by</span> : <code class="type">int</code></pre><pre><span id="VALdocument_position_implementation_specific"><span class="keyword">val</span> document_position_implementation_specific</span> : <code class="type">int</code></pre><pre><span id="TYPEnode"><span class="keyword">class type</span> <a href="Dom.node-c.html">node</a></span> = <code class="code">object</code> <a href="Dom.node-c.html">..</a> <code class="code">end</code></pre><div class="info"> Specification of <code class="code">Node</code> objects. </div> <pre><span id="TYPEattr"><span class="keyword">class type</span> <a href="Dom.attr-c.html">attr</a></span> = <code class="code">object</code> <a href="Dom.attr-c.html">..</a> <code class="code">end</code></pre><div class="info"> Specification of <code class="code">Attr</code> objects. </div> <pre><span id="TYPEnamedNodeMap"><span class="keyword">class type</span> <code class="type">[<a href="Dom.attr-c.html">attr</a>]</code> <a href="Dom.namedNodeMap-c.html">namedNodeMap</a></span> = <code class="code">object</code> <a href="Dom.namedNodeMap-c.html">..</a> <code class="code">end</code></pre><div class="info"> Specification of <code class="code">NamedNodeMap</code> objects. </div> <pre><span id="TYPEelement"><span class="keyword">class type</span> <a href="Dom.element-c.html">element</a></span> = <code class="code">object</code> <a href="Dom.element-c.html">..</a> <code class="code">end</code></pre><div class="info"> Specification of <code class="code">Element</code> objects. </div> <pre><span id="TYPEcharacterData"><span class="keyword">class type</span> <a href="Dom.characterData-c.html">characterData</a></span> = <code class="code">object</code> <a href="Dom.characterData-c.html">..</a> <code class="code">end</code></pre><div class="info"> Specification of <code class="code">CharacterData</code> objects. </div> <pre><span id="TYPEtext"><span class="keyword">class type</span> <a href="Dom.text-c.html">text</a></span> = <code class="type"><a href="Dom.characterData-c.html">characterData</a></code></pre><div class="info"> Specification of <code class="code">Text</code> objects. </div> <pre><span id="TYPEdocumentFragment"><span class="keyword">class type</span> <a href="Dom.documentFragment-c.html">documentFragment</a></span> = <code class="type"><a href="Dom.node-c.html">node</a></code></pre><div class="info"> Specification of <code class="code">DocumentFragment</code> objects. </div> <pre><span id="TYPEdocument"><span class="keyword">class type</span> <code class="type">['element]</code> <a href="Dom.document-c.html">document</a></span> = <code class="code">object</code> <a href="Dom.document-c.html">..</a> <code class="code">end</code></pre><div class="info"> Specification of <code class="code">Document</code> objects. </div> <br> <h2 id="2_Helperfunctions">Helper functions</h2><br> <pre><span id="VALinsertBefore"><span class="keyword">val</span> insertBefore</span> : <code class="type">#<a href="Dom.node-c.html">node</a> <a href="Js.html#TYPEt">Js.t</a> -> #<a href="Dom.node-c.html">node</a> <a href="Js.html#TYPEt">Js.t</a> -> #<a href="Dom.node-c.html">node</a> <a href="Js.html#TYPEt">Js.t</a> <a href="Js.html#TYPEopt">Js.opt</a> -> unit</code></pre><div class="info"> <code class="code">insertBefore n c p</code> inserts node <code class="code">c</code> as child of node <code class="code">n</code>, just before node <code class="code">p</code>, or as last child if <code class="code">p</code> is empty. The expression <code class="code">insertBefore n c p</code> behave the same as <code class="code">n##insertBefore(c, p)</code> but avoid the need of coercing the different objects to <code class="code">node t</code>.<br> </div> <pre><span id="VALreplaceChild"><span class="keyword">val</span> replaceChild</span> : <code class="type">#<a href="Dom.node-c.html">node</a> <a href="Js.html#TYPEt">Js.t</a> -> #<a href="Dom.node-c.html">node</a> <a href="Js.html#TYPEt">Js.t</a> -> #<a href="Dom.node-c.html">node</a> <a href="Js.html#TYPEt">Js.t</a> -> unit</code></pre><div class="info"> The expression <code class="code">replaceChild n c p</code> behave the same as <code class="code">n##replaceChild(c, p)</code> but avoid the need of coercing the different objects to <code class="code">node t</code>.<br> </div> <pre><span id="VALremoveChild"><span class="keyword">val</span> removeChild</span> : <code class="type">#<a href="Dom.node-c.html">node</a> <a href="Js.html#TYPEt">Js.t</a> -> #<a href="Dom.node-c.html">node</a> <a href="Js.html#TYPEt">Js.t</a> -> unit</code></pre><div class="info"> The expression <code class="code">removeChild n c</code> behave the same as <code class="code">n##removeChild(c)</code> but avoid the need of coercing the different objects to <code class="code">node t</code>.<br> </div> <pre><span id="VALappendChild"><span class="keyword">val</span> appendChild</span> : <code class="type">#<a href="Dom.node-c.html">node</a> <a href="Js.html#TYPEt">Js.t</a> -> #<a href="Dom.node-c.html">node</a> <a href="Js.html#TYPEt">Js.t</a> -> unit</code></pre><div class="info"> The expression <code class="code">appendChild n c</code> behave the same as <code class="code">n##appendChild(c)</code> but avoid the need of coercing the different objects to <code class="code">node t</code>.<br> </div> <pre><span id="VALlist_of_nodeList"><span class="keyword">val</span> list_of_nodeList</span> : <code class="type">'a <a href="Dom.nodeList-c.html">nodeList</a> <a href="Js.html#TYPEt">Js.t</a> -> 'a <a href="Js.html#TYPEt">Js.t</a> list</code></pre><pre><code><span id="TYPEnode_type"><span class="keyword">type</span> <code class="type"></code>node_type</span> = </code></pre><table class="typetable"> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTnode_type.Element"><span class="constructor">Element</span></span> <span class="keyword">of</span> <code class="type"><a href="Dom.element-c.html">element</a> <a href="Js.html#TYPEt">Js.t</a></code></code></td> </tr> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTnode_type.Attr"><span class="constructor">Attr</span></span> <span class="keyword">of</span> <code class="type"><a href="Dom.attr-c.html">attr</a> <a href="Js.html#TYPEt">Js.t</a></code></code></td> </tr> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTnode_type.Text"><span class="constructor">Text</span></span> <span class="keyword">of</span> <code class="type"><a href="Dom.text-c.html">text</a> <a href="Js.html#TYPEt">Js.t</a></code></code></td> </tr> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTnode_type.Other"><span class="constructor">Other</span></span> <span class="keyword">of</span> <code class="type"><a href="Dom.node-c.html">node</a> <a href="Js.html#TYPEt">Js.t</a></code></code></td> </tr></table> <pre><span id="VALnodeType"><span class="keyword">val</span> nodeType</span> : <code class="type">#<a href="Dom.node-c.html">node</a> <a href="Js.html#TYPEt">Js.t</a> -> <a href="Dom.html#TYPEnode_type">node_type</a></code></pre><pre><span class="keyword">module</span> <a href="Dom.CoerceTo.html">CoerceTo</a>: <code class="code">sig</code> <a href="Dom.CoerceTo.html">..</a> <code class="code">end</code></pre><br> <h2 id="2_Events">Events</h2><br> <pre><span id="TYPEevent_listener"><span class="keyword">type</span> <code class="type">(-'a, -'b)</code> event_listener</span> </pre> <div class="info"> The type of event listener functions. The first type parameter <code class="code">'a</code> is the type of the target object; the second parameter <code class="code">'b</code> is the type of the event object.<br> </div> <pre><span id="TYPEevent"><span class="keyword">class type</span> <code class="type">['a]</code> <a href="Dom.event-c.html">event</a></span> = <code class="code">object</code> <a href="Dom.event-c.html">..</a> <code class="code">end</code></pre><br> <h2 id="2_Eventhandlers">Event handlers</h2><br> <pre><span id="VALno_handler"><span class="keyword">val</span> no_handler</span> : <code class="type">('a, 'b) <a href="Dom.html#TYPEevent_listener">event_listener</a></code></pre><div class="info"> Void event handler (Javascript <code class="code">null</code> value).<br> </div> <pre><span id="VALhandler"><span class="keyword">val</span> handler</span> : <code class="type">(('e #<a href="Dom.event-c.html">event</a> as 'b) <a href="Js.html#TYPEt">Js.t</a> -> bool <a href="Js.html#TYPEt">Js.t</a>) -> ('a, 'b <a href="Js.html#TYPEt">Js.t</a>) <a href="Dom.html#TYPEevent_listener">event_listener</a></code></pre><div class="info"> Create an event handler that invokes the provided function. If the handler returns false, the default action is prevented.<br> </div> <pre><span id="VALfull_handler"><span class="keyword">val</span> full_handler</span> : <code class="type">('a -> ('e #<a href="Dom.event-c.html">event</a> as 'b) <a href="Js.html#TYPEt">Js.t</a> -> bool <a href="Js.html#TYPEt">Js.t</a>) -><br> ('a, 'b <a href="Js.html#TYPEt">Js.t</a>) <a href="Dom.html#TYPEevent_listener">event_listener</a></code></pre><div class="info"> Create an event handler that invokes the provided function. The event target (implicit parameter <code class="code">this</code>) is also passed as argument to the function.<br> </div> <pre><span id="VALinvoke_handler"><span class="keyword">val</span> invoke_handler</span> : <code class="type">('a, 'b) <a href="Dom.html#TYPEevent_listener">event_listener</a> -> 'a -> 'b -> bool <a href="Js.html#TYPEt">Js.t</a></code></pre><div class="info"> Invoke an existing handler. Useful to chain event handlers.<br> </div> <pre><span id="VALeventTarget"><span class="keyword">val</span> eventTarget</span> : <code class="type">(< .. > as 'a) #<a href="Dom.event-c.html">event</a> <a href="Js.html#TYPEt">Js.t</a> -> 'a <a href="Js.html#TYPEt">Js.t</a></code></pre><div class="info"> Returns which object is the target of this event.<br> </div> <pre><span id="TYPEevent_listener_id"><span class="keyword">type</span> <code class="type"></code>event_listener_id</span> </pre> <pre><span class="keyword">module</span> <a href="Dom.Event.html">Event</a>: <code class="code">sig</code> <a href="Dom.Event.html">..</a> <code class="code">end</code></pre><pre><span id="VALaddEventListener"><span class="keyword">val</span> addEventListener</span> : <code class="type">(< .. > as 'a) <a href="Js.html#TYPEt">Js.t</a> -><br> 'b <a href="Dom.Event.html#TYPEtyp">Event.typ</a> -><br> ('a <a href="Js.html#TYPEt">Js.t</a>, 'b) <a href="Dom.html#TYPEevent_listener">event_listener</a> -> bool <a href="Js.html#TYPEt">Js.t</a> -> <a href="Dom.html#TYPEevent_listener_id">event_listener_id</a></code></pre><div class="info"> Add an event listener. This function matches the <code class="code">addEventListener</code> DOM method, except that it returns an id for removing the listener.<br> </div> <pre><span id="VALremoveEventListener"><span class="keyword">val</span> removeEventListener</span> : <code class="type"><a href="Dom.html#TYPEevent_listener_id">event_listener_id</a> -> unit</code></pre><div class="info"> Remove the given event listener.<br> </div> <br> <h2 id="2_OtherDOMobjects">Other DOM objects</h2><br> <pre><span id="TYPEstringList"><span class="keyword">class type</span> <a href="Dom.stringList-c.html">stringList</a></span> = <code class="code">object</code> <a href="Dom.stringList-c.html">..</a> <code class="code">end</code></pre></body></html>