ELinks 0.18.0
document.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "elinks.h"
#include "cookies/cookies.h"
#include "dialogs/status.h"
#include "document/document.h"
#include "document/libdom/doc.h"
#include "document/libdom/mapa.h"
#include "document/view.h"
#include "js/ecmascript.h"
#include "js/ecmascript-c.h"
#include "js/libdom/parse.h"
#include "js/quickjs/mapa.h"
#include "js/quickjs.h"
#include "js/quickjs/collection.h"
#include "js/quickjs/event.h"
#include "js/quickjs/form.h"
#include "js/quickjs/forms.h"
#include "js/quickjs/fragment.h"
#include "js/quickjs/implementation.h"
#include "js/quickjs/location.h"
#include "js/quickjs/document.h"
#include "js/quickjs/element.h"
#include "js/quickjs/node.h"
#include "js/quickjs/nodelist.h"
#include "js/quickjs/nodelist2.h"
#include "js/quickjs/text.h"
#include "js/quickjs/window.h"
#include "session/session.h"
#include "viewer/text/vs.h"
Include dependency graph for document.c:

Data Structures

struct  document_listener
 
struct  js_document_private
 

Macros

#define countof(x)   (sizeof(x) / sizeof((x)[0]))
 

Enumerations

enum  readyState { LOADING = 0 , INTERACTIVE , COMPLETE }
 

Functions

static void document_event_handler (dom_event *event, void *pw)
 
void * js_doc_getopaque (JSValueConst obj)
 
void * document_get_node (JSValueConst obj)
 
static void js_document_mark (JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func)
 
static JSValue js_document_get_property_anchors (JSContext *ctx, JSValueConst this_val)
 
static JSValue js_document_get_property_baseURI (JSContext *ctx, JSValueConst this_val)
 
static JSValue js_document_get_property_body (JSContext *ctx, JSValueConst this_val)
 
static JSValue js_document_set_property_body (JSContext *ctx, JSValueConst this_val, JSValue val)
 
static JSValue js_document_get_property_charset (JSContext *ctx, JSValueConst this_val)
 
static JSValue js_document_get_property_childNodes (JSContext *ctx, JSValueConst this_val)
 
static JSValue js_document_get_property_currentScript (JSContext *ctx, JSValueConst this_val)
 
static JSValue js_document_get_property_defaultView (JSContext *ctx, JSValueConst this_val)
 
static JSValue js_document_get_property_doctype (JSContext *ctx, JSValueConst this_val)
 
static JSValue js_document_get_property_documentElement (JSContext *ctx, JSValueConst this_val)
 
static JSValue js_document_get_property_documentURI (JSContext *ctx, JSValueConst this_val)
 
static JSValue js_document_get_property_domain (JSContext *ctx, JSValueConst this_val)
 
static JSValue js_document_get_property_forms (JSContext *ctx, JSValueConst this_val)
 
static JSValue js_document_get_property_head (JSContext *ctx, JSValueConst this_val)
 
static JSValue js_document_get_property_images (JSContext *ctx, JSValueConst this_val)
 
static JSValue js_document_get_property_implementation (JSContext *ctx, JSValueConst this_val)
 
static JSValue js_document_get_property_links (JSContext *ctx, JSValueConst this_val)
 
static JSValue js_document_get_property_location (JSContext *ctx, JSValueConst this_val)
 
static JSValue js_document_get_property_nodeType (JSContext *ctx, JSValueConst this_val)
 
static JSValue js_document_set_property_location (JSContext *ctx, JSValueConst this_val, JSValue val)
 
static JSValue js_document_get_property_readyState (JSContext *ctx, JSValueConst this_val)
 
static JSValue js_document_get_property_referrer (JSContext *ctx, JSValueConst this_val)
 
static JSValue js_document_get_property_scripts (JSContext *ctx, JSValueConst this_val)
 
static JSValue js_document_get_property_title (JSContext *ctx, JSValueConst this_val)
 
static JSValue js_document_set_property_title (JSContext *ctx, JSValueConst this_val, JSValue val)
 
static JSValue js_document_get_property_url (JSContext *ctx, JSValueConst this_val)
 
static JSValue js_document_set_property_url (JSContext *ctx, JSValueConst this_val, JSValue val)
 
static JSValue js_document_write_do (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv, int newline)
 
static JSValue js_document_write (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
 
static JSValue js_document_writeln (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
 
static JSValue js_document_replace (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
 
static JSValue js_document_addEventListener (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
 
static JSValue js_document_dispatchEvent (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
 
static JSValue js_document_removeEventListener (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
 
static JSValue js_document_createComment (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
 
static JSValue js_document_createDocumentFragment (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
 
static JSValue js_document_createElement (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
 
static JSValue js_document_createTextNode (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
 
static JSValue js_document_getElementById (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
 
static JSValue js_document_getElementsByClassName (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
 
static JSValue js_document_getElementsByTagName (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
 
static JSValue js_document_querySelector (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
 
static JSValue js_document_querySelectorAll (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
 
static JSValue js_doctype_get_property_name (JSContext *ctx, JSValueConst this_val)
 
static JSValue js_doctype_get_property_publicId (JSContext *ctx, JSValueConst this_val)
 
static JSValue js_doctype_get_property_systemId (JSContext *ctx, JSValueConst this_val)
 
static JSValue js_document_toString (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
 
static void js_document_finalizer (JSRuntime *rt, JSValue val)
 
static JSValue js_doctype_toString (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
 
static void js_doctype_finalizer (JSRuntime *rt, JSValue val)
 
int js_doctype_init (JSContext *ctx)
 
JSValue getDoctype (JSContext *ctx, void *node)
 
JSValue getDocument (JSContext *ctx, void *doc)
 
JSValue getDocument2 (JSContext *ctx, void *doc)
 
static JSValue js_document_constructor (JSContext *ctx, JSValueConst new_target, int argc, JSValueConst *argv)
 
static void JS_NewGlobalCConstructor2 (JSContext *ctx, JSValue func_obj, const char *name, JSValueConst proto)
 
static JSValueConst JS_NewGlobalCConstructor (JSContext *ctx, const char *name, JSCFunction *func, int length, JSValueConst proto)
 
int js_document_init (JSContext *ctx)
 

Variables

static JSClassID js_doctype_class_id
 
static JSClassID js_document_class_id
 
static const JSCFunctionListEntry js_document_proto_funcs []
 
static JSClassDef js_document_class
 
static const JSCFunctionListEntry js_doctype_proto_funcs []
 
void * map_doctypes
 
static JSClassDef js_doctype_class
 

Macro Definition Documentation

◆ countof

#define countof ( x)    (sizeof(x) / sizeof((x)[0]))

Enumeration Type Documentation

◆ readyState

enum readyState
Enumerator
LOADING 
INTERACTIVE 
COMPLETE 

Function Documentation

◆ document_event_handler()

static void document_event_handler ( dom_event * event,
void * pw )
static

◆ document_get_node()

void * document_get_node ( JSValueConst obj)

◆ getDoctype()

JSValue getDoctype ( JSContext * ctx,
void * node )

◆ getDocument()

JSValue getDocument ( JSContext * ctx,
void * doc )

◆ getDocument2()

JSValue getDocument2 ( JSContext * ctx,
void * doc )

◆ js_doc_getopaque()

void * js_doc_getopaque ( JSValueConst obj)

◆ js_doctype_finalizer()

static void js_doctype_finalizer ( JSRuntime * rt,
JSValue val )
static

◆ js_doctype_get_property_name()

static JSValue js_doctype_get_property_name ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_doctype_get_property_publicId()

static JSValue js_doctype_get_property_publicId ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_doctype_get_property_systemId()

static JSValue js_doctype_get_property_systemId ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_doctype_init()

int js_doctype_init ( JSContext * ctx)

◆ js_doctype_toString()

static JSValue js_doctype_toString ( JSContext * ctx,
JSValueConst this_val,
int argc,
JSValueConst * argv )
static

◆ js_document_addEventListener()

static JSValue js_document_addEventListener ( JSContext * ctx,
JSValueConst this_val,
int argc,
JSValueConst * argv )
static

◆ js_document_constructor()

static JSValue js_document_constructor ( JSContext * ctx,
JSValueConst new_target,
int argc,
JSValueConst * argv )
static

◆ js_document_createComment()

static JSValue js_document_createComment ( JSContext * ctx,
JSValueConst this_val,
int argc,
JSValueConst * argv )
static

◆ js_document_createDocumentFragment()

static JSValue js_document_createDocumentFragment ( JSContext * ctx,
JSValueConst this_val,
int argc,
JSValueConst * argv )
static

◆ js_document_createElement()

static JSValue js_document_createElement ( JSContext * ctx,
JSValueConst this_val,
int argc,
JSValueConst * argv )
static

◆ js_document_createTextNode()

static JSValue js_document_createTextNode ( JSContext * ctx,
JSValueConst this_val,
int argc,
JSValueConst * argv )
static

◆ js_document_dispatchEvent()

static JSValue js_document_dispatchEvent ( JSContext * ctx,
JSValueConst this_val,
int argc,
JSValueConst * argv )
static

◆ js_document_finalizer()

static void js_document_finalizer ( JSRuntime * rt,
JSValue val )
static

◆ js_document_get_property_anchors()

static JSValue js_document_get_property_anchors ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_document_get_property_baseURI()

static JSValue js_document_get_property_baseURI ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_document_get_property_body()

static JSValue js_document_get_property_body ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_document_get_property_charset()

static JSValue js_document_get_property_charset ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_document_get_property_childNodes()

static JSValue js_document_get_property_childNodes ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_document_get_property_currentScript()

static JSValue js_document_get_property_currentScript ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_document_get_property_defaultView()

static JSValue js_document_get_property_defaultView ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_document_get_property_doctype()

static JSValue js_document_get_property_doctype ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_document_get_property_documentElement()

static JSValue js_document_get_property_documentElement ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_document_get_property_documentURI()

static JSValue js_document_get_property_documentURI ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_document_get_property_domain()

static JSValue js_document_get_property_domain ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_document_get_property_forms()

static JSValue js_document_get_property_forms ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_document_get_property_head()

static JSValue js_document_get_property_head ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_document_get_property_images()

static JSValue js_document_get_property_images ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_document_get_property_implementation()

static JSValue js_document_get_property_implementation ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_document_get_property_links()

static JSValue js_document_get_property_links ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_document_get_property_location()

static JSValue js_document_get_property_location ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_document_get_property_nodeType()

static JSValue js_document_get_property_nodeType ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_document_get_property_readyState()

static JSValue js_document_get_property_readyState ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_document_get_property_referrer()

static JSValue js_document_get_property_referrer ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_document_get_property_scripts()

static JSValue js_document_get_property_scripts ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_document_get_property_title()

static JSValue js_document_get_property_title ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_document_get_property_url()

static JSValue js_document_get_property_url ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_document_getElementById()

static JSValue js_document_getElementById ( JSContext * ctx,
JSValueConst this_val,
int argc,
JSValueConst * argv )
static

◆ js_document_getElementsByClassName()

static JSValue js_document_getElementsByClassName ( JSContext * ctx,
JSValueConst this_val,
int argc,
JSValueConst * argv )
static

◆ js_document_getElementsByTagName()

static JSValue js_document_getElementsByTagName ( JSContext * ctx,
JSValueConst this_val,
int argc,
JSValueConst * argv )
static

◆ js_document_init()

int js_document_init ( JSContext * ctx)

◆ js_document_mark()

static void js_document_mark ( JSRuntime * rt,
JSValueConst val,
JS_MarkFunc * mark_func )
static

◆ js_document_querySelector()

static JSValue js_document_querySelector ( JSContext * ctx,
JSValueConst this_val,
int argc,
JSValueConst * argv )
static

◆ js_document_querySelectorAll()

static JSValue js_document_querySelectorAll ( JSContext * ctx,
JSValueConst this_val,
int argc,
JSValueConst * argv )
static

◆ js_document_removeEventListener()

static JSValue js_document_removeEventListener ( JSContext * ctx,
JSValueConst this_val,
int argc,
JSValueConst * argv )
static

◆ js_document_replace()

static JSValue js_document_replace ( JSContext * ctx,
JSValueConst this_val,
int argc,
JSValueConst * argv )
static

◆ js_document_set_property_body()

static JSValue js_document_set_property_body ( JSContext * ctx,
JSValueConst this_val,
JSValue val )
static

◆ js_document_set_property_location()

static JSValue js_document_set_property_location ( JSContext * ctx,
JSValueConst this_val,
JSValue val )
static

◆ js_document_set_property_title()

static JSValue js_document_set_property_title ( JSContext * ctx,
JSValueConst this_val,
JSValue val )
static

◆ js_document_set_property_url()

static JSValue js_document_set_property_url ( JSContext * ctx,
JSValueConst this_val,
JSValue val )
static

◆ js_document_toString()

static JSValue js_document_toString ( JSContext * ctx,
JSValueConst this_val,
int argc,
JSValueConst * argv )
static

◆ js_document_write()

static JSValue js_document_write ( JSContext * ctx,
JSValueConst this_val,
int argc,
JSValueConst * argv )
static

◆ js_document_write_do()

static JSValue js_document_write_do ( JSContext * ctx,
JSValueConst this_val,
int argc,
JSValueConst * argv,
int newline )
static

◆ js_document_writeln()

static JSValue js_document_writeln ( JSContext * ctx,
JSValueConst this_val,
int argc,
JSValueConst * argv )
static

◆ JS_NewGlobalCConstructor()

static JSValueConst JS_NewGlobalCConstructor ( JSContext * ctx,
const char * name,
JSCFunction * func,
int length,
JSValueConst proto )
static

◆ JS_NewGlobalCConstructor2()

static void JS_NewGlobalCConstructor2 ( JSContext * ctx,
JSValue func_obj,
const char * name,
JSValueConst proto )
static

Variable Documentation

◆ js_doctype_class

JSClassDef js_doctype_class
static
Initial value:
= {
"doctype",
}
static void js_doctype_finalizer(JSRuntime *rt, JSValue val)
Definition document.c:1990

◆ js_doctype_class_id

JSClassID js_doctype_class_id
static

◆ js_doctype_proto_funcs

const JSCFunctionListEntry js_doctype_proto_funcs[]
static
Initial value:
= {
JS_CGETSET_DEF("name", js_doctype_get_property_name, NULL),
JS_CGETSET_DEF("publicId", js_doctype_get_property_publicId, NULL),
JS_CGETSET_DEF("systemId", js_doctype_get_property_systemId, NULL),
}
#define NULL
Definition explodename.c:35
static JSValue js_doctype_get_property_name(JSContext *ctx, JSValueConst this_val)
Definition document.c:1798
static JSValue js_doctype_get_property_publicId(JSContext *ctx, JSValueConst this_val)
Definition document.c:1823
static JSValue js_doctype_get_property_systemId(JSContext *ctx, JSValueConst this_val)
Definition document.c:1848

◆ js_document_class

JSClassDef js_document_class
static
Initial value:
= {
"document",
.finalizer = js_document_finalizer,
.gc_mark = js_document_mark
}
static void js_document_mark(JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func)
Definition document.c:96
static void js_document_finalizer(JSRuntime *rt, JSValue val)
Definition document.c:1934

◆ js_document_class_id

JSClassID js_document_class_id
static

◆ js_document_proto_funcs

const JSCFunctionListEntry js_document_proto_funcs[]
static

◆ map_doctypes

void* map_doctypes