diff options
author | Vincent Sanders <vince@netsurf-browser.org> | 2012-12-03 17:34:03 +0000 |
---|---|---|
committer | Vincent Sanders <vince@netsurf-browser.org> | 2012-12-03 17:34:03 +0000 |
commit | 70ece8a428de80d2efacef58d4a2ec259def54b8 (patch) | |
tree | a8012a7af07e28e71cdd7d43d4dec3da27e59653 | |
parent | 30528647735b5bcb689427b3a865f78c57a6070c (diff) | |
download | netsurf-70ece8a428de80d2efacef58d4a2ec259def54b8.tar.gz netsurf-70ece8a428de80d2efacef58d4a2ec259def54b8.tar.bz2 |
add stub implemntation for event handling in elements
-rw-r--r-- | javascript/js.h | 6 | ||||
-rw-r--r-- | javascript/jsapi/htmlelement.bnd | 25 | ||||
-rw-r--r-- | javascript/jsapi/window.bnd | 8 |
3 files changed, 34 insertions, 5 deletions
diff --git a/javascript/js.h b/javascript/js.h index d7943b1b7..643ce5a56 100644 --- a/javascript/js.h +++ b/javascript/js.h @@ -51,10 +51,10 @@ jsobject *js_newcompartment(jscontext *ctx, void *win_priv, void *doc_priv); /* execute some javascript in a context */ bool js_exec(jscontext *ctx, const char *txt, size_t txtlen); -typedef struct dom_document dom_document; -typedef struct dom_node dom_node; +struct dom_document; +struct dom_node; /* fire an event at a dom node */ -bool js_fire_event(jscontext *ctx, const char *type, dom_document *doc, dom_node *target); +bool js_fire_event(jscontext *ctx, const char *type, struct dom_document *doc, struct dom_node *target); #endif /* _NETSURF_JAVASCRIPT_JS_H_ */ diff --git a/javascript/jsapi/htmlelement.bnd b/javascript/jsapi/htmlelement.bnd index 71bb31bc1..15fe83e9c 100644 --- a/javascript/jsapi/htmlelement.bnd +++ b/javascript/jsapi/htmlelement.bnd @@ -36,6 +36,8 @@ binding htmlelement { private "dom_element *" node; private "struct html_content *" htmlc; + + property unshared type EventHandler; } api finalise %{ @@ -214,3 +216,26 @@ getter childElementCount %{ } } %} + +getter EventHandler %{ + JSLOG("propname[%d]=\"%s\"", + tinyid, + jsclass_properties[tinyid].name); +%} + +setter EventHandler %{ + JSLOG("propname[%d]=\"%s\"", + tinyid, + jsclass_properties[tinyid].name); + +/* +1. Create a dom_event_listener From a handle_event function pointer + and a private word In a document context + +2. Register for your events on a target (dom nodes are targets) + dom_event_target_add_event_listener(node, evt_name, listener, + capture_or_not) + + */ + +%} diff --git a/javascript/jsapi/window.bnd b/javascript/jsapi/window.bnd index 56b2ff090..d7f47ce44 100644 --- a/javascript/jsapi/window.bnd +++ b/javascript/jsapi/window.bnd @@ -258,12 +258,16 @@ getter EventHandler %{ /* this implementation is unique to the window object as it is * not a dom node. */ - JSLOG("propname[%d] %s %s", tinyid , jsclass_properties[tinyid].name, JS_GetTypeName(cx, JS_TypeOfValue(cx, tinyid_jsval))); + JSLOG("propname[%d]=\"%s\"", + tinyid, + jsclass_properties[tinyid].name); %} setter EventHandler %{ /* this implementation is unique to the window object as it is * not a dom node. */ - JSLOG("propname[%d] %s %s", tinyid, jsclass_properties[tinyid].name, JS_GetTypeName(cx, JS_TypeOfValue(cx, tinyid_jsval))); + JSLOG("propname[%d]=\"%s\"", + tinyid, + jsclass_properties[tinyid].name); %} |