mirror of
https://github.com/rkd77/elinks.git
synced 2025-02-02 15:09:23 -05:00
[quickjs] "Fixes" related to DOMParser
This commit is contained in:
parent
4cb9d10cb1
commit
6552a3df8a
src/ecmascript/quickjs
@ -2009,6 +2009,34 @@ getDocument(JSContext *ctx, void *doc)
|
|||||||
RETURN_JS(document_obj);
|
RETURN_JS(document_obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JSValue
|
||||||
|
getDocument2(JSContext *ctx, void *doc)
|
||||||
|
{
|
||||||
|
#ifdef ECMASCRIPT_DEBUG
|
||||||
|
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
|
||||||
|
#endif
|
||||||
|
struct js_document_private *doc_private = (struct js_document_private *)mem_calloc(1, sizeof(*doc_private));
|
||||||
|
|
||||||
|
if (!doc_private) {
|
||||||
|
return JS_NULL;
|
||||||
|
}
|
||||||
|
init_list(doc_private->listeners);
|
||||||
|
|
||||||
|
if (doc) {
|
||||||
|
dom_node_ref((dom_node *)doc);
|
||||||
|
}
|
||||||
|
doc_private->node = doc;
|
||||||
|
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS_GetContextOpaque(ctx);
|
||||||
|
doc_private->interpreter = interpreter;
|
||||||
|
|
||||||
|
JSValue document_obj = JS_NewObjectClass(ctx, js_document_class_id);
|
||||||
|
JS_SetPropertyFunctionList(ctx, document_obj, js_document_proto_funcs, countof(js_document_proto_funcs));
|
||||||
|
JS_SetOpaque(document_obj, doc_private);
|
||||||
|
doc_private->thisval = document_obj;
|
||||||
|
|
||||||
|
RETURN_JS(document_obj);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
document_event_handler(dom_event *event, void *pw)
|
document_event_handler(dom_event *event, void *pw)
|
||||||
{
|
{
|
||||||
|
@ -8,6 +8,7 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
JSValue getDocument(JSContext *ctx, void *doc);
|
JSValue getDocument(JSContext *ctx, void *doc);
|
||||||
|
JSValue getDocument2(JSContext *ctx, void *doc);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ js_domparser_parseFromString(JSContext *ctx, JSValueConst this_val, int argc, JS
|
|||||||
return JS_NULL;
|
return JS_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return getDocument(ctx, doc);
|
return getDocument2(ctx, doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static JSValue
|
static JSValue
|
||||||
|
Loading…
x
Reference in New Issue
Block a user