ELinks 0.18.0
element.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "elinks.h"
#include "dialogs/status.h"
#include "document/document.h"
#include "document/libdom/corestrings.h"
#include "document/libdom/doc.h"
#include "document/libdom/mapa.h"
#include "document/libdom/renderer2.h"
#include "document/view.h"
#include "js/ecmascript.h"
#include "js/ecmascript-c.h"
#include "js/quickjs/mapa.h"
#include "js/quickjs.h"
#include "js/quickjs/attr.h"
#include "js/quickjs/attributes.h"
#include "js/quickjs/collection.h"
#include "js/quickjs/dataset.h"
#include "js/quickjs/document.h"
#include "js/quickjs/domrect.h"
#include "js/quickjs/element.h"
#include "js/quickjs/event.h"
#include "js/quickjs/fragment.h"
#include "js/quickjs/heartbeat.h"
#include "js/quickjs/keyboard.h"
#include "js/quickjs/node.h"
#include "js/quickjs/nodelist.h"
#include "js/quickjs/nodelist2.h"
#include "js/quickjs/style.h"
#include "js/quickjs/text.h"
#include "js/quickjs/tokenlist.h"
#include "js/quickjs/window.h"
#include "session/session.h"
#include "terminal/event.h"
#include "viewer/text/draw.h"
#include "viewer/text/form.h"
#include "viewer/text/link.h"
#include "viewer/text/vs.h"
Include dependency graph for element.c:

Data Structures

struct  element_listener
struct  js_element_private

Macros

#define countof(x)

Functions

static void element_event_handler (dom_event *event, void *pw)
static JSValue js_element_set_property_textContent (JSContext *ctx, JSValueConst this_val, JSValue val)
void * js_getopaque (JSValueConst obj, JSClassID class_id)
void * js_getopaque_any (JSValueConst obj)
static JSValue js_element_get_property_attributes (JSContext *ctx, JSValueConst this_val)
static JSValue js_element_get_property_checked (JSContext *ctx, JSValueConst this_val)
static JSValue js_element_set_property_checked (JSContext *ctx, JSValueConst this_val, JSValue val)
static JSValue js_element_get_property_children (JSContext *ctx, JSValueConst this_val)
static JSValue js_element_get_property_childElementCount (JSContext *ctx, JSValueConst this_val)
static JSValue js_element_get_property_childNodes (JSContext *ctx, JSValueConst this_val)
static JSValue js_element_get_property_classList (JSContext *ctx, JSValueConst this_val)
static JSValue js_element_get_property_className (JSContext *ctx, JSValueConst this_val)
static JSValue js_element_get_property_dataset (JSContext *ctx, JSValueConst this_val)
static JSValue js_element_get_property_dir (JSContext *ctx, JSValueConst this_val)
static JSValue js_element_get_property_firstChild (JSContext *ctx, JSValueConst this_val)
static JSValue js_element_get_property_firstElementChild (JSContext *ctx, JSValueConst this_val)
static JSValue js_element_get_property_height (JSContext *ctx, JSValueConst this_val)
static JSValue js_element_get_property_href (JSContext *ctx, JSValueConst this_val)
static JSValue js_element_get_property_id (JSContext *ctx, JSValueConst this_val)
static JSValue js_element_get_property_lang (JSContext *ctx, JSValueConst this_val)
static JSValue js_element_get_property_lastChild (JSContext *ctx, JSValueConst this_val)
static JSValue js_element_get_property_lastElementChild (JSContext *ctx, JSValueConst this_val)
static JSValue js_element_get_property_nextElementSibling (JSContext *ctx, JSValueConst this_val)
static JSValue js_element_get_property_nodeName (JSContext *ctx, JSValueConst this_val)
static JSValue js_element_get_property_nodeType (JSContext *ctx, JSValueConst this_val)
static JSValue js_element_get_property_nodeValue (JSContext *ctx, JSValueConst this_val)
static JSValue js_element_set_property_nodeValue (JSContext *ctx, JSValueConst this_val, JSValue val)
static JSValue js_element_get_property_nextSibling (JSContext *ctx, JSValueConst this_val)
static JSValue js_element_get_property_offsetParent (JSContext *ctx, JSValueConst this_val)
static JSValue js_element_get_property_ownerDocument (JSContext *ctx, JSValueConst this_val)
static JSValue js_element_get_property_parentElement (JSContext *ctx, JSValueConst this_val)
static JSValue js_element_get_property_parentNode (JSContext *ctx, JSValueConst this_val)
static JSValue js_element_get_property_previousElementSibling (JSContext *ctx, JSValueConst this_val)
static JSValue js_element_get_property_previousSibling (JSContext *ctx, JSValueConst this_val)
static JSValue js_element_get_property_style (JSContext *ctx, JSValueConst this_val)
static JSValue js_element_get_property_tagName (JSContext *ctx, JSValueConst this_val)
static JSValue js_element_get_property_title (JSContext *ctx, JSValueConst this_val)
static JSValue js_element_get_property_value (JSContext *ctx, JSValueConst this_val)
static JSValue js_element_get_property_innerHtml (JSContext *ctx, JSValueConst this_val)
static JSValue js_element_get_property_outerHtml (JSContext *ctx, JSValueConst this_val)
static JSValue js_element_get_property_textContent (JSContext *ctx, JSValueConst this_val)
static JSValue js_element_get_property_width (JSContext *ctx, JSValueConst this_val)
static JSValue js_element_set_property_className (JSContext *ctx, JSValueConst this_val, JSValue val)
static JSValue js_element_set_property_dir (JSContext *ctx, JSValueConst this_val, JSValue val)
static JSValue js_element_set_property_href (JSContext *ctx, JSValueConst this_val, JSValue val)
static JSValue js_element_set_property_id (JSContext *ctx, JSValueConst this_val, JSValue val)
static JSValue js_element_set_property_innerHtml (JSContext *ctx, JSValueConst this_val, JSValue val)
static JSValue js_element_set_property_innerText (JSContext *ctx, JSValueConst this_val, JSValue val)
static JSValue js_element_set_property_lang (JSContext *ctx, JSValueConst this_val, JSValue val)
static JSValue js_element_set_property_outerHtml (JSContext *ctx, JSValueConst this_val, JSValue val)
static JSValue js_element_set_property_title (JSContext *ctx, JSValueConst this_val, JSValue val)
static JSValue js_element_set_property_value (JSContext *ctx, JSValueConst this_val, JSValue val)
static JSValue js_element_dispatchEvent (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
static JSValue js_element_addEventListener (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
static JSValue js_element_removeEventListener (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
static JSValue js_element_appendChild (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
static JSValue js_element_blur (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
static JSValue js_element_click (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
static JSValue js_element_cloneNode (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
static JSValue js_element_closest (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
static JSValue js_element_contains (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
static JSValue js_element_focus (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
static JSValue js_element_getAttribute (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
static JSValue js_element_getAttributeNode (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
static JSValue js_element_getBoundingClientRect (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
static JSValue js_element_getElementsByTagName (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
static JSValue js_element_hasAttribute (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
static JSValue js_element_hasAttributes (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
static JSValue js_element_hasChildNodes (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
static JSValue js_element_insertBefore (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
static JSValue js_element_isEqualNode (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
static JSValue js_element_isSameNode (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
static JSValue js_element_matches (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
static JSValue js_element_querySelector (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
static JSValue js_element_querySelectorAll (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
static JSValue js_element_remove (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
static JSValue js_element_removeAttribute (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
static JSValue js_element_removeChild (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
static JSValue js_element_replaceWith (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
static JSValue js_element_setAttribute (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
static JSValue js_element_toString (JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
static void js_element_finalizer (JSRuntime *rt, JSValue val)
static void js_element_mark (JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func)
int js_element_init (JSContext *ctx)
JSValue getElement (JSContext *ctx, void *node)
void check_element_event (void *interp, void *elem, const char *event_name, struct term_event *ev)

Variables

JSClassID js_element_class_id
static const JSCFunctionListEntry js_element_proto_funcs []
static JSClassDef js_element_class
void * map_privates

Macro Definition Documentation

◆ countof

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

Function Documentation

◆ check_element_event()

void check_element_event ( void * interp,
void * elem,
const char * event_name,
struct term_event * ev )

◆ element_event_handler()

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

◆ getElement()

JSValue getElement ( JSContext * ctx,
void * node )

◆ js_element_addEventListener()

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

◆ js_element_appendChild()

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

◆ js_element_blur()

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

◆ js_element_click()

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

◆ js_element_cloneNode()

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

◆ js_element_closest()

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

◆ js_element_contains()

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

◆ js_element_dispatchEvent()

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

◆ js_element_finalizer()

void js_element_finalizer ( JSRuntime * rt,
JSValue val )
static

◆ js_element_focus()

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

◆ js_element_get_property_attributes()

JSValue js_element_get_property_attributes ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_element_get_property_checked()

JSValue js_element_get_property_checked ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_element_get_property_childElementCount()

JSValue js_element_get_property_childElementCount ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_element_get_property_childNodes()

JSValue js_element_get_property_childNodes ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_element_get_property_children()

JSValue js_element_get_property_children ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_element_get_property_classList()

JSValue js_element_get_property_classList ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_element_get_property_className()

JSValue js_element_get_property_className ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_element_get_property_dataset()

JSValue js_element_get_property_dataset ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_element_get_property_dir()

JSValue js_element_get_property_dir ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_element_get_property_firstChild()

JSValue js_element_get_property_firstChild ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_element_get_property_firstElementChild()

JSValue js_element_get_property_firstElementChild ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_element_get_property_height()

JSValue js_element_get_property_height ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_element_get_property_href()

JSValue js_element_get_property_href ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_element_get_property_id()

JSValue js_element_get_property_id ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_element_get_property_innerHtml()

JSValue js_element_get_property_innerHtml ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_element_get_property_lang()

JSValue js_element_get_property_lang ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_element_get_property_lastChild()

JSValue js_element_get_property_lastChild ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_element_get_property_lastElementChild()

JSValue js_element_get_property_lastElementChild ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_element_get_property_nextElementSibling()

JSValue js_element_get_property_nextElementSibling ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_element_get_property_nextSibling()

JSValue js_element_get_property_nextSibling ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_element_get_property_nodeName()

JSValue js_element_get_property_nodeName ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_element_get_property_nodeType()

JSValue js_element_get_property_nodeType ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_element_get_property_nodeValue()

JSValue js_element_get_property_nodeValue ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_element_get_property_offsetParent()

JSValue js_element_get_property_offsetParent ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_element_get_property_outerHtml()

JSValue js_element_get_property_outerHtml ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_element_get_property_ownerDocument()

JSValue js_element_get_property_ownerDocument ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_element_get_property_parentElement()

JSValue js_element_get_property_parentElement ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_element_get_property_parentNode()

JSValue js_element_get_property_parentNode ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_element_get_property_previousElementSibling()

JSValue js_element_get_property_previousElementSibling ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_element_get_property_previousSibling()

JSValue js_element_get_property_previousSibling ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_element_get_property_style()

JSValue js_element_get_property_style ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_element_get_property_tagName()

JSValue js_element_get_property_tagName ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_element_get_property_textContent()

JSValue js_element_get_property_textContent ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_element_get_property_title()

JSValue js_element_get_property_title ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_element_get_property_value()

JSValue js_element_get_property_value ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_element_get_property_width()

JSValue js_element_get_property_width ( JSContext * ctx,
JSValueConst this_val )
static

◆ js_element_getAttribute()

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

◆ js_element_getAttributeNode()

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

◆ js_element_getBoundingClientRect()

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

◆ js_element_getElementsByTagName()

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

◆ js_element_hasAttribute()

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

◆ js_element_hasAttributes()

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

◆ js_element_hasChildNodes()

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

◆ js_element_init()

int js_element_init ( JSContext * ctx)

◆ js_element_insertBefore()

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

◆ js_element_isEqualNode()

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

◆ js_element_isSameNode()

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

◆ js_element_mark()

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

◆ js_element_matches()

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

◆ js_element_querySelector()

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

◆ js_element_querySelectorAll()

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

◆ js_element_remove()

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

◆ js_element_removeAttribute()

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

◆ js_element_removeChild()

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

◆ js_element_removeEventListener()

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

◆ js_element_replaceWith()

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

◆ js_element_set_property_checked()

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

◆ js_element_set_property_className()

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

◆ js_element_set_property_dir()

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

◆ js_element_set_property_href()

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

◆ js_element_set_property_id()

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

◆ js_element_set_property_innerHtml()

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

◆ js_element_set_property_innerText()

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

◆ js_element_set_property_lang()

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

◆ js_element_set_property_nodeValue()

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

◆ js_element_set_property_outerHtml()

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

◆ js_element_set_property_textContent()

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

◆ js_element_set_property_title()

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

◆ js_element_set_property_value()

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

◆ js_element_setAttribute()

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

◆ js_element_toString()

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

◆ js_getopaque()

void * js_getopaque ( JSValueConst obj,
JSClassID class_id )

◆ js_getopaque_any()

void * js_getopaque_any ( JSValueConst obj)

Variable Documentation

◆ js_element_class

JSClassDef js_element_class
static
Initial value:
= {
"Element",
.finalizer = js_element_finalizer,
.gc_mark = js_element_mark,
}
static void js_element_finalizer(JSRuntime *rt, JSValue val)
Definition element.c:3922
static void js_element_mark(JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func)
Definition element.c:3964

◆ js_element_class_id

JSClassID js_element_class_id

◆ js_element_proto_funcs

const JSCFunctionListEntry js_element_proto_funcs[]
static

◆ map_privates

void* map_privates