1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-10-11 05:29:28 -04:00

DOM, SELECT: The type of the options property is struct dom_node *.

This commit is contained in:
Witold Filipczyk 2007-06-12 18:42:39 +02:00 committed by Witold Filipczyk
parent 6e010d76ff
commit 3545c7225f
2 changed files with 21 additions and 3 deletions

View File

@ -7,6 +7,7 @@
#include "document/dom/ecmascript/spidermonkey.h"
#include "document/dom/ecmascript/spidermonkey/Node.h"
#include "document/dom/ecmascript/spidermonkey/html/HTMLFormElement.h"
#include "document/dom/ecmascript/spidermonkey/html/HTMLOptionsCollection.h"
#include "document/dom/ecmascript/spidermonkey/html/HTMLSelectElement.h"
#include "dom/node.h"
@ -49,8 +50,24 @@ HTMLSelectElement_getProperty(JSContext *ctx, JSObject *obj, jsval id, jsval *vp
undef_to_jsval(ctx, vp);
break;
case JSP_HTML_SELECT_ELEMENT_OPTIONS:
string_to_jsval(ctx, vp, html->options);
/* Write me! */
if (!html->options)
undef_to_jsval(ctx, vp);
else {
if (html->options->ctx == ctx)
object_to_jsval(ctx, vp, html->options->ecmascript_obj);
else {
JSObject *new_obj;
html->options->ctx = ctx;
new_obj = JS_NewObject(ctx,
(JSClass *)&HTMLOptionsCollection_class, NULL, NULL);
if (new_obj) {
JS_SetPrivate(ctx, new_obj, html->options);
}
html->options->ecmascript_obj = new_obj;
object_to_jsval(ctx, vp, new_obj);
}
}
break;
case JSP_HTML_SELECT_ELEMENT_DISABLED:
boolean_to_jsval(ctx, vp, html->disabled);

View File

@ -11,9 +11,9 @@ extern const JSPropertySpec HTMLSelectElement_props[];
struct SELECT_struct {
struct HTMLElement_struct html;
struct dom_node *form; /* Must be first! */
struct dom_node_list *options;
unsigned char *type;
unsigned char *value;
unsigned char *options; /* FIXME: proper type */
unsigned char *name;
int selected_index;
int length;
@ -25,4 +25,5 @@ struct SELECT_struct {
void make_SELECT_object(JSContext *ctx, struct dom_node *node);
void done_SELECT_object(struct dom_node *node);
#endif