Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. /* Binding to generate HTMLElement interface
  2.  *
  3.  * Copyright 2012 Vincent Sanders <vince@netsurf-browser.org>
  4.  *
  5.  * This file is part of NetSurf, http://www.netsurf-browser.org/
  6.  *
  7.  * Released under the terms of the MIT License,
  8.  *         http://www.opensource.org/licenses/mit-license
  9.  */
  10.  
  11. webidlfile "html.idl";
  12.  
  13. hdrcomment "Copyright 2012 Vincent Sanders <vince@netsurf-browser.org>";
  14. hdrcomment "This file is part of NetSurf, http://www.netsurf-browser.org/";
  15. hdrcomment "Released under the terms of the MIT License,";
  16. hdrcomment "        http://www.opensource.org/licenses/mit-license";
  17.  
  18. preamble %{
  19.  
  20. #include <dom/dom.h>
  21.  
  22. #include "utils/config.h"
  23. #include "utils/log.h"
  24. #include "utils/corestrings.h"
  25. #include "javascript/js.h"
  26. #include "javascript/jsapi.h"
  27. #include "render/html_internal.h"
  28.  
  29. #include "htmlelement.h"
  30. #include "text.h"
  31. #include "location.h"
  32. #include "nodelist.h"
  33.  
  34. %}
  35.  
  36. #include "dom.bnd"
  37.  
  38. binding htmlelement {
  39.         type js_libdom; /* the binding type */
  40.  
  41.         interface HTMLElement; /* Web IDL interface to generate */
  42.         /* superclasses
  43.  
  44.            interface HTMLAnchorElement
  45.            interface HTMLAppletElement
  46.            interface HTMLAreaElement
  47.            interface HTMLBaseElement
  48.            interface HTMLBaseFontElement
  49.            interface HTMLBodyElement
  50.            interface HTMLBRElement
  51.            interface HTMLButtonElement
  52.            interface HTMLCanvasElement
  53.            interface HTMLCommandElement
  54.            interface HTMLDataElement
  55.            interface HTMLDataListElement
  56.            interface HTMLDetailsElement
  57.            interface HTMLDialogElement
  58.            interface HTMLDirectoryElement
  59.            interface HTMLDivElement
  60.            interface HTMLDListElement
  61.            interface HTMLEmbedElement
  62.            interface HTMLFieldSetElement
  63.            interface HTMLFontElement
  64.            interface HTMLFormElement
  65.            interface HTMLFrameElement
  66.            interface HTMLFrameSetElement
  67.            interface HTMLHeadElement
  68.            interface HTMLHeadingElement
  69.            interface HTMLHRElement
  70.            interface HTMLHtmlElement
  71.            interface HTMLIFrameElement
  72.            interface HTMLImageElement
  73.            interface HTMLInputElement
  74.            interface HTMLKeygenElement
  75.            interface HTMLLabelElement
  76.            interface HTMLLegendElement
  77.            interface HTMLLIElement
  78.            interface HTMLLinkElement
  79.            interface HTMLMapElement
  80.            interface HTMLMarqueeElement
  81.            interface HTMLMediaElement
  82.            interface HTMLMenuElement
  83.            interface HTMLMetaElement
  84.            interface HTMLMeterElement
  85.            interface HTMLModElement
  86.            interface HTMLObjectElement
  87.            interface HTMLOListElement
  88.            interface HTMLOptGroupElement
  89.            interface HTMLOptionElement
  90.            interface HTMLOutputElement
  91.            interface HTMLParagraphElement
  92.            interface HTMLParamElement
  93.            interface HTMLPreElement
  94.            interface HTMLProgressElement
  95.            interface HTMLQuoteElement
  96.            interface HTMLScriptElement
  97.            interface HTMLSelectElement
  98.            interface HTMLSourceElement
  99.            interface HTMLSpanElement
  100.            interface HTMLStyleElement
  101.            interface HTMLTableCaptionElement
  102.            interface HTMLTableCellElement
  103.            interface HTMLTableColElement
  104.            interface HTMLTableElement
  105.            interface HTMLTableRowElement
  106.            interface HTMLTableSectionElement
  107.            interface HTMLTextAreaElement
  108.            interface HTMLTimeElement
  109.            interface HTMLTitleElement
  110.            interface HTMLTrackElement
  111.            interface HTMLUListElement
  112.            interface HTMLUnknownElement
  113.         */
  114.  
  115.         private "dom_element *" node;
  116.         private "struct html_content *" htmlc;
  117.  
  118.         /* tag name retrieved first time its fetched and doesnt change */
  119.         property unshared tagName;
  120.  
  121.         /* events through a single interface */
  122.         property unshared type EventHandler;
  123. }
  124.  
  125. api finalise %{
  126.         if (private != NULL) {
  127.                 dom_node_unref(private->node);
  128.         }
  129. %}
  130.  
  131. /* interface Element in dom idl */
  132.  
  133. /* readonly attribute DOMString Element::tagName; */
  134. getter tagName %{
  135.         if (!JSVAL_IS_VOID(JSAPI_PROP_RVAL(cx, vp))) {
  136.                 /* already created - return it */
  137.                 return JS_TRUE;
  138.         }
  139.  
  140.         dom_exception exc;
  141.         dom_string *name;
  142.  
  143.         exc = dom_element_get_tag_name(private->node, &name);
  144.         if (name != NULL) {
  145.                 jsret = JS_NewStringCopyN(cx, dom_string_data(name), dom_string_length(name));
  146.                 dom_string_unref(name);
  147.         }
  148. %}
  149.  
  150. /* attribute DOMString Element::id; */
  151. getter id %{
  152.         dom_string *value;
  153.         dom_exception exc;
  154.  
  155.         exc = dom_element_get_attribute(private->node, corestring_dom_id, &value);
  156.         if (exc != DOM_NO_ERR) {
  157.                 return JS_FALSE;
  158.         }
  159.  
  160.         if (value != NULL) {
  161.                 jsret = JS_NewStringCopyN(cx, dom_string_data(value), dom_string_length(value));
  162.                 dom_string_unref(value);
  163.         }
  164. %}
  165.  
  166. /* attribute DOMString Element::className; */
  167. getter className %{
  168.         dom_string *value;
  169.         dom_exception exc;
  170.  
  171.         exc = dom_element_get_attribute(private->node, corestring_dom_class, &value);
  172.         if (exc != DOM_NO_ERR) {
  173.                 return JS_FALSE;
  174.         }
  175.  
  176.         if (value != NULL) {
  177.                 jsret = JS_NewStringCopyN(cx, dom_string_data(value), dom_string_length(value));
  178.                 dom_string_unref(value);
  179.         }
  180. %}
  181.  
  182. /* DOMString? Element::getAttribute(DOMString name); */
  183. operation getAttribute %{
  184.         dom_string *value;
  185.         dom_string *name_dom;
  186.         dom_exception exc;
  187.  
  188.         exc = dom_string_create((unsigned char*)name, name_len, &name_dom);
  189.         if (exc != DOM_NO_ERR) {
  190.                 return JS_FALSE;
  191.         }
  192.  
  193.         exc = dom_element_get_attribute(private->node, name_dom, &value);
  194.         dom_string_unref(name_dom);
  195.         if (exc != DOM_NO_ERR) {
  196.                 return JS_FALSE;
  197.         }
  198.  
  199.         if (value != NULL) {
  200.                 jsret = JS_NewStringCopyN(cx, dom_string_data(value), dom_string_length(value));
  201.                 dom_string_unref(value);
  202.         }
  203. %}
  204.  
  205. /* void Element::setAttribute(DOMString name, DOMString value); */
  206. operation setAttribute %{
  207.         dom_string *value_dom;
  208.         dom_string *name_dom;
  209.         dom_exception exc;
  210.  
  211.         exc = dom_string_create((unsigned char*)name, name_len, &name_dom);
  212.         if (exc != DOM_NO_ERR) {
  213.                 return JS_FALSE;
  214.         }
  215.  
  216.         exc = dom_string_create((unsigned char*)name, name_len, &value_dom);
  217.         if (exc != DOM_NO_ERR) {
  218.                 dom_string_unref(name_dom);
  219.                 return JS_FALSE;
  220.         }
  221.  
  222.         exc = dom_element_set_attribute(private->node, name_dom, value_dom);
  223.         dom_string_unref(name_dom);
  224.         dom_string_unref(value_dom);
  225.         if (exc != DOM_NO_ERR) {
  226.                 return JS_FALSE;
  227.         }
  228. %}
  229.  
  230. /* void Element::removeAttribute(DOMString name); */
  231. operation removeAttribute %{
  232.         dom_string *name_dom;
  233.         dom_exception exc;
  234.  
  235.         exc = dom_string_create((unsigned char*)name, name_len, &name_dom);
  236.         if (exc != DOM_NO_ERR) {
  237.                 return JS_FALSE;
  238.         }
  239.  
  240.         exc = dom_element_remove_attribute(private->node, name_dom);
  241.         dom_string_unref(name_dom);
  242.         if (exc != DOM_NO_ERR) {
  243.                 return JS_FALSE;
  244.         }
  245. %}
  246.  
  247. /* boolean Element::hasAttribute(DOMString name); */
  248. operation hasAttribute %{
  249.         bool result;
  250.         dom_string *name_dom;
  251.         dom_exception exc;
  252.  
  253.         exc = dom_string_create((unsigned char*)name, name_len, &name_dom);
  254.         if (exc != DOM_NO_ERR) {
  255.                 return JS_FALSE;
  256.         }
  257.  
  258.         exc = dom_element_has_attribute(private->node, name_dom, &result);
  259.         dom_string_unref(name_dom);
  260.         if (exc != DOM_NO_ERR) {
  261.                 return JS_FALSE;
  262.         }
  263.  
  264.         if (result) {
  265.                 jsret = JS_TRUE;
  266.         }
  267. %}
  268.  
  269. /*
  270.  *
  271.  * Dom 4 says this should return a htmlcollection, libdom currently
  272.  * returns DOM 3 spec of a nodelist
  273.  */
  274. /* HTMLCollection Element::getElementsByTagName(DOMString localName); */
  275. operation getElementsByTagName %{
  276.         dom_string *localName_dom;
  277.         /* dom_html_collection *collection;*/
  278.         dom_nodelist *nodelist;
  279.         dom_exception exc;
  280.  
  281.         exc = dom_string_create((uint8_t *)localName, localName_len, &localName_dom);
  282.         if (exc != DOM_NO_ERR) {
  283.                 return JS_FALSE;
  284.         }
  285.  
  286.         exc = dom_element_get_elements_by_tag_name(private->node, localName_dom, /*&collection*/&nodelist);
  287.         dom_string_unref(localName_dom);
  288.         if (exc != DOM_NO_ERR) {
  289.                 return JS_FALSE;
  290.         }
  291.  
  292.         if (/*collection*/nodelist != NULL) {
  293.                 /*jsret = jsapi_new_HTMLCollection(cx,
  294.                                                  NULL,
  295.                                                  NULL,
  296.                                                  collection,
  297.                                                  private->htmlc);*/
  298.                 jsret = jsapi_new_NodeList(cx,
  299.                                                  NULL,
  300.                                                  NULL,
  301.                                                  nodelist,
  302.                                                  private->htmlc);
  303.         }
  304.  
  305. %}
  306.  
  307. /*
  308.  * DOM 3 has these as the element traversal  extension
  309.  *
  310.  * http://dev.w3.org/2006/webapi/ElementTraversal/publish/ElementTraversal.html
  311.  */
  312.  
  313. getter firstElementChild %{
  314.         dom_node *element;
  315.         dom_exception exc;
  316.         dom_node_type node_type;
  317.         dom_node *next_node;
  318.  
  319.         exc = dom_node_get_first_child(private->node, &element);
  320.         if (exc != DOM_NO_ERR) {
  321.                 return JS_FALSE;
  322.         }
  323.  
  324.         while (element != NULL) {
  325.                 exc = dom_node_get_node_type(element, &node_type);
  326.                 if ((exc == DOM_NO_ERR) && (node_type == DOM_ELEMENT_NODE)) {
  327.                         /* found it */
  328.                         jsret = jsapi_new_HTMLElement(cx,
  329.                                                       NULL,
  330.                                                       NULL,
  331.                                                       (dom_element *)element,
  332.                                                       private->htmlc);
  333.                         break;
  334.                 }
  335.  
  336.                 exc = dom_node_get_next_sibling(element, &next_node);
  337.                 dom_node_unref(element);
  338.                 if (exc == DOM_NO_ERR) {
  339.                         element = next_node;
  340.                 } else {
  341.                         element = NULL;
  342.                 }
  343.  
  344.         }
  345.  
  346.  
  347.         %}
  348.  
  349. getter lastElementChild %{
  350.         dom_node *element;
  351.         dom_exception exc;
  352.         dom_node_type node_type;
  353.         dom_node *sib_node;
  354.  
  355.         exc = dom_node_get_last_child(private->node, &element);
  356.         if (exc != DOM_NO_ERR) {
  357.                 return JS_FALSE;
  358.         }
  359.  
  360.         while (element != NULL) {
  361.                 exc = dom_node_get_node_type(element, &node_type);
  362.                 if ((exc == DOM_NO_ERR) && (node_type == DOM_ELEMENT_NODE)) {
  363.                         /* found it */
  364.                         jsret = jsapi_new_HTMLElement(cx,
  365.                                                       NULL,
  366.                                                       NULL,
  367.                                                       (dom_element *)element,
  368.                                                       private->htmlc);
  369.                         break;
  370.                 }
  371.  
  372.                 exc = dom_node_get_previous_sibling(element, &sib_node);
  373.                 dom_node_unref(element);
  374.                 if (exc == DOM_NO_ERR) {
  375.                         element = sib_node;
  376.                 } else {
  377.                         element = NULL;
  378.                 }
  379.  
  380.         }
  381.         %}
  382.  
  383. getter previousElementSibling %{
  384.         dom_node *element;
  385.         dom_exception exc;
  386.         dom_node_type node_type;
  387.         dom_node *sib_node;
  388.  
  389.         exc = dom_node_get_previous_sibling(private->node, &element);
  390.         if (exc != DOM_NO_ERR) {
  391.                 return JS_FALSE;
  392.         }
  393.  
  394.         while (element != NULL) {
  395.                 exc = dom_node_get_node_type(element, &node_type);
  396.                 if ((exc == DOM_NO_ERR) && (node_type == DOM_ELEMENT_NODE)) {
  397.                         /* found it */
  398.                         jsret = jsapi_new_HTMLElement(cx,
  399.                                                       NULL,
  400.                                                       NULL,
  401.                                                       (dom_element *)element,
  402.                                                       private->htmlc);
  403.                         break;
  404.                 }
  405.  
  406.                 exc = dom_node_get_previous_sibling(element, &sib_node);
  407.                 dom_node_unref(element);
  408.                 if (exc == DOM_NO_ERR) {
  409.                         element = sib_node;
  410.                 } else {
  411.                         element = NULL;
  412.                 }
  413.         }
  414. %}
  415.  
  416. getter nextElementSibling %{
  417.         dom_node *element;
  418.         dom_exception exc;
  419.         dom_node_type node_type;
  420.         dom_node *sib_node;
  421.  
  422.         exc = dom_node_get_next_sibling(private->node, &element);
  423.         if (exc != DOM_NO_ERR) {
  424.                 return JS_FALSE;
  425.         }
  426.  
  427.         while (element != NULL) {
  428.                 exc = dom_node_get_node_type(element, &node_type);
  429.                 if ((exc == DOM_NO_ERR) && (node_type == DOM_ELEMENT_NODE)) {
  430.                         /* found it */
  431.                         jsret = jsapi_new_HTMLElement(cx,
  432.                                                       NULL,
  433.                                                       NULL,
  434.                                                       (dom_element *)element,
  435.                                                       private->htmlc);
  436.                         break;
  437.                 }
  438.  
  439.                 exc = dom_node_get_next_sibling(element, &sib_node);
  440.                 dom_node_unref(element);
  441.                 if (exc == DOM_NO_ERR) {
  442.                         element = sib_node;
  443.                 } else {
  444.                         element = NULL;
  445.                 }
  446.         }
  447. %}
  448.  
  449. getter childElementCount %{
  450.         dom_node *element;
  451.         dom_exception exc;
  452.         dom_node_type node_type;
  453.         dom_node *next_node;
  454.  
  455.         exc = dom_node_get_first_child(private->node, &element);
  456.         if (exc != DOM_NO_ERR) {
  457.                 return JS_FALSE;
  458.         }
  459.  
  460.         while (element != NULL) {
  461.                 exc = dom_node_get_node_type(element, &node_type);
  462.                 if ((exc == DOM_NO_ERR) && (node_type == DOM_ELEMENT_NODE)) {
  463.                         jsret += 1;
  464.                 }
  465.  
  466.                 exc = dom_node_get_next_sibling(element, &next_node);
  467.                 dom_node_unref(element);
  468.                 if (exc == DOM_NO_ERR) {
  469.                         element = next_node;
  470.                 } else {
  471.                         element = NULL;
  472.                 }
  473.         }
  474. %}
  475.  
  476. getter EventHandler %{
  477.         JSLOG("propname[%d].name=\"%s\"",
  478.               tinyid,
  479.               jsclass_properties[tinyid].name);
  480. %}
  481.  
  482.  
  483. setter EventHandler %{
  484.         dom_string *event_type_dom;
  485.  
  486.         JSLOG("propname[%d].name=\"%s\"",
  487.               tinyid,
  488.               jsclass_properties[tinyid].name);
  489.  
  490.         switch (tinyid) {
  491.         case JSAPI_PROP_TINYID_onabort:
  492.                 event_type_dom = corestring_dom_abort;
  493.                 break;
  494.  
  495.         case JSAPI_PROP_TINYID_onblur:
  496.                 event_type_dom = corestring_dom_blur;
  497.                 break;
  498.  
  499.         case JSAPI_PROP_TINYID_oncancel:
  500.                 event_type_dom = corestring_dom_cancel;
  501.                 break;
  502.  
  503.         case JSAPI_PROP_TINYID_oncanplay:
  504.                 event_type_dom = corestring_dom_canplay;
  505.                 break;
  506.  
  507.         case JSAPI_PROP_TINYID_oncanplaythrough:
  508.                 event_type_dom = corestring_dom_canplaythrough;
  509.                 break;
  510.  
  511.         case JSAPI_PROP_TINYID_onchange:
  512.                 event_type_dom = corestring_dom_change;
  513.                 break;
  514.  
  515.         case JSAPI_PROP_TINYID_onclick:
  516.                 event_type_dom = corestring_dom_click;
  517.                 break;
  518.  
  519.         case JSAPI_PROP_TINYID_onclose:
  520.                 event_type_dom = corestring_dom_close;
  521.                 break;
  522.  
  523.         case JSAPI_PROP_TINYID_oncontextmenu:
  524.                 event_type_dom = corestring_dom_contextmenu;
  525.                 break;
  526.  
  527.         case JSAPI_PROP_TINYID_oncuechange:
  528.                 event_type_dom = corestring_dom_cuechange;
  529.                 break;
  530.  
  531.         case JSAPI_PROP_TINYID_ondblclick:
  532.                 event_type_dom = corestring_dom_dblclick;
  533.                 break;
  534.  
  535.         case JSAPI_PROP_TINYID_ondrag:
  536.                 event_type_dom = corestring_dom_drag;
  537.                 break;
  538.  
  539.         case JSAPI_PROP_TINYID_ondragend:
  540.                 event_type_dom = corestring_dom_dragend;
  541.                 break;
  542.  
  543.         case JSAPI_PROP_TINYID_ondragenter:
  544.                 event_type_dom = corestring_dom_dragenter;
  545.                 break;
  546.  
  547.         case JSAPI_PROP_TINYID_ondragleave:
  548.                 event_type_dom = corestring_dom_dragleave;
  549.                 break;
  550.  
  551.         case JSAPI_PROP_TINYID_ondragover:
  552.                 event_type_dom = corestring_dom_dragover;
  553.                 break;
  554.  
  555.         case JSAPI_PROP_TINYID_ondragstart:
  556.                 event_type_dom = corestring_dom_dragstart;
  557.                 break;
  558.  
  559.         case JSAPI_PROP_TINYID_ondrop:
  560.                 event_type_dom = corestring_dom_drop;
  561.                 break;
  562.  
  563.         case JSAPI_PROP_TINYID_ondurationchange:
  564.                 event_type_dom = corestring_dom_durationchange;
  565.                 break;
  566.  
  567.         case JSAPI_PROP_TINYID_onemptied:
  568.                 event_type_dom = corestring_dom_emptied;
  569.                 break;
  570.  
  571.         case JSAPI_PROP_TINYID_onended:
  572.                 event_type_dom = corestring_dom_ended;
  573.                 break;
  574.  
  575.         case JSAPI_PROP_TINYID_onerror:
  576.                 event_type_dom = corestring_dom_error;
  577.                 break;
  578.  
  579.         case JSAPI_PROP_TINYID_onfocus:
  580.                 event_type_dom = corestring_dom_focus;
  581.                 break;
  582.  
  583.         case JSAPI_PROP_TINYID_oninput:
  584.                 event_type_dom = corestring_dom_input;
  585.                 break;
  586.  
  587.         case JSAPI_PROP_TINYID_oninvalid:
  588.                 event_type_dom = corestring_dom_invalid;
  589.                 break;
  590.  
  591.         case JSAPI_PROP_TINYID_onkeydown:
  592.                 event_type_dom = corestring_dom_keydown;
  593.                 break;
  594.  
  595.         case JSAPI_PROP_TINYID_onkeypress:
  596.                 event_type_dom = corestring_dom_keypress;
  597.                 break;
  598.  
  599.         case JSAPI_PROP_TINYID_onkeyup:
  600.                 event_type_dom = corestring_dom_keyup;
  601.                 break;
  602.  
  603.         case JSAPI_PROP_TINYID_onload:
  604.                 event_type_dom = corestring_dom_load;
  605.                 break;
  606.  
  607.         case JSAPI_PROP_TINYID_onloadeddata:
  608.                 event_type_dom = corestring_dom_loadeddata;
  609.                 break;
  610.  
  611.         case JSAPI_PROP_TINYID_onloadedmetadata:
  612.                 event_type_dom = corestring_dom_loadedmetadata;
  613.                 break;
  614.  
  615.         case JSAPI_PROP_TINYID_onloadstart:
  616.                 event_type_dom = corestring_dom_loadstart;
  617.                 break;
  618.  
  619.         case JSAPI_PROP_TINYID_onmousedown:
  620.                 event_type_dom = corestring_dom_mousedown;
  621.                 break;
  622.  
  623.         case JSAPI_PROP_TINYID_onmousemove:
  624.                 event_type_dom = corestring_dom_mousemove;
  625.                 break;
  626.  
  627.         case JSAPI_PROP_TINYID_onmouseout:
  628.                 event_type_dom = corestring_dom_mouseout;
  629.                 break;
  630.  
  631.         case JSAPI_PROP_TINYID_onmouseover:
  632.                 event_type_dom = corestring_dom_mouseover;
  633.                 break;
  634.  
  635.         case JSAPI_PROP_TINYID_onmouseup:
  636.                 event_type_dom = corestring_dom_mouseup;
  637.                 break;
  638.  
  639.         case JSAPI_PROP_TINYID_onmousewheel:
  640.                 event_type_dom = corestring_dom_mousewheel;
  641.                 break;
  642.  
  643.         case JSAPI_PROP_TINYID_onpause:
  644.                 event_type_dom = corestring_dom_pause;
  645.                 break;
  646.  
  647.         case JSAPI_PROP_TINYID_onplay:
  648.                 event_type_dom = corestring_dom_play;
  649.                 break;
  650.  
  651.         case JSAPI_PROP_TINYID_onplaying:
  652.                 event_type_dom = corestring_dom_playing;
  653.                 break;
  654.  
  655.         case JSAPI_PROP_TINYID_onprogress:
  656.                 event_type_dom = corestring_dom_progress;
  657.                 break;
  658.  
  659.         case JSAPI_PROP_TINYID_onratechange:
  660.                 event_type_dom = corestring_dom_ratechange;
  661.                 break;
  662.  
  663.         case JSAPI_PROP_TINYID_onreset:
  664.                 event_type_dom = corestring_dom_reset;
  665.                 break;
  666.  
  667.         case JSAPI_PROP_TINYID_onscroll:
  668.                 event_type_dom = corestring_dom_scroll;
  669.                 break;
  670.  
  671.         case JSAPI_PROP_TINYID_onseeked:
  672.                 event_type_dom = corestring_dom_seeked;
  673.                 break;
  674.  
  675.         case JSAPI_PROP_TINYID_onseeking:
  676.                 event_type_dom = corestring_dom_seeking;
  677.                 break;
  678.  
  679.         case JSAPI_PROP_TINYID_onselect:
  680.                 event_type_dom = corestring_dom_select;
  681.                 break;
  682.  
  683.         case JSAPI_PROP_TINYID_onshow:
  684.                 event_type_dom = corestring_dom_show;
  685.                 break;
  686.  
  687.         case JSAPI_PROP_TINYID_onstalled:
  688.                 event_type_dom = corestring_dom_stalled;
  689.                 break;
  690.  
  691.         case JSAPI_PROP_TINYID_onsubmit:
  692.                 event_type_dom = corestring_dom_submit;
  693.                 break;
  694.  
  695.         case JSAPI_PROP_TINYID_onsuspend:
  696.                 event_type_dom = corestring_dom_suspend;
  697.                 break;
  698.  
  699.         case JSAPI_PROP_TINYID_ontimeupdate:
  700.                 event_type_dom = corestring_dom_timeupdate;
  701.                 break;
  702.  
  703.         case JSAPI_PROP_TINYID_onvolumechange:
  704.                 event_type_dom = corestring_dom_volumechange;
  705.                 break;
  706.  
  707.         case JSAPI_PROP_TINYID_onwaiting:
  708.                 event_type_dom = corestring_dom_waiting;
  709.                 break;
  710.  
  711.         default:
  712.                 JSLOG("called with unknown tinyid");
  713.                 return JS_TRUE;
  714.         }
  715.  
  716.         js_dom_event_add_listener((struct jscontext *)cx,
  717.                                   private->htmlc->document,
  718.                                   (dom_node *)private->node,
  719.                                   event_type_dom,
  720.                                   vp);
  721. %}
  722.