summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2015-07-21 23:48:45 +0100
committerVincent Sanders <vince@kyllikki.org>2015-07-21 23:48:45 +0100
commit1288d8c535edd2ce29eebdc4acca6b2beab89841 (patch)
tree162bd2d090e03a7ffb9523797c1dd2aebbce236f
parent94137186a3e2270e9b96f243a82a77a590c17f01 (diff)
downloadnsgenbind-1288d8c535edd2ce29eebdc4acca6b2beab89841.tar.gz
nsgenbind-1288d8c535edd2ce29eebdc4acca6b2beab89841.tar.bz2
Change binding grammar to new approach.
-rw-r--r--README62
-rw-r--r--src/Makefile3
-rw-r--r--src/nsgenbind-ast.c759
-rw-r--r--src/nsgenbind-ast.h113
-rw-r--r--src/nsgenbind-lexer.l39
-rw-r--r--src/nsgenbind-parser.y386
-rw-r--r--src/nsgenbind.c324
-rw-r--r--src/options.h15
-rw-r--r--src/utils.c52
-rw-r--r--src/utils.h21
-rw-r--r--test/data/bindings/browser-duk.bnd66
-rw-r--r--test/data/idl/console.idl24
-rw-r--r--test/data/idl/dom.idl343
-rw-r--r--test/data/idl/html.idl2446
14 files changed, 2554 insertions, 2099 deletions
diff --git a/README b/README
index 70d224f..e260642 100644
--- a/README
+++ b/README
@@ -7,4 +7,64 @@ files and a binding configuration file.
building
--------
-The tool requires bison and flex as pre-requisites \ No newline at end of file
+The tool requires bison and flex as pre-requisites
+
+Commandline
+-----------
+
+nsgenbind [-v] [-g] [-D] [-W] [-I idlpath] inputfile outputdir
+
+-v
+The verbose switch makes the tool verbose about what operations it is
+performing instead of teh default of only reporting errors.
+
+-g
+The generated code will be augmented with runtime debug logging so it
+can be traced
+
+-D
+The tool will generate output to allow debugging of output conversion.
+This includes dumps of the binding and IDL files AST
+
+-W
+This switch will make the tool generate warnings about various issues
+with the binding or IDL files being processed.
+
+-I
+An additional search path may be given so idl files can be located.
+
+The tool requires a binding file as input and an output directory in
+which to place its output.
+
+
+Web IDL
+-------
+
+The IDL is specified in a w3c document[1] but the second edition is in
+draft[2] and covers many of the features actually used in the whatwg
+dom and html spec.
+
+The principal usage of the IDL is to define the interface between
+scripts and a browsers internal state. For example the DOM[3] and
+HTML[4] specs contain all the IDL for acessing the DOM and interacting
+with a web browser (this not strictly true as there are several
+interfaces simply not in the standards such as console).
+
+The IDL uses some slightly strange names than other object orientated
+systems.
+
+ IDL | JS | OOP | Notes
+-----------+------------------+----------------+----------------------------
+ interface | prototype | class | The data definition of
+ | | | the object
+ constants | read-only value | class variable | Belong to class, one copy
+ | property on the | |
+ | prototype | |
+ operation | method | method | functions that can be called
+ attribute | property | property | Variables set per instance
+-----------+------------------+----------------+----------------------------
+
+[1] http://www.w3.org/TR/WebIDL/
+[2] https://heycam.github.io/webidl/
+[3] https://dom.spec.whatwg.org/
+[4] https://html.spec.whatwg.org/
diff --git a/src/Makefile b/src/Makefile
index e93cb99..3e5b8af 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,7 +1,8 @@
CFLAGS := $(CFLAGS) -I$(BUILDDIR) -Isrc/ -g -DYYENABLE_NLS=0
# Sources in this directory
-DIR_SOURCES := nsgenbind.c webidl-ast.c nsgenbind-ast.c jsapi-libdom.c jsapi-libdom-function.c jsapi-libdom-property.c jsapi-libdom-init.c jsapi-libdom-new.c jsapi-libdom-infmap.c jsapi-libdom-jsclass.c
+DIR_SOURCES := nsgenbind.c utils.c webidl-ast.c nsgenbind-ast.c
+# jsapi-libdom.c jsapi-libdom-function.c jsapi-libdom-property.c jsapi-libdom-init.c jsapi-libdom-new.c jsapi-libdom-infmap.c jsapi-libdom-jsclass.c
SOURCES := $(SOURCES) $(BUILDDIR)/nsgenbind-parser.c $(BUILDDIR)/nsgenbind-lexer.c $(BUILDDIR)/webidl-parser.c $(BUILDDIR)/webidl-lexer.c
diff --git a/src/nsgenbind-ast.c b/src/nsgenbind-ast.c
index 2f630b7..49477cf 100644
--- a/src/nsgenbind-ast.c
+++ b/src/nsgenbind-ast.c
@@ -14,7 +14,9 @@
#include <stdlib.h>
#include <errno.h>
#include <string.h>
+#include <stdarg.h>
+#include "utils.h"
#include "nsgenbind-ast.h"
#include "options.h"
@@ -26,478 +28,521 @@ extern int nsgenbind_parse(struct genbind_node **genbind_ast);
/* terminal nodes have a value only */
struct genbind_node {
- enum genbind_node_type type;
- struct genbind_node *l;
- union {
- void *value;
- struct genbind_node *node;
- char *text;
- int number; /* node data is an integer */
- } r;
+ enum genbind_node_type type;
+ struct genbind_node *l;
+ union {
+ void *value;
+ struct genbind_node *node;
+ char *text;
+ int number; /* node data is an integer */
+ } r;
};
char *genbind_strapp(char *a, char *b)
{
- char *fullstr;
- int fulllen;
- fulllen = strlen(a) + strlen(b) + 1;
- fullstr = malloc(fulllen);
- snprintf(fullstr, fulllen, "%s%s", a, b);
- free(a);
- free(b);
- return fullstr;
+ char *fullstr;
+ int fulllen;
+ fulllen = strlen(a) + strlen(b) + 1;
+ fullstr = malloc(fulllen);
+ snprintf(fullstr, fulllen, "%s%s", a, b);
+ free(a);
+ free(b);
+ return fullstr;
}
struct genbind_node *
genbind_node_link(struct genbind_node *tgt, struct genbind_node *src)
{
- tgt->l = src;
- return tgt;
+ tgt->l = src;
+ return tgt;
}
struct genbind_node *
genbind_new_node(enum genbind_node_type type, struct genbind_node *l, void *r)
{
- struct genbind_node *nn;
- nn = calloc(1, sizeof(struct genbind_node));
- nn->type = type;
- nn->l = l;
- nn->r.value = r;
- return nn;
+ struct genbind_node *nn;
+ nn = calloc(1, sizeof(struct genbind_node));
+ nn->type = type;
+ nn->l = l;
+ nn->r.value = r;
+ return nn;
}
/* exported interface defined in nsgenbind-ast.h */
int
genbind_node_foreach_type(struct genbind_node *node,
- enum genbind_node_type type,
- genbind_callback_t *cb,
- void *ctx)
+ enum genbind_node_type type,
+ genbind_callback_t *cb,
+ void *ctx)
{
- int ret;
-
- if (node == NULL) {
- return -1;
- }
- if (node->l != NULL) {
- ret = genbind_node_foreach_type(node->l, type, cb, ctx);
- if (ret != 0) {
- return ret;
- }
- }
- if (node->type == type) {
- return cb(node, ctx);
- }
-
- return 0;
+ int ret;
+
+ if (node == NULL) {
+ return -1;
+ }
+ if (node->l != NULL) {
+ ret = genbind_node_foreach_type(node->l, type, cb, ctx);
+ if (ret != 0) {
+ return ret;
+ }
+ }
+ if (node->type == type) {
+ return cb(node, ctx);
+ }
+
+ return 0;
}
static int genbind_enumerate_node(struct genbind_node *node, void *ctx)
{
- node = node;
- (*((int *)ctx))++;
- return 0;
+ node = node;
+ (*((int *)ctx))++;
+ return 0;
}
/* exported interface defined in nsgenbind-ast.h */
int
genbind_node_enumerate_type(struct genbind_node *node,
- enum genbind_node_type type)
+ enum genbind_node_type type)
{
- int count = 0;
- genbind_node_foreach_type(node,
- type,
- genbind_enumerate_node,
- &count);
- return count;
+ int count = 0;
+ genbind_node_foreach_type(node,
+ type,
+ genbind_enumerate_node,
+ &count);
+ return count;
}
/* exported interface defined in nsgenbind-ast.h */
struct genbind_node *
genbind_node_find(struct genbind_node *node,
- struct genbind_node *prev,
- genbind_callback_t *cb,
- void *ctx)
+ struct genbind_node *prev,
+ genbind_callback_t *cb,
+ void *ctx)
{
- struct genbind_node *ret;
+ struct genbind_node *ret;
- if ((node == NULL) || (node == prev)) {
- return NULL;
- }
+ if ((node == NULL) || (node == prev)) {
+ return NULL;
+ }
- if (node->l != prev) {
- ret = genbind_node_find(node->l, prev, cb, ctx);
- if (ret != NULL) {
- return ret;
- }
- }
+ if (node->l != prev) {
+ ret = genbind_node_find(node->l, prev, cb, ctx);
+ if (ret != NULL) {
+ return ret;
+ }
+ }
- if (cb(node, ctx) != 0) {
- return node;
- }
+ if (cb(node, ctx) != 0) {
+ return node;
+ }
- return NULL;
+ return NULL;
}
/* exported interface documented in nsgenbind-ast.h */
struct genbind_node *
genbind_node_find_type(struct genbind_node *node,
- struct genbind_node *prev,
- enum genbind_node_type type)
+ struct genbind_node *prev,
+ enum genbind_node_type type)
{
- return genbind_node_find(node,
- prev,
- genbind_cmp_node_type,
- (void *)type);
+ return genbind_node_find(node,
+ prev,
+ genbind_cmp_node_type,
+ (void *)type);
}
/* exported interface documented in nsgenbind-ast.h */
struct genbind_node *
genbind_node_find_type_ident(struct genbind_node *node,
- struct genbind_node *prev,
- enum genbind_node_type type,
- const char *ident)
+ struct genbind_node *prev,
+ enum genbind_node_type type,
+ const char *ident)
{
- struct genbind_node *found_node;
- struct genbind_node *ident_node;
-
- if (ident == NULL) {
- return NULL;
- }
-
- found_node = genbind_node_find_type(node, prev, type);
-
- while (found_node != NULL) {
- /* look for an ident node */
- ident_node = genbind_node_find_type(
- genbind_node_getnode(found_node),
- NULL,
- GENBIND_NODE_TYPE_IDENT);
-
- while (ident_node != NULL) {
- /* check for matching text */
- if (strcmp(ident_node->r.text, ident) == 0) {
- return found_node;
- }
-
- ident_node = genbind_node_find_type(
- genbind_node_getnode(found_node),
- ident_node,
- GENBIND_NODE_TYPE_IDENT);
- }
-
-
- /* look for next matching node */
- found_node = genbind_node_find_type(node, found_node, type);
- }
- return found_node;
+ struct genbind_node *found_node;
+ struct genbind_node *ident_node;
+
+ if (ident == NULL) {
+ return NULL;
+ }
+
+ found_node = genbind_node_find_type(node, prev, type);
+
+ while (found_node != NULL) {
+ /* look for an ident node */
+ ident_node = genbind_node_find_type(
+ genbind_node_getnode(found_node),
+ NULL,
+ GENBIND_NODE_TYPE_IDENT);
+
+ while (ident_node != NULL) {
+ /* check for matching text */
+ if (strcmp(ident_node->r.text, ident) == 0) {
+ return found_node;
+ }
+
+ ident_node = genbind_node_find_type(
+ genbind_node_getnode(found_node),
+ ident_node,
+ GENBIND_NODE_TYPE_IDENT);
+ }
+
+
+ /* look for next matching node */
+ found_node = genbind_node_find_type(node, found_node, type);
+ }
+ return found_node;
}
/* exported interface documented in nsgenbind-ast.h */
struct genbind_node *
genbind_node_find_type_type(struct genbind_node *node,
- struct genbind_node *prev,
- enum genbind_node_type type,
- const char *ident)
+ struct genbind_node *prev,
+ enum genbind_node_type type,
+ const char *ident)
{
- struct genbind_node *found_node;
- struct genbind_node *ident_node;
-
- found_node = genbind_node_find_type(node, prev, type);
-
-
- while (found_node != NULL) {
- /* look for a type node */
- ident_node = genbind_node_find_type(genbind_node_getnode(found_node),
- NULL,
- GENBIND_NODE_TYPE_TYPE);
- if (ident_node != NULL) {
- if (strcmp(ident_node->r.text, ident) == 0)
- break;
- }
-
- /* look for next matching node */
- found_node = genbind_node_find_type(node, found_node, type);
- }
- return found_node;
+ struct genbind_node *found_node;
+ struct genbind_node *ident_node;
+
+ found_node = genbind_node_find_type(node, prev, type);
+
+
+ while (found_node != NULL) {
+ /* look for a type node */
+ ident_node = genbind_node_find_type(genbind_node_getnode(found_node),
+ NULL,
+ GENBIND_NODE_TYPE_TYPE);
+ if (ident_node != NULL) {
+ if (strcmp(ident_node->r.text, ident) == 0)
+ break;
+ }
+
+ /* look for next matching node */
+ found_node = genbind_node_find_type(node, found_node, type);
+ }
+ return found_node;
}
int genbind_cmp_node_type(struct genbind_node *node, void *ctx)
{
- if (node->type == (enum genbind_node_type)ctx)
- return 1;
- return 0;
+ if (node->type == (enum genbind_node_type)ctx)
+ return 1;
+ return 0;
}
char *genbind_node_gettext(struct genbind_node *node)
{
- if (node != NULL) {
- switch(node->type) {
- case GENBIND_NODE_TYPE_WEBIDLFILE:
- case GENBIND_NODE_TYPE_STRING:
- case GENBIND_NODE_TYPE_PREAMBLE:
- case GENBIND_NODE_TYPE_PROLOGUE:
- case GENBIND_NODE_TYPE_EPILOGUE:
- case GENBIND_NODE_TYPE_IDENT:
- case GENBIND_NODE_TYPE_TYPE:
- case GENBIND_NODE_TYPE_CBLOCK:
- return node->r.text;
-
- default:
- break;
- }
- }
- return NULL;
+ if (node != NULL) {
+ switch(node->type) {
+ case GENBIND_NODE_TYPE_WEBIDL:
+ case GENBIND_NODE_TYPE_STRING:
+ case GENBIND_NODE_TYPE_PREFACE:
+ case GENBIND_NODE_TYPE_PROLOGUE:
+ case GENBIND_NODE_TYPE_EPILOGUE:
+ case GENBIND_NODE_TYPE_POSTFACE:
+ case GENBIND_NODE_TYPE_IDENT:
+ case GENBIND_NODE_TYPE_TYPE:
+ case GENBIND_NODE_TYPE_CDATA:
+ return node->r.text;
+
+ default:
+ break;
+ }
+ }
+ return NULL;
}
struct genbind_node *genbind_node_getnode(struct genbind_node *node)
{
- if (node != NULL) {
- switch(node->type) {
- case GENBIND_NODE_TYPE_HDRCOMMENT:
- case GENBIND_NODE_TYPE_BINDING:
- case GENBIND_NODE_TYPE_BINDING_PRIVATE:
- case GENBIND_NODE_TYPE_BINDING_INTERNAL:
- case GENBIND_NODE_TYPE_BINDING_PROPERTY:
- case GENBIND_NODE_TYPE_BINDING_INTERFACE:
- case GENBIND_NODE_TYPE_BINDING_INTERFACE_FLAGS:
- case GENBIND_NODE_TYPE_OPERATION:
- case GENBIND_NODE_TYPE_API:
- case GENBIND_NODE_TYPE_GETTER:
- case GENBIND_NODE_TYPE_SETTER:
- return node->r.node;
-
- default:
- break;
- }
- }
- return NULL;
+ if (node != NULL) {
+ switch(node->type) {
+ case GENBIND_NODE_TYPE_BINDING:
+ case GENBIND_NODE_TYPE_CLASS:
+ case GENBIND_NODE_TYPE_PRIVATE:
+ case GENBIND_NODE_TYPE_INTERNAL:
+ case GENBIND_NODE_TYPE_PROPERTY:
+ case GENBIND_NODE_TYPE_FLAGS:
+ case GENBIND_NODE_TYPE_METHOD:
+ case GENBIND_NODE_TYPE_PARAMETER:
+ return node->r.node;
+
+ default:
+ break;
+ }
+ }
+ return NULL;
}
int *genbind_node_getint(struct genbind_node *node)
{
- if (node != NULL) {
- switch(node->type) {
- case GENBIND_NODE_TYPE_MODIFIER:
- return &node->r.number;
-
- default:
- break;
- }
- }
- return NULL;
+ if (node != NULL) {
+ switch(node->type) {
+ case GENBIND_NODE_TYPE_METHOD_TYPE:
+ case GENBIND_NODE_TYPE_MODIFIER:
+ return &node->r.number;
+
+ default:
+ break;
+ }
+ }
+ return NULL;
}
static const char *genbind_node_type_to_str(enum genbind_node_type type)
{
- switch(type) {
- case GENBIND_NODE_TYPE_IDENT:
- return "Ident";
+ switch(type) {
+ case GENBIND_NODE_TYPE_IDENT:
+ return "Ident";
- case GENBIND_NODE_TYPE_ROOT:
- return "Root";
+ case GENBIND_NODE_TYPE_ROOT:
+ return "Root";
- case GENBIND_NODE_TYPE_WEBIDLFILE:
- return "webidlfile";
+ case GENBIND_NODE_TYPE_WEBIDL:
+ return "webidl";
- case GENBIND_NODE_TYPE_HDRCOMMENT:
- return "HdrComment";
+ case GENBIND_NODE_TYPE_STRING:
+ return "String";
- case GENBIND_NODE_TYPE_STRING:
- return "String";
+ case GENBIND_NODE_TYPE_PREFACE:
+ return "Preface";
- case GENBIND_NODE_TYPE_PREAMBLE:
- return "Preamble";
+ case GENBIND_NODE_TYPE_POSTFACE:
+ return "Postface";
- case GENBIND_NODE_TYPE_BINDING:
- return "Binding";
+ case GENBIND_NODE_TYPE_PROLOGUE:
+ return "Prologue";
- case GENBIND_NODE_TYPE_TYPE:
- return "Type";
+ case GENBIND_NODE_TYPE_EPILOGUE:
+ return "Epilogue";
- case GENBIND_NODE_TYPE_BINDING_PRIVATE:
- return "Private";
+ case GENBIND_NODE_TYPE_BINDING:
+ return "Binding";
- case GENBIND_NODE_TYPE_BINDING_INTERNAL:
- return "Internal";
+ case GENBIND_NODE_TYPE_TYPE:
+ return "Type";
- case GENBIND_NODE_TYPE_BINDING_INTERFACE:
- return "Interface";
+ case GENBIND_NODE_TYPE_PRIVATE:
+ return "Private";
- case GENBIND_NODE_TYPE_BINDING_INTERFACE_FLAGS:
- return "Flags";
+ case GENBIND_NODE_TYPE_INTERNAL:
+ return "Internal";
- case GENBIND_NODE_TYPE_BINDING_PROPERTY:
- return "Property";
+ case GENBIND_NODE_TYPE_CLASS:
+ return "Class";
- case GENBIND_NODE_TYPE_OPERATION:
- return "Operation";
+ case GENBIND_NODE_TYPE_FLAGS:
+ return "Flags";
- case GENBIND_NODE_TYPE_API:
- return "API";
+ case GENBIND_NODE_TYPE_PROPERTY:
+ return "Property";
- case GENBIND_NODE_TYPE_GETTER:
- return "Getter";
+ case GENBIND_NODE_TYPE_METHOD:
+ return "Method";
- case GENBIND_NODE_TYPE_SETTER:
- return "Setter";
+ case GENBIND_NODE_TYPE_METHOD_TYPE:
+ return "Type";
- case GENBIND_NODE_TYPE_CBLOCK:
- return "CBlock";
+ case GENBIND_NODE_TYPE_PARAMETER:
+ return "Parameter";
- default:
- return "Unknown";
- }
+ case GENBIND_NODE_TYPE_CDATA:
+ return "CBlock";
+
+ default:
+ return "Unknown";
+ }
}
-int genbind_ast_dump(struct genbind_node *node, int indent)
+/** dump ast node to file at indent level */
+static int genbind_ast_dump(FILE *dfile, struct genbind_node *node, int indent)
{
- const char *SPACES=" ";
- char *txt;
-
- while (node != NULL) {
- printf("%.*s%s", indent, SPACES, genbind_node_type_to_str(node->type));
-
- txt = genbind_node_gettext(node);
- if (txt == NULL) {
- printf("\n");
- genbind_ast_dump(genbind_node_getnode(node), indent + 2);
- } else {
- printf(": \"%.*s\"\n", 75 - indent, txt);
- }
- node = node->l;
- }
- return 0;
+ const char *SPACES=" ";
+ char *txt;
+ int *val;
+
+ while (node != NULL) {
+ fprintf(dfile, "%.*s%s", indent, SPACES,
+ genbind_node_type_to_str(node->type));
+
+ txt = genbind_node_gettext(node);
+ if (txt == NULL) {
+ val = genbind_node_getint(node);
+ if (val == NULL) {
+ fprintf(dfile, "\n");
+ genbind_ast_dump(dfile,
+ genbind_node_getnode(node),
+ indent + 2);
+ } else {
+ fprintf(dfile, ": %d\n", *val);
+ }
+ } else {
+ fprintf(dfile, ": \"%.*s\"\n", 75 - indent, txt);
+ }
+ node = node->l;
+ }
+ return 0;
}
-FILE *genbindopen(const char *filename)
+
+/* exported interface documented in nsgenbind-ast.h */
+int genbind_dump_ast(struct genbind_node *node)
{
- FILE *genfile;
- char *fullname;
- int fulllen;
- static char *prevfilepath = NULL;
-
- /* try filename raw */
- genfile = fopen(filename, "r");
- if (genfile != NULL) {
- if (options->verbose) {
- printf("Opened Genbind file %s\n", filename);
- }
- if (prevfilepath == NULL) {
- fullname = strrchr(filename, '/');
- if (fullname == NULL) {
- fulllen = strlen(filename);
- } else {
- fulllen = fullname - filename;
- }
- prevfilepath = strndup(filename,fulllen);
- }
- if (options->depfilehandle != NULL) {
- fprintf(options->depfilehandle, " \\\n\t%s",
- filename);
- }
- return genfile;
- }
-
- /* try based on previous filename */
- if (prevfilepath != NULL) {
- fulllen = strlen(prevfilepath) + strlen(filename) + 2;
- fullname = malloc(fulllen);
- snprintf(fullname, fulllen, "%s/%s", prevfilepath, filename);
- if (options->debug) {
- printf("Attempting to open Genbind file %s\n", fullname);
- }
- genfile = fopen(fullname, "r");
- if (genfile != NULL) {
- if (options->verbose) {
- printf("Opened Genbind file %s\n", fullname);
- }
- if (options->depfilehandle != NULL) {
- fprintf(options->depfilehandle, " \\\n\t%s",
- fullname);
- }
- free(fullname);
- return genfile;
- }
- free(fullname);
- }
-
- /* try on idl path */
- if (options->idlpath != NULL) {
- fulllen = strlen(options->idlpath) + strlen(filename) + 2;
- fullname = malloc(fulllen);
- snprintf(fullname, fulllen, "%s/%s", options->idlpath, filename);
- genfile = fopen(fullname, "r");
- if ((genfile != NULL) && options->verbose) {
- printf("Opend Genbind file %s\n", fullname);
- if (options->depfilehandle != NULL) {
- fprintf(options->depfilehandle, " \\\n\t%s",
- fullname);
- }
- }
-
- free(fullname);
- }
-
- return genfile;
+ FILE *dumpf;
+
+ /* only dump AST to file if required */
+ if (!options->debug) {
+ return 0;
+ }
+
+ dumpf = genb_fopen("binding-ast", "w");
+ if (dumpf == NULL) {
+ return 2;
+ }
+
+ genbind_ast_dump(dumpf, node, 0);
+
+ fclose(dumpf);
+
+ return 0;
}
-int genbind_parsefile(char *infilename, struct genbind_node **ast)
+FILE *genbindopen(const char *filename)
{
- FILE *infile;
-
- /* open input file */
- if ((infilename[0] == '-') &&
- (infilename[1] == 0)) {
- if (options->verbose) {
- printf("Using stdin for input\n");
- }
- infile = stdin;
- } else {
- infile = genbindopen(infilename);
- }
-
- if (!infile) {
- fprintf(stderr, "Error opening %s: %s\n",
- infilename,
- strerror(errno));
- return 3;
- }
-
- if (options->debug) {
- nsgenbind_debug = 1;
- nsgenbind__flex_debug = 1;
- }
-
- /* set flex to read from file */
- nsgenbind_restart(infile);
-
- /* process binding */
- return nsgenbind_parse(ast);
+ FILE *genfile;
+ char *fullname;
+ int fulllen;
+ static char *prevfilepath = NULL;
+
+ /* try filename raw */
+ genfile = fopen(filename, "r");
+ if (genfile != NULL) {
+ if (options->verbose) {
+ printf("Opened Genbind file %s\n", filename);
+ }
+ if (prevfilepath == NULL) {
+ fullname = strrchr(filename, '/');
+ if (fullname == NULL) {
+ fulllen = strlen(filename);
+ } else {
+ fulllen = fullname - filename;
+ }
+ prevfilepath = strndup(filename,fulllen);
+ }
+#if 0
+ if (options->depfilehandle != NULL) {
+ fprintf(options->depfilehandle, " \\\n\t%s",
+ filename);
+ }
+#endif
+ return genfile;
+ }
+
+ /* try based on previous filename */
+ if (prevfilepath != NULL) {
+ fulllen = strlen(prevfilepath) + strlen(filename) + 2;
+ fullname = malloc(fulllen);
+ snprintf(fullname, fulllen, "%s/%s", prevfilepath, filename);
+ if (options->debug) {
+ printf("Attempting to open Genbind file %s\n", fullname);
+ }
+ genfile = fopen(fullname, "r");
+ if (genfile != NULL) {
+ if (options->verbose) {
+ printf("Opened Genbind file %s\n", fullname);
+ }
+#if 0
+ if (options->depfilehandle != NULL) {
+ fprintf(options->depfilehandle, " \\\n\t%s",
+ fullname);
+ }
+#endif
+ free(fullname);
+ return genfile;
+ }
+ free(fullname);
+ }
+
+ /* try on idl path */
+ if (options->idlpath != NULL) {
+ fulllen = strlen(options->idlpath) + strlen(filename) + 2;
+ fullname = malloc(fulllen);
+ snprintf(fullname, fulllen, "%s/%s", options->idlpath, filename);
+ genfile = fopen(fullname, "r");
+ if ((genfile != NULL) && options->verbose) {
+ printf("Opend Genbind file %s\n", fullname);
+#if 0
+ if (options->depfilehandle != NULL) {
+ fprintf(options->depfilehandle, " \\\n\t%s",
+ fullname);
+ }
+#endif
+ }
+
+ free(fullname);
+ }
+ return genfile;
}
-#ifdef NEED_STRNDUP
+/**
+ * standard IO handle for parse trace logging.
+ */
+static FILE *genbind_parsetracef;
-char *strndup(const char *s, size_t n)
+int genbind_parsefile(char *infilename, struct genbind_node **ast)
{
- size_t len;
- char *s2;
-
- for (len = 0; len != n && s[len]; len++)
- continue;
+ FILE *infile;
+ int ret;
+
+ /* open input file */
+ infile = genbindopen(infilename);
+ if (!infile) {
+ fprintf(stderr, "Error opening %s: %s\n",
+ infilename,
+ strerror(errno));
+ return 3;
+ }
+
+ /* if debugging enabled enable parser tracing and send to file */
+ if (options->debug) {
+ nsgenbind_debug = 1;
+ nsgenbind__flex_debug = 1;
+ genbind_parsetracef = genb_fopen("binding-trace", "w");
+ } else {
+ genbind_parsetracef = NULL;
+ }
+
+ /* set flex to read from file */
+ nsgenbind_restart(infile);
+
+ /* process binding */
+ ret = nsgenbind_parse(ast);
+
+ /* close tracefile if open */
+ if (genbind_parsetracef != NULL) {
+ fclose(genbind_parsetracef);
+ }
+
+ return ret;
+}
- s2 = malloc(len + 1);
- if (!s2)
- return 0;
+int genbind_fprintf(FILE *stream, const char *format, ...)
+{
+ va_list ap;
+ int ret;
- memcpy(s2, s, len);
- s2[len] = 0;
- return s2;
-}
+ va_start(ap, format);
-#endif
+ if (genbind_parsetracef == NULL) {
+ ret = vfprintf(stream, format, ap);
+ } else {
+ ret = vfprintf(genbind_parsetracef, format, ap);
+ }
+ va_end(ap);
+ return ret;
+}
diff --git a/src/nsgenbind-ast.h b/src/nsgenbind-ast.h
index 4911f5a..f6800fb 100644
--- a/src/nsgenbind-ast.h
+++ b/src/nsgenbind-ast.h
@@ -10,36 +10,46 @@
#define nsgenbind_nsgenbind_ast_h
enum genbind_node_type {
- GENBIND_NODE_TYPE_ROOT = 0,
- GENBIND_NODE_TYPE_IDENT, /**< generic identifier string */
- GENBIND_NODE_TYPE_TYPE, /**< generic type string */
- GENBIND_NODE_TYPE_MODIFIER, /**< node modifier */
-
- GENBIND_NODE_TYPE_CBLOCK,
- GENBIND_NODE_TYPE_WEBIDLFILE,
- GENBIND_NODE_TYPE_HDRCOMMENT,
- GENBIND_NODE_TYPE_STRING,
- GENBIND_NODE_TYPE_PREAMBLE,
- GENBIND_NODE_TYPE_PROLOGUE,
- GENBIND_NODE_TYPE_EPILOGUE,
- GENBIND_NODE_TYPE_BINDING,
- GENBIND_NODE_TYPE_BINDING_PRIVATE,
- GENBIND_NODE_TYPE_BINDING_INTERNAL,
- GENBIND_NODE_TYPE_BINDING_INTERFACE,
- GENBIND_NODE_TYPE_BINDING_INTERFACE_FLAGS,
- GENBIND_NODE_TYPE_BINDING_PROPERTY,
- GENBIND_NODE_TYPE_API,
- GENBIND_NODE_TYPE_OPERATION,
- GENBIND_NODE_TYPE_GETTER,
- GENBIND_NODE_TYPE_SETTER,
+ GENBIND_NODE_TYPE_ROOT = 0,
+ GENBIND_NODE_TYPE_IDENT, /**< generic identifier string */
+ GENBIND_NODE_TYPE_TYPE, /**< generic type string */
+ GENBIND_NODE_TYPE_MODIFIER, /**< node modifier */
+ GENBIND_NODE_TYPE_CDATA, /**< verbatim block of character data */
+ GENBIND_NODE_TYPE_STRING, /**< text string */
+
+ GENBIND_NODE_TYPE_BINDING,
+ GENBIND_NODE_TYPE_WEBIDL,
+ GENBIND_NODE_TYPE_PREFACE,
+ GENBIND_NODE_TYPE_PROLOGUE,
+ GENBIND_NODE_TYPE_EPILOGUE,
+ GENBIND_NODE_TYPE_POSTFACE,
+
+ GENBIND_NODE_TYPE_CLASS, /**< class definition */
+ GENBIND_NODE_TYPE_PRIVATE,
+ GENBIND_NODE_TYPE_INTERNAL,
+ GENBIND_NODE_TYPE_PROPERTY,
+ GENBIND_NODE_TYPE_FLAGS,
+
+ GENBIND_NODE_TYPE_METHOD, /**< binding method */
+ GENBIND_NODE_TYPE_METHOD_TYPE, /**< binding method type */
+ GENBIND_NODE_TYPE_PARAMETER, /**< method parameter */
};
/* modifier flags */
enum genbind_type_modifier {
- GENBIND_TYPE_NONE = 0,
- GENBIND_TYPE_TYPE = 1, /**< identifies a type handler */
- GENBIND_TYPE_UNSHARED = 2, /**< unshared item */
- GENBIND_TYPE_TYPE_UNSHARED = 3, /**< identifies a unshared type handler */
+ GENBIND_TYPE_NONE = 0,
+ GENBIND_TYPE_TYPE = 1, /**< identifies a type handler */
+ GENBIND_TYPE_UNSHARED = 2, /**< unshared item */
+ GENBIND_TYPE_TYPE_UNSHARED = 3, /**< identifies a unshared type handler */
+};
+
+/* binding method types */
+enum genbind_method_type {
+ GENBIND_METHOD_TYPE_INIT = 0,
+ GENBIND_METHOD_TYPE_FINI = 1, /**< */
+ GENBIND_METHOD_TYPE_METHOD = 2, /**< */
+ GENBIND_METHOD_TYPE_GETTER = 3, /**< */
+ GENBIND_METHOD_TYPE_SETTER = 4, /**< */
};
struct genbind_node;
@@ -47,6 +57,8 @@ struct genbind_node;
/** callback for search and iteration routines */
typedef int (genbind_callback_t)(struct genbind_node *node, void *ctx);
+int genbind_fprintf(FILE *stream, const char *format, ...);
+
int genbind_cmp_node_type(struct genbind_node *node, void *ctx);
FILE *genbindopen(const char *filename);
@@ -58,9 +70,19 @@ char *genbind_strapp(char *a, char *b);
struct genbind_node *genbind_new_node(enum genbind_node_type type, struct genbind_node *l, void *r);
struct genbind_node *genbind_node_link(struct genbind_node *tgt, struct genbind_node *src);
-int genbind_ast_dump(struct genbind_node *ast, int indent);
+/**
+ * Dump the binding AST to file
+ *
+ * If the debug flag has been set this causes the binding AST to be written to
+ * a binding-ast output file
+ *
+ * \param node Node of the tree to start dumping from (usually tree root)
+ * \return 0 on sucess or non zero on faliure and error message printed.
+ */
+int genbind_dump_ast(struct genbind_node *node);
-/** Depth first left hand search using user provided comparison
+/**
+ *Depth first left hand search using user provided comparison
*
* @param node The node to start the search from
* @param prev The node at which to stop the search, either NULL to
@@ -71,9 +93,9 @@ int genbind_ast_dump(struct genbind_node *ast, int indent);
*/
struct genbind_node *
genbind_node_find(struct genbind_node *node,
- struct genbind_node *prev,
- genbind_callback_t *cb,
- void *ctx);
+ struct genbind_node *prev,
+ genbind_callback_t *cb,
+ void *ctx);
/** Depth first left hand search returning nodes of the specified type
*
@@ -86,8 +108,8 @@ genbind_node_find(struct genbind_node *node,
*/
struct genbind_node *
genbind_node_find_type(struct genbind_node *node,
- struct genbind_node *prev,
- enum genbind_node_type nodetype);
+ struct genbind_node *prev,
+ enum genbind_node_type nodetype);
/** count how many nodes of a specified type.
*
@@ -101,7 +123,7 @@ genbind_node_find_type(struct genbind_node *node,
*/
int
genbind_node_enumerate_type(struct genbind_node *node,
- enum genbind_node_type type);
+ enum genbind_node_type type);
/** Depth first left hand search returning nodes of the specified type
* and a ident child node with matching text
@@ -115,9 +137,9 @@ genbind_node_enumerate_type(struct genbind_node *node,
*/
struct genbind_node *
genbind_node_find_type_ident(struct genbind_node *node,
- struct genbind_node *prev,
- enum genbind_node_type nodetype,
- const char *ident);
+ struct genbind_node *prev,
+ enum genbind_node_type nodetype,
+ const char *ident);
/** Returning node of the specified type with a GENBIND_NODE_TYPE_TYPE
* subnode with matching text.
@@ -137,9 +159,9 @@ genbind_node_find_type_ident(struct genbind_node *node,
*/
struct genbind_node *
genbind_node_find_type_type(struct genbind_node *node,
- struct genbind_node *prev,
- enum genbind_node_type nodetype,
- const char *type_text);
+ struct genbind_node *prev,
+ enum genbind_node_type nodetype,
+ const char *type_text);
/** Iterate all nodes of a certian type from a node with a callback.
*
@@ -149,9 +171,9 @@ genbind_node_find_type_type(struct genbind_node *node,
* @param node The node to start the search from.
*/
int genbind_node_foreach_type(struct genbind_node *node,
- enum genbind_node_type type,
- genbind_callback_t *cb,
- void *ctx);
+ enum genbind_node_type type,
+ genbind_callback_t *cb,
+ void *ctx);
/** get a nodes node list content
*
@@ -176,9 +198,4 @@ char *genbind_node_gettext(struct genbind_node *node);
*/
int *genbind_node_getint(struct genbind_node *node);
-#ifdef _WIN32
-#define NEED_STRNDUP 1
-char *strndup(const char *s, size_t n);
-#endif
-
#endif
diff --git a/src/nsgenbind-lexer.l b/src/nsgenbind-lexer.l
index 4b5e225..f7b6528 100644
--- a/src/nsgenbind-lexer.l
+++ b/src/nsgenbind-lexer.l
@@ -72,7 +72,9 @@ cblockopen \%\{
cblockclose \%\}
/* used for #include directive */
-poundsign ^{whitespace}*#
+poundsign ^{whitespace}*#
+
+dblcolon \:\:
%x cblock
@@ -88,44 +90,55 @@ poundsign ^{whitespace}*#
yylloc->last_column = 0;
}
- /* terminals */
+ /* binding terminals */
-webidlfile return TOK_IDLFILE;
+binding return TOK_BINDING;
-hdrcomment return TOK_HDR_COMMENT;
+webidl return TOK_WEBIDL;
-preamble return TOK_PREAMBLE;
+preface return TOK_PREFACE;
prologue return TOK_PROLOGUE;
epilogue return TOK_EPILOGUE;
-binding return TOK_BINDING;
+postface return TOK_POSTFACE;
-interface return TOK_INTERFACE;
-flags return TOK_FLAGS;
+ /* class member terminals */
-type return TOK_TYPE;
+class return TOK_CLASS;
private return TOK_PRIVATE;
internal return TOK_INTERNAL;
+flags return TOK_FLAGS;
+
+type return TOK_TYPE;
+
unshared return TOK_UNSHARED;
shared return TOK_SHARED;
property return TOK_PROPERTY;
-operation return TOK_OPERATION;
+ /* implementation terminals */
+
+init return TOK_INIT;
-api return TOK_API;
+fini return TOK_FINI;
+
+method return TOK_METHOD;
getter return TOK_GETTER;
setter return TOK_SETTER;
+ /* other terminals */
+
+{dblcolon} return TOK_DBLCOLON;
+
{cblockopen} BEGIN(cblock);
{identifier} {
@@ -140,7 +153,7 @@ setter return TOK_SETTER;
{multicomment} /* nothing */
-{poundsign}include BEGIN(incl);
+{poundsign}include BEGIN(incl);
{other} return (int) yytext[0];
@@ -151,7 +164,7 @@ setter return TOK_SETTER;
<cblock>\% yylval->text = strdup(yytext); return TOK_CCODE_LITERAL;
-<incl>[ \t]*\" /* eat the whitespace and open quotes */
+<incl>[ \t]*\" /* eat the whitespace and open quotes */
<incl>[^\t\n\"]+ {
/* got the include file name */
diff --git a/src/nsgenbind-parser.y b/src/nsgenbind-parser.y
index b37ab9d..c8e5154 100644
--- a/src/nsgenbind-parser.y
+++ b/src/nsgenbind-parser.y
@@ -10,6 +10,12 @@
#include <stdio.h>
#include <string.h>
+#define YYFPRINTF genbind_fprintf
+#define YY_LOCATION_PRINT(File, Loc) \
+ genbind_fprintf(File, "%d.%d-%d.%d", \
+ (Loc).first_line, (Loc).first_column, \
+ (Loc).last_line, (Loc).last_column)
+
#include "nsgenbind-parser.h"
#include "nsgenbind-lexer.h"
#include "webidl-ast.h"
@@ -17,7 +23,9 @@
char *errtxt;
- static void nsgenbind_error(YYLTYPE *locp, struct genbind_node **genbind_ast, const char *str)
+static void nsgenbind_error(YYLTYPE *locp,
+ struct genbind_node **genbind_ast,
+ const char *str)
{
locp = locp;
genbind_ast = genbind_ast;
@@ -37,31 +45,36 @@ char *errtxt;
%union
{
- char* text;
+ char *text;
struct genbind_node *node;
long value;
}
-%token TOK_IDLFILE
-%token TOK_HDR_COMMENT
-%token TOK_PREAMBLE
-%token TOK_PROLOGUE;
-%token TOK_EPILOGUE;
-
-%token TOK_API
%token TOK_BINDING
-%token TOK_OPERATION
-%token TOK_GETTER
-%token TOK_SETTER
-%token TOK_INTERFACE
-%token TOK_FLAGS
-%token TOK_TYPE
+%token TOK_WEBIDL
+%token TOK_PREFACE
+%token TOK_PROLOGUE
+%token TOK_EPILOGUE
+%token TOK_POSTFACE
+
+%token TOK_CLASS
%token TOK_PRIVATE
%token TOK_INTERNAL
+%token TOK_FLAGS
+%token TOK_TYPE
%token TOK_UNSHARED
%token TOK_SHARED
%token TOK_PROPERTY
+ /* method types */
+%token TOK_INIT
+%token TOK_FINI
+%token TOK_METHOD
+%token TOK_GETTER
+%token TOK_SETTER
+
+%token TOK_DBLCOLON
+
%token <text> TOK_IDENTIFIER
%token <text> TOK_STRING_LITERAL
%token <text> TOK_CCODE_LITERAL
@@ -73,28 +86,30 @@ char *errtxt;
%type <node> Statement
%type <node> Statements
-%type <node> IdlFile
-%type <node> Preamble
-%type <node> Prologue
-%type <node> Epilogue
-%type <node> HdrComment
-%type <node> Strings
%type <node> Binding
%type <node> BindingArgs
%type <node> BindingArg
+%type <node> Class
+%type <node> ClassArgs
+%type <node> ClassArg
+%type <node> ClassFlag
+%type <node> ClassFlags
+
+%type <node> Method
+%type <node> MethodDeclarator
+%type <value> MethodType
+
+%type <node> WebIDL
+%type <node> Preface
+%type <node> Prologue
+%type <node> Epilogue
+%type <node> Postface
%type <node> Private
%type <node> Internal
-%type <node> Interface
-%type <node> InterfaceArgs
-%type <node> InterfaceArg
-%type <node> InterfaceFlags
%type <node> Property
-%type <node> Operation
-%type <node> Api
-%type <node> Getter
-%type <node> Setter
-
+%type <node> ParameterList
+%type <node> TypeIdent
%%
@@ -126,68 +141,77 @@ Statements
Statement
:
- IdlFile
- |
- HdrComment
- |
- Preamble
- |
- Prologue
- |
- Epilogue
- |
Binding
|
- Operation
- |
- Api
+ Class
|
- Getter
- |
- Setter
+ Method
;
- /* [3] load a web IDL file */
-IdlFile
- :
- TOK_IDLFILE TOK_STRING_LITERAL ';'
+Binding
+ :
+ TOK_BINDING TOK_IDENTIFIER '{' BindingArgs '}'
{
- $$ = genbind_new_node(GENBIND_NODE_TYPE_WEBIDLFILE, NULL, $2);
+ $$ = genbind_new_node(GENBIND_NODE_TYPE_BINDING,
+ NULL,
+ genbind_new_node(GENBIND_NODE_TYPE_TYPE, $4, $2));
}
;
-HdrComment
- :
- TOK_HDR_COMMENT Strings ';'
+BindingArgs
+ :
+ BindingArg
+ |
+ BindingArgs BindingArg
{
- $$ = genbind_new_node(GENBIND_NODE_TYPE_HDRCOMMENT, NULL, $2);
+ $$ = genbind_node_link($2, $1);
}
;
-Strings
+BindingArg
:
- TOK_STRING_LITERAL
+ WebIDL
+ |
+ Preface
+ |
+ Prologue
+ |
+ Epilogue
+ |
+ Postface
+ ;
+
+ /* [3] a web IDL file specifier */
+WebIDL
+ :
+ TOK_WEBIDL TOK_STRING_LITERAL ';'
{
- $$ = genbind_new_node(GENBIND_NODE_TYPE_STRING, NULL, $1);
+ $$ = genbind_new_node(GENBIND_NODE_TYPE_WEBIDL, NULL, $2);
}
- |
- Strings TOK_STRING_LITERAL
+ ;
+
+
+ /* type and identifier of a variable */
+TypeIdent
+ :
+ TOK_STRING_LITERAL TOK_IDENTIFIER
{
- $$ = genbind_new_node(GENBIND_NODE_TYPE_STRING, $1, $2);
+ $$ = genbind_new_node(GENBIND_NODE_TYPE_IDENT,
+ genbind_new_node(GENBIND_NODE_TYPE_TYPE, NULL, $1), $2);
}
;
-Preamble
+Preface
:
- TOK_PREAMBLE CBlock
+ TOK_PREFACE CBlock ';'
{
- $$ = genbind_new_node(GENBIND_NODE_TYPE_PREAMBLE, NULL, $2);
+ $$ = genbind_new_node(GENBIND_NODE_TYPE_PREFACE, NULL, $2);
}
;
Prologue
:
- TOK_PROLOGUE CBlock
+ TOK_PROLOGUE CBlock ';'
{
$$ = genbind_new_node(GENBIND_NODE_TYPE_PROLOGUE, NULL, $2);
}
@@ -195,173 +219,196 @@ Prologue
Epilogue
:
- TOK_EPILOGUE CBlock
+ TOK_EPILOGUE CBlock ';'
{
$$ = genbind_new_node(GENBIND_NODE_TYPE_EPILOGUE, NULL, $2);
}
;
+Postface
+ :
+ TOK_POSTFACE CBlock ';'
+ {
+ $$ = genbind_new_node(GENBIND_NODE_TYPE_POSTFACE, NULL, $2);
+ }
+ ;
+
CBlock
- :
+ :
TOK_CCODE_LITERAL
- |
- CBlock TOK_CCODE_LITERAL
+ |
+ CBlock TOK_CCODE_LITERAL
{
$$ = genbind_strapp($1, $2);
}
;
-Operation
+MethodType
:
- TOK_OPERATION TOK_IDENTIFIER CBlock
+ TOK_INIT
{
- $$ = genbind_new_node(GENBIND_NODE_TYPE_OPERATION,
- NULL,
- genbind_new_node(GENBIND_NODE_TYPE_IDENT,
- genbind_new_node(GENBIND_NODE_TYPE_CBLOCK,
- NULL,
- $3),
- $2));
+ $$ = GENBIND_METHOD_TYPE_INIT;
}
+ |
+ TOK_FINI
+ {
+ $$ = GENBIND_METHOD_TYPE_FINI;
+ }
+ |
+ TOK_METHOD
+ {
+ $$ = GENBIND_METHOD_TYPE_METHOD;
+ }
+ |
+ TOK_GETTER
+ {
+ $$ = GENBIND_METHOD_TYPE_GETTER;
+ }
+ |
+ TOK_SETTER
+ {
+ $$ = GENBIND_METHOD_TYPE_SETTER;
+ }
+ ;
-Api
+ParameterList
:
- TOK_API TOK_IDENTIFIER CBlock
+ TypeIdent
+ {
+ $$ = genbind_new_node(GENBIND_NODE_TYPE_PARAMETER, NULL, $1);
+ }
+ |
+ ParameterList ',' TypeIdent
{
- $$ = genbind_new_node(GENBIND_NODE_TYPE_API,
- NULL,
- genbind_new_node(GENBIND_NODE_TYPE_IDENT,
- genbind_new_node(GENBIND_NODE_TYPE_CBLOCK,
- NULL,
- $3),
- $2));
+ $$ = genbind_node_link($3, $1);
}
+ ;
-Getter
+MethodDeclarator
:
- TOK_GETTER TOK_IDENTIFIER CBlock
+ TOK_IDENTIFIER TOK_DBLCOLON TOK_IDENTIFIER '(' ParameterList ')'
{
- $$ = genbind_new_node(GENBIND_NODE_TYPE_GETTER,
- NULL,
- genbind_new_node(GENBIND_NODE_TYPE_IDENT,
- genbind_new_node(GENBIND_NODE_TYPE_CBLOCK,
- NULL,
- $3),
- $2));
+ $$ = genbind_new_node(GENBIND_NODE_TYPE_CLASS,
+ genbind_new_node(GENBIND_NODE_TYPE_IDENT,
+ $5,
+ $3),
+ genbind_new_node(GENBIND_NODE_TYPE_IDENT,
+ NULL,
+ $1));
}
+ |
+ TOK_IDENTIFIER TOK_DBLCOLON TOK_IDENTIFIER '(' ')'
+ {
+ $$ = genbind_new_node(GENBIND_NODE_TYPE_CLASS,
+ genbind_new_node(GENBIND_NODE_TYPE_IDENT,
+ NULL,
+ $3),
+ genbind_new_node(GENBIND_NODE_TYPE_IDENT,
+ NULL,
+ $1));
+ }
+ |
+ TOK_IDENTIFIER '(' ParameterList ')'
+ {
+ $$ = genbind_new_node(GENBIND_NODE_TYPE_CLASS,
+ $3,
+ genbind_new_node(GENBIND_NODE_TYPE_IDENT,
+ NULL,
+ $1));
+ }
+ |
+ TOK_IDENTIFIER '(' ')'
+ {
+ $$ = genbind_new_node(GENBIND_NODE_TYPE_CLASS, NULL,
+ genbind_new_node(GENBIND_NODE_TYPE_IDENT,
+ NULL,
+ $1));
+ }
+ ;
-Setter
+Method
:
- TOK_SETTER TOK_IDENTIFIER CBlock
+ MethodType MethodDeclarator CBlock
{
- $$ = genbind_new_node(GENBIND_NODE_TYPE_SETTER,
- NULL,
- genbind_new_node(GENBIND_NODE_TYPE_IDENT,
- genbind_new_node(GENBIND_NODE_TYPE_CBLOCK,
- NULL,
- $3),
- $2));
+ $$ = genbind_new_node(GENBIND_NODE_TYPE_METHOD, NULL,
+ genbind_new_node(GENBIND_NODE_TYPE_METHOD_TYPE,
+ genbind_new_node(GENBIND_NODE_TYPE_CDATA,
+ $2, $3),
+ (void *)$1));
}
-Binding
+
+Class
:
- TOK_BINDING TOK_IDENTIFIER '{' BindingArgs '}'
+ TOK_CLASS TOK_IDENTIFIER '{' ClassArgs '}'
{
- $$ = genbind_new_node(GENBIND_NODE_TYPE_BINDING,
- NULL,
- genbind_new_node(GENBIND_NODE_TYPE_TYPE, $4, $2));
+ $$ = genbind_new_node(GENBIND_NODE_TYPE_CLASS, NULL,
+ genbind_new_node(GENBIND_NODE_TYPE_IDENT, $4, $2));
}
;
-BindingArgs
+ClassArgs
:
- BindingArg
+ ClassArg
|
- BindingArgs BindingArg
+ ClassArgs ClassArg
{
- $$ = genbind_node_link($2, $1);
+ $$ = genbind_node_link($2, $1);
}
;
-BindingArg
- :
+ClassArg
+ :
Private
|
Internal
|
- Interface
- |
Property
+ |
+ ClassFlag
+ |
+ Preface
+ |
+ Prologue
+ |
+ Epilogue
+ |
+ Postface
;
+
Private
:
- TOK_PRIVATE TOK_STRING_LITERAL TOK_IDENTIFIER ';'
+ TOK_PRIVATE TypeIdent ';'
{
- $$ = genbind_new_node(GENBIND_NODE_TYPE_BINDING_PRIVATE, NULL,
- genbind_new_node(GENBIND_NODE_TYPE_IDENT,
- genbind_new_node(GENBIND_NODE_TYPE_STRING, NULL, $2), $3));
+ $$ = genbind_new_node(GENBIND_NODE_TYPE_PRIVATE, NULL, $2);
}
;
Internal
:
- TOK_INTERNAL TOK_STRING_LITERAL TOK_IDENTIFIER ';'
+ TOK_INTERNAL TypeIdent ';'
{
- $$ = genbind_new_node(GENBIND_NODE_TYPE_BINDING_INTERNAL, NULL,
- genbind_new_node(GENBIND_NODE_TYPE_IDENT,
- genbind_new_node(GENBIND_NODE_TYPE_STRING, NULL, $2), $3));
+ $$ = genbind_new_node(GENBIND_NODE_TYPE_INTERNAL, NULL, $2);
}
;
-Interface
- :
- TOK_INTERFACE TOK_IDENTIFIER ';'
- {
- $$ = genbind_new_node(GENBIND_NODE_TYPE_BINDING_INTERFACE, NULL,
- genbind_new_node(GENBIND_NODE_TYPE_IDENT, NULL, $2));
- }
- |
- TOK_INTERFACE TOK_IDENTIFIER '{' '}'
- {
- $$ = genbind_new_node(GENBIND_NODE_TYPE_BINDING_INTERFACE, NULL,
- genbind_new_node(GENBIND_NODE_TYPE_IDENT, NULL, $2));
- }
- |
- TOK_INTERFACE TOK_IDENTIFIER '{' InterfaceArgs '}'
- {
- $$ = genbind_new_node(GENBIND_NODE_TYPE_BINDING_INTERFACE,
- NULL,
- genbind_new_node(GENBIND_NODE_TYPE_IDENT, $4, $2));
- }
- ;
-
-InterfaceArgs
+ClassFlag
:
- InterfaceArg
- |
- InterfaceArgs InterfaceArg
- {
- $$ = genbind_node_link($2, $1);
- }
- ;
-
-InterfaceArg
- :
- TOK_FLAGS InterfaceFlags ';'
+ TOK_FLAGS ClassFlags ';'
{
- $$ = genbind_new_node(GENBIND_NODE_TYPE_BINDING_INTERFACE_FLAGS, NULL, $2);
+ $$ = genbind_new_node(GENBIND_NODE_TYPE_FLAGS, NULL, $2);
}
;
-InterfaceFlags
+ClassFlags
:
TOK_IDENTIFIER
{
$$ = genbind_new_node(GENBIND_NODE_TYPE_IDENT, NULL, $1);
}
|
- InterfaceFlags ',' TOK_IDENTIFIER
+ ClassFlags ',' TOK_IDENTIFIER
{
$$ = genbind_new_node(GENBIND_NODE_TYPE_IDENT, $1, $3);
}
@@ -371,13 +418,12 @@ Property
:
TOK_PROPERTY Modifiers TOK_IDENTIFIER ';'
{
- $$ = genbind_new_node(GENBIND_NODE_TYPE_BINDING_PROPERTY,
- NULL,
- genbind_new_node(GENBIND_NODE_TYPE_MODIFIER,
- genbind_new_node(GENBIND_NODE_TYPE_IDENT,
- NULL,
- $3),
- (void *)$2));
+ $$ = genbind_new_node(GENBIND_NODE_TYPE_PROPERTY, NULL,
+ genbind_new_node(GENBIND_NODE_TYPE_MODIFIER,
+ genbind_new_node(GENBIND_NODE_TYPE_IDENT,
+ NULL,
+ $3),
+ (void *)$2));
}
;
diff --git a/src/nsgenbind.c b/src/nsgenbind.c
index d81f30f..3174fa0 100644
--- a/src/nsgenbind.c
+++ b/src/nsgenbind.c
@@ -22,201 +22,173 @@ struct options *options;
static struct options* process_cmdline(int argc, char **argv)
{
- int opt;
+ int opt;
- options = calloc(1,sizeof(struct options));
- if (options == NULL) {
- fprintf(stderr, "Allocation error\n");
- return NULL;
- }
+ options = calloc(1,sizeof(struct options));
+ if (options == NULL) {
+ fprintf(stderr, "Allocation error\n");
+ return NULL;
+ }
- while ((opt = getopt(argc, argv, "vgDW::d:I:o:h:")) != -1) {
- switch (opt) {
- case 'I':
- options->idlpath = strdup(optarg);
- break;
+ while ((opt = getopt(argc, argv, "vgDW::I:")) != -1) {
+ switch (opt) {
+ case 'I':
+ options->idlpath = strdup(optarg);
+ break;
- case 'o':
- options->outfilename = strdup(optarg);
- break;
+ case 'v':
+ options->verbose = true;
+ break;
- case 'h':
- options->hdrfilename = strdup(optarg);
- break;
+ case 'D':
+ options->debug = true;
+ break;
- case 'd':
- options->depfilename = strdup(optarg);
- break;
+ case 'g':
+ options->dbglog = true;
+ break;
- case 'v':
- options->verbose = true;
- break;
+ case 'W':
+ options->warnings = 1; /* warning flags */
+ break;
- case 'D':
- options->debug = true;
- break;
+ default: /* '?' */
+ fprintf(stderr,
+ "Usage: %s [-v] [-g] [-D] [-W] [-I idlpath] inputfile outputdir\n",
+ argv[0]);
+ free(options);
+ return NULL;
- case 'g':
- options->dbglog = true;
- break;
+ }
+ }
- case 'W':
- options->warnings = 1; /* warning flags */
- break;
+ if (optind > (argc - 2)) {
+ fprintf(stderr,
+ "Error: expected input filename and output directory\n");
+ free(options);
+ return NULL;
+ }
- default: /* '?' */
- fprintf(stderr,
- "Usage: %s [-v] [-g] [-D] [-W] [-d depfilename] [-I idlpath] [-o filename] [-h headerfile] inputfile\n",
- argv[0]);
- free(options);
- return NULL;
+ options->infilename = strdup(argv[optind]);
- }
- }
+ options->outdirname = strdup(argv[optind + 1]);
- if (optind >= argc) {
- fprintf(stderr, "Error: expected input filename\n");
- free(options);
- return NULL;
- }
-
- options->infilename = strdup(argv[optind]);
-
- return options;
+ return options;
}
static int generate_binding(struct genbind_node *binding_node, void *ctx)
{
- struct genbind_node *genbind_root = ctx;
- char *type;
- int res = 10;
-
- type = genbind_node_gettext(
- genbind_node_find_type(
- genbind_node_getnode(binding_node),
- NULL,
- GENBIND_NODE_TYPE_TYPE));
-
- if (strcmp(type, "jsapi_libdom") == 0) {
- res = jsapi_libdom_output(options, genbind_root, binding_node);
- } else {
- fprintf(stderr, "Error: unsupported binding type \"%s\"\n", type);
- }
-
- return res;
+ struct genbind_node *genbind_root = ctx;
+ char *type;
+ int res = 10;
+
+ type = genbind_node_gettext(
+ genbind_node_find_type(
+ genbind_node_getnode(binding_node),
+ NULL,
+ GENBIND_NODE_TYPE_TYPE));
+
+ if (strcmp(type, "jsapi_libdom") == 0) {
+ res = jsapi_libdom_output(options, genbind_root, binding_node);
+ } else {
+ fprintf(stderr, "Error: unsupported binding type \"%s\"\n", type);
+ }
+
+ return res;
+}
+
+enum bindingtype_e {
+ BINDINGTYPE_UNKNOWN,
+ BINDINGTYPE_JSAPI_LIBDOM,
+ BINDINGTYPE_DUK_LIBDOM,
+};
+
+/**
+ * get the type of binding
+ */
+static enum bindingtype_e genbind_get_type(struct genbind_node *node)
+{
+ struct genbind_node *binding_node;
+ const char *binding_type;
+
+ binding_node = genbind_node_find_type(node,
+ NULL,
+ GENBIND_NODE_TYPE_BINDING);
+ if (binding_node == NULL) {
+ /* binding entry is missing which is invalid */
+ return BINDINGTYPE_UNKNOWN;
+ }
+
+ binding_type = genbind_node_gettext(
+ genbind_node_find_type(
+ genbind_node_getnode(binding_node),
+ NULL,
+ GENBIND_NODE_TYPE_TYPE));
+ if (binding_type == NULL) {
+ fprintf(stderr, "Error: missing binding type\n");
+ return BINDINGTYPE_UNKNOWN;
+ }
+
+ if (strcmp(binding_type, "jsapi_libdom") == 0) {
+ return BINDINGTYPE_JSAPI_LIBDOM;
+ }
+
+ if (strcmp(binding_type, "duk_libdom") == 0) {
+ return BINDINGTYPE_DUK_LIBDOM;
+ }
+
+ fprintf(stderr, "Error: unsupported binding type \"%s\"\n", binding_type);
+
+ return BINDINGTYPE_UNKNOWN;
}
int main(int argc, char **argv)
{
- int res;
- struct genbind_node *genbind_root;
-
- options = process_cmdline(argc, argv);
- if (options == NULL) {
- return 1; /* bad commandline */
- }
-
- if (options->verbose &&
- (options->outfilename == NULL)) {
- fprintf(stderr,
- "Error: output to stdout with verbose logging would fail\n");
- return 2;
- }
-
- if (options->depfilename != NULL &&
- options->outfilename == NULL) {
- fprintf(stderr,
- "Error: output to stdout with dep generation would fail\n");
- return 3;
- }
-
- if (options->depfilename != NULL &&
- options->infilename == NULL) {
- fprintf(stderr,
- "Error: input from stdin with dep generation would fail\n");
- return 3;
- }
-
- /* open dependancy file */
- if (options->depfilename != NULL) {
- options->depfilehandle = fopen(options->depfilename, "w");
- if (options->depfilehandle == NULL) {
- fprintf(stderr,
- "Error: unable to open dep file\n");
- return 4;
- }
- fprintf(options->depfilehandle,
- "%s %s :", options->depfilename,
- options->outfilename);
- }
-
- /* parse input and generate dependancy */
- res = genbind_parsefile(options->infilename, &genbind_root);
- if (res != 0) {
- fprintf(stderr, "Error: parse failed with code %d\n", res);
- return res;
- }
-
- /* dependancy generation complete */
- if (options->depfilehandle != NULL) {
- fputc('\n', options->depfilehandle);
- fclose(options->depfilehandle);
- }
-
-
- /* open output file */
- if (options->outfilename == NULL) {
- options->outfilehandle = stdout;
- } else {
- options->outfilehandle = fopen(options->outfilename, "w");
- }
- if (options->outfilehandle == NULL) {
- fprintf(stderr, "Error opening source output %s: %s\n",
- options->outfilename,
- strerror(errno));
- return 5;
- }
-
- /* open output header file if required */
- if (options->hdrfilename != NULL) {
- options->hdrfilehandle = fopen(options->hdrfilename, "w");
- if (options->hdrfilehandle == NULL) {
- fprintf(stderr, "Error opening header output %s: %s\n",
- options->hdrfilename,
- strerror(errno));
- /* close and unlink output file */
- fclose(options->outfilehandle);
- if (options->outfilename != NULL) {
- unlink(options->outfilename);
- }
- return 6;
- }
- } else {
- options->hdrfilehandle = NULL;
- }
-
- /* dump the AST */
- if (options->verbose) {
- genbind_ast_dump(genbind_root, 0);
- }
-
- /* generate output for each binding */
- res = genbind_node_foreach_type(genbind_root,
- GENBIND_NODE_TYPE_BINDING,
- generate_binding,
- genbind_root);
- if (res != 0) {
- fprintf(stderr, "Error: output failed with code %d\n", res);
- if (options->outfilename != NULL) {
- unlink(options->outfilename);
- }
- if (options->hdrfilename != NULL) {
- unlink(options->hdrfilename);
- }
- return res;
- }
-
-
- return 0;
+ int res;
+ struct genbind_node *genbind_root;
+ enum bindingtype_e bindingtype;
+
+ options = process_cmdline(argc, argv);
+ if (options == NULL) {
+ return 1; /* bad commandline */
+ }
+
+ /* parse input and generate dependancy */
+ res = genbind_parsefile(options->infilename, &genbind_root);
+ if (res != 0) {
+ fprintf(stderr, "Error: parse failed with code %d\n", res);
+ return res;
+ }
+
+ /* dump the AST */
+ genbind_dump_ast(genbind_root);
+
+ /* get bindingtype */
+ bindingtype = genbind_get_type(genbind_root);
+ if (bindingtype == BINDINGTYPE_UNKNOWN) {
+ return 3;
+ }
+
+#if 0
+ genbind_load_idl(genbind_root);
+
+ /* generate output for each binding */
+ res = genbind_node_foreach_type(genbind_root,
+ GENBIND_NODE_TYPE_BINDING,
+ generate_binding,
+ genbind_root);
+ if (res != 0) {
+ fprintf(stderr, "Error: output failed with code %d\n", res);
+ if (options->outfilename != NULL) {
+ unlink(options->outfilename);
+ }
+ if (options->hdrfilename != NULL) {
+ unlink(options->hdrfilename);
+ }
+ return res;
+ }
+
+#endif
+ return 0;
}
diff --git a/src/options.h b/src/options.h
index cbac9a3..68a4bc1 100644
--- a/src/options.h
+++ b/src/options.h
@@ -12,16 +12,11 @@
/** global options */
struct options {
char *infilename; /**< binding source */
-
- char *outfilename; /**< output source file */
- FILE *outfilehandle; /**< output file handle */
-
- char *hdrfilename; /**< output header file */
- FILE *hdrfilehandle; /**< output file handle */
-
- char *depfilename; /**< dependancy output*/
- FILE *depfilehandle; /**< dependancy file handle */
-
+ char *outdirname; /**< output directory */
+FILE *hdrfilehandle;
+char *hdrfilename;
+char *outfilename;
+FILE *outfilehandle;
char *idlpath; /**< path to IDL files */
bool verbose; /**< verbose processing */
diff --git a/src/utils.c b/src/utils.c
new file mode 100644
index 0000000..7bab058
--- /dev/null
+++ b/src/utils.c
@@ -0,0 +1,52 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdbool.h>
+#include <errno.h>
+#include <stdlib.h>
+
+#include "options.h"
+#include "utils.h"
+
+FILE *genb_fopen(const char *fname, const char *mode)
+{
+ char *fpath;
+ int fpathl;
+ FILE *filef;
+
+ fpathl = strlen(options->outdirname) + strlen(fname) + 2;
+ fpath = malloc(fpathl);
+ snprintf(fpath, fpathl, "%s/%s", options->outdirname, fname);
+
+ filef = fopen(fpath, mode);
+ if (filef == NULL) {
+ fprintf(stderr, "Error: unable to open file %s (%s)\n",
+ fpath, strerror(errno));
+ free(fpath);
+ return NULL;
+ }
+ free(fpath);
+
+ return filef;
+}
+
+#ifdef NEED_STRNDUP
+
+char *strndup(const char *s, size_t n)
+{
+ size_t len;
+ char *s2;
+
+ for (len = 0; len != n && s[len]; len++)
+ continue;
+
+ s2 = malloc(len + 1);
+ if (!s2)
+ return 0;
+
+ memcpy(s2, s, len);
+ s2[len] = 0;
+ return s2;
+}
+
+#endif
+
diff --git a/src/utils.h b/src/utils.h
new file mode 100644
index 0000000..98a4c6b
--- /dev/null
+++ b/src/utils.h
@@ -0,0 +1,21 @@
+/* utility helpers
+ *
+ * This file is part of nsnsgenbind.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
+ */
+
+#ifndef nsgenbind_utils_h
+#define nsgenbind_utils_h
+
+FILE *genb_fopen(const char *fname, const char *mode);
+
+#ifdef _WIN32
+#define NEED_STRNDUP 1
+char *strndup(const char *s, size_t n);
+#endif
+
+#define SLEN(x) (sizeof((x)) - 1)
+
+#endif
diff --git a/test/data/bindings/browser-duk.bnd b/test/data/bindings/browser-duk.bnd
new file mode 100644
index 0000000..c32f6a3
--- /dev/null
+++ b/test/data/bindings/browser-duk.bnd
@@ -0,0 +1,66 @@
+/* Binding for browser using ductape and libdom
+ *
+ * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * Released under the terms of the MIT License,
+ * http://www.opensource.org/licenses/mit-license
+ */
+
+binding duk_libdom {
+ webidl "dom.idl";
+ webidl "html.idl";
+ webidl "console.idl";
+
+ preface %{
+ %};
+
+ prologue %{
+ %};
+
+ epilogue %{
+ %};
+
+ postface %{
+ %};
+}
+
+class Node {
+ private "dom_node *" node;
+
+ preface %{
+ %};
+
+ prologue %{
+ %};
+
+ epilogue %{
+ %};
+
+ postface %{
+ %};
+}
+
+init Node("dom_node *" node)
+%{
+ private->node = node;
+ dom_node_ref(node);
+%}
+
+fini Node()
+%{
+ dom_node_unref(private->node);
+%}
+
+method Node::AppendChild()
+%{
+%}
+
+getter Node::aprop()
+%{
+%}
+
+setter Node::aprop()
+%{
+%}
diff --git a/test/data/idl/console.idl b/test/data/idl/console.idl
new file mode 100644
index 0000000..5a3d9eb
--- /dev/null
+++ b/test/data/idl/console.idl
@@ -0,0 +1,24 @@
+// de facto set of features for console object
+// https://developer.mozilla.org/en-US/docs/DOM/console
+// http://msdn.microsoft.com/en-us/library/dd565625%28v=vs.85%29.aspx#consolelogging
+// 31st October
+// Yay for non-standard standards
+
+interface Console {
+ void debug(DOMString msg, Substitition... subst);
+ void dir(JSObject object);
+ void error(DOMString msg, Substitition... subst);
+ void group();
+ void groupCollapsed();
+ void groupEnd();
+ void info(DOMString msg, Substitition... subst);
+ void log(DOMString msg, Substitition... subst);
+ void time(DOMString timerName);
+ void timeEnd(DOMString timerName);
+ void trace();
+ void warn(DOMString msg, Substitition... subst);
+};
+
+partial interface Window {
+ readonly attribute Console console;
+}; \ No newline at end of file
diff --git a/test/data/idl/dom.idl b/test/data/idl/dom.idl
index 6ba870c..6a4a95e 100644
--- a/test/data/idl/dom.idl
+++ b/test/data/idl/dom.idl
@@ -1,43 +1,10 @@
-// DOM core WebIDL
-// retrived from http://dom.spec.whatwg.org/
-// 23rd October 2012
-
-
-
-exception DOMException {
- const unsigned short INDEX_SIZE_ERR = 1;
- const unsigned short DOMSTRING_SIZE_ERR = 2; // historical
- const unsigned short HIERARCHY_REQUEST_ERR = 3;
- const unsigned short WRONG_DOCUMENT_ERR = 4;
- const unsigned short INVALID_CHARACTER_ERR = 5;
- const unsigned short NO_DATA_ALLOWED_ERR = 6; // historical
- const unsigned short NO_MODIFICATION_ALLOWED_ERR = 7;
- const unsigned short NOT_FOUND_ERR = 8;
- const unsigned short NOT_SUPPORTED_ERR = 9;
- const unsigned short INUSE_ATTRIBUTE_ERR = 10; // historical
- const unsigned short INVALID_STATE_ERR = 11;
- const unsigned short SYNTAX_ERR = 12;
- const unsigned short INVALID_MODIFICATION_ERR = 13;
- const unsigned short NAMESPACE_ERR = 14;
- const unsigned short INVALID_ACCESS_ERR = 15;
- const unsigned short VALIDATION_ERR = 16; // historical
- const unsigned short TYPE_MISMATCH_ERR = 17;
- const unsigned short SECURITY_ERR = 18;
- const unsigned short NETWORK_ERR = 19;
- const unsigned short ABORT_ERR = 20;
- const unsigned short URL_MISMATCH_ERR = 21;
- const unsigned short QUOTA_EXCEEDED_ERR = 22;
- const unsigned short TIMEOUT_ERR = 23;
- const unsigned short INVALID_NODE_TYPE_ERR = 24;
- const unsigned short DATA_CLONE_ERR = 25;
- unsigned short code;
-};
-
-interface DOMError {
- readonly attribute DOMString name;
-};
+// DOM web IDL
+// Retrived from https://dom.spec.whatwg.org/
+// Sat Jul 18 2015
+
-[Constructor(DOMString type, optional EventInit eventInitDict)]
+[Constructor(DOMString type, optional EventInit eventInitDict),
+ Exposed=(Window,Worker)]
interface Event {
readonly attribute DOMString type;
readonly attribute EventTarget? target;
@@ -57,26 +24,30 @@ interface Event {
void preventDefault();
readonly attribute boolean defaultPrevented;
- readonly attribute boolean isTrusted;
+ [Unforgeable] readonly attribute boolean isTrusted;
readonly attribute DOMTimeStamp timeStamp;
void initEvent(DOMString type, boolean bubbles, boolean cancelable);
};
dictionary EventInit {
- boolean bubbles;
- boolean cancelable;
+ boolean bubbles = false;
+ boolean cancelable = false;
};
-[Constructor(DOMString type, optional CustomEventInit eventInitDict)]
+[Constructor(DOMString type, optional CustomEventInit eventInitDict),
+ Exposed=(Window,Worker)]
interface CustomEvent : Event {
readonly attribute any detail;
+
+ void initCustomEvent(DOMString type, boolean bubbles, boolean cancelable, any detail);
};
dictionary CustomEventInit : EventInit {
- any detail;
+ any detail = null;
};
+[Exposed=(Window,Worker)]
interface EventTarget {
void addEventListener(DOMString type, EventListener? callback, optional boolean capture = false);
void removeEventListener(DOMString type, EventListener? callback, optional boolean capture = false);
@@ -87,6 +58,74 @@ callback interface EventListener {
void handleEvent(Event event);
};
+[NoInterfaceObject,
+ Exposed=Window]
+interface NonElementParentNode {
+ Element? getElementById(DOMString elementId);
+};
+Document implements NonElementParentNode;
+DocumentFragment implements NonElementParentNode;
+
+[NoInterfaceObject,
+ Exposed=Window]
+interface ParentNode {
+ [SameObject] readonly attribute HTMLCollection children;
+ readonly attribute Element? firstElementChild;
+ readonly attribute Element? lastElementChild;
+ readonly attribute unsigned long childElementCount;
+
+ [Unscopeable] void prepend((Node or DOMString)... nodes);
+ [Unscopeable] void append((Node or DOMString)... nodes);
+
+ [Unscopeable] Element? query(DOMString relativeSelectors);
+ [NewObject, Unscopeable] Elements queryAll(DOMString relativeSelectors);
+ Element? querySelector(DOMString selectors);
+ [NewObject] NodeList querySelectorAll(DOMString selectors);
+};
+Document implements ParentNode;
+DocumentFragment implements ParentNode;
+Element implements ParentNode;
+
+[NoInterfaceObject,
+ Exposed=Window]
+interface NonDocumentTypeChildNode {
+ readonly attribute Element? previousElementSibling;
+ readonly attribute Element? nextElementSibling;
+};
+Element implements NonDocumentTypeChildNode;
+CharacterData implements NonDocumentTypeChildNode;
+
+[NoInterfaceObject,
+ Exposed=Window]
+interface ChildNode {
+ [Unscopeable] void before((Node or DOMString)... nodes);
+ [Unscopeable] void after((Node or DOMString)... nodes);
+ [Unscopeable] void replaceWith((Node or DOMString)... nodes);
+ [Unscopeable] void remove();
+};
+DocumentType implements ChildNode;
+Element implements ChildNode;
+CharacterData implements ChildNode;
+
+class Elements extends Array {
+ Element? query(DOMString relativeSelectors);
+ Elements queryAll(DOMString relativeSelectors);
+};
+
+[Exposed=Window]
+interface NodeList {
+ getter Node? item(unsigned long index);
+ readonly attribute unsigned long length;
+ iterable<Node>;
+};
+
+[Exposed=Window]
+interface HTMLCollection {
+ readonly attribute unsigned long length;
+ getter Element? item(unsigned long index);
+ getter Element? namedItem(DOMString name);
+};
+
[Constructor(MutationCallback callback)]
interface MutationObserver {
void observe(Node target, MutationObserverInit options);
@@ -97,20 +136,21 @@ interface MutationObserver {
callback MutationCallback = void (sequence<MutationRecord> mutations, MutationObserver observer);
dictionary MutationObserverInit {
- boolean childList;
+ boolean childList = false;
boolean attributes;
boolean characterData;
- boolean subtree;
+ boolean subtree = false;
boolean attributeOldValue;
boolean characterDataOldValue;
sequence<DOMString> attributeFilter;
};
+[Exposed=Window]
interface MutationRecord {
readonly attribute DOMString type;
readonly attribute Node target;
- readonly attribute NodeList addedNodes;
- readonly attribute NodeList removedNodes;
+ [SameObject] readonly attribute NodeList addedNodes;
+ [SameObject] readonly attribute NodeList removedNodes;
readonly attribute Node? previousSibling;
readonly attribute Node? nextSibling;
readonly attribute DOMString? attributeName;
@@ -118,6 +158,7 @@ interface MutationRecord {
readonly attribute DOMString? oldValue;
};
+[Exposed=Window]
interface Node : EventTarget {
const unsigned short ELEMENT_NODE = 1;
const unsigned short ATTRIBUTE_NODE = 2; // historical
@@ -140,7 +181,7 @@ interface Node : EventTarget {
readonly attribute Node? parentNode;
readonly attribute Element? parentElement;
boolean hasChildNodes();
- readonly attribute NodeList childNodes;
+ [SameObject] readonly attribute NodeList childNodes;
readonly attribute Node? firstChild;
readonly attribute Node? lastChild;
readonly attribute Node? previousSibling;
@@ -148,37 +189,40 @@ interface Node : EventTarget {
attribute DOMString? nodeValue;
attribute DOMString? textContent;
- Node insertBefore(Node node, Node? child);
- Node appendChild(Node node);
- Node replaceChild(Node node, Node child);
- Node removeChild(Node child);
void normalize();
-
-Node cloneNode(optional boolean deep = true);
- boolean isEqualNode(Node? node);
+ [NewObject] Node cloneNode(optional boolean deep = false);
+ boolean isEqualNode(Node? otherNode);
const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01;
const unsigned short DOCUMENT_POSITION_PRECEDING = 0x02;
const unsigned short DOCUMENT_POSITION_FOLLOWING = 0x04;
const unsigned short DOCUMENT_POSITION_CONTAINS = 0x08;
const unsigned short DOCUMENT_POSITION_CONTAINED_BY = 0x10;
- const unsigned short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20; // historical
+ const unsigned short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20;
unsigned short compareDocumentPosition(Node other);
boolean contains(Node? other);
DOMString? lookupPrefix(DOMString? namespace);
DOMString? lookupNamespaceURI(DOMString? prefix);
boolean isDefaultNamespace(DOMString? namespace);
+
+ Node insertBefore(Node node, Node? child);
+ Node appendChild(Node node);
+ Node replaceChild(Node node, Node child);
+ Node removeChild(Node child);
};
-[Constructor]
+[Constructor,
+ Exposed=Window]
interface Document : Node {
- readonly attribute DOMImplementation implementation;
+ [SameObject] readonly attribute DOMImplementation implementation;
readonly attribute DOMString URL;
readonly attribute DOMString documentURI;
+ readonly attribute DOMString origin;
readonly attribute DOMString compatMode;
readonly attribute DOMString characterSet;
+ readonly attribute DOMString inputEncoding; // legacy alias of .characterSet
readonly attribute DOMString contentType;
readonly attribute DocumentType? doctype;
@@ -186,59 +230,54 @@ interface Document : Node {
HTMLCollection getElementsByTagName(DOMString localName);
HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
HTMLCollection getElementsByClassName(DOMString classNames);
- Element? getElementById(DOMString elementId);
- Element createElement(DOMString localName);
- Element createElementNS(DOMString? namespace, DOMString qualifiedName);
- DocumentFragment createDocumentFragment();
- Text createTextNode(DOMString data);
- Comment createComment(DOMString data);
- ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data);
+ [NewObject] Element createElement(DOMString localName);
+ [NewObject] Element createElementNS(DOMString? namespace, DOMString qualifiedName);
+ [NewObject] DocumentFragment createDocumentFragment();
+ [NewObject] Text createTextNode(DOMString data);
+ [NewObject] Comment createComment(DOMString data);
+ [NewObject] ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data);
- Node importNode(Node node, optional boolean deep = true);
+ [NewObject] Node importNode(Node node, optional boolean deep = false);
Node adoptNode(Node node);
- Event createEvent(DOMString interface);
+ [NewObject] Attr createAttribute(DOMString localName);
+ [NewObject] Attr createAttributeNS(DOMString? namespace, DOMString name);
- Range createRange();
+ [NewObject] Event createEvent(DOMString interface);
- // NodeFilter.SHOW_ALL = 0xFFFFFFFF
- NodeIterator createNodeIterator(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null);
- TreeWalker createTreeWalker(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null);
+ [NewObject] Range createRange();
- // NEW
- void prepend((Node or DOMString)... nodes);
- void append((Node or DOMString)... nodes);
+ // NodeFilter.SHOW_ALL = 0xFFFFFFFF
+ [NewObject] NodeIterator createNodeIterator(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null);
+ [NewObject] TreeWalker createTreeWalker(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null);
};
+[Exposed=Window]
interface XMLDocument : Document {};
+[Exposed=Window]
interface DOMImplementation {
- DocumentType createDocumentType(DOMString qualifiedName, DOMString publicId, DOMString systemId);
- XMLDocument createDocument(DOMString? namespace, [TreatNullAs=EmptyString] DOMString qualifiedName, DocumentType? doctype);
- Document createHTMLDocument(optional DOMString title);
+ [NewObject] DocumentType createDocumentType(DOMString qualifiedName, DOMString publicId, DOMString systemId);
+ [NewObject] XMLDocument createDocument(DOMString? namespace, [TreatNullAs=EmptyString] DOMString qualifiedName, optional DocumentType? doctype = null);
+ [NewObject] Document createHTMLDocument(optional DOMString title);
- boolean hasFeature(DOMString feature, [TreatNullAs=EmptyString] DOMString version);
+ boolean hasFeature(); // useless; always returns true
};
+[Constructor,
+ Exposed=Window]
interface DocumentFragment : Node {
- // NEW
- void prepend((Node or DOMString)... nodes);
- void append((Node or DOMString)... nodes);
};
+[Exposed=Window]
interface DocumentType : Node {
readonly attribute DOMString name;
readonly attribute DOMString publicId;
readonly attribute DOMString systemId;
-
- // NEW
- void before((Node or DOMString)... nodes);
- void after((Node or DOMString)... nodes);
- void replace((Node or DOMString)... nodes);
- void remove();
};
+[Exposed=Window]
interface Element : Node {
readonly attribute DOMString? namespaceURI;
readonly attribute DOMString? prefix;
@@ -247,9 +286,10 @@ interface Element : Node {
attribute DOMString id;
attribute DOMString className;
- readonly attribute DOMTokenList classList;
+ [SameObject] readonly attribute DOMTokenList classList;
- readonly attribute Attr[] attributes;
+ boolean hasAttributes();
+ [SameObject] readonly attribute NamedNodeMap attributes;
DOMString? getAttribute(DOMString name);
DOMString? getAttributeNS(DOMString? namespace, DOMString localName);
void setAttribute(DOMString name, DOMString value);
@@ -259,36 +299,46 @@ interface Element : Node {
boolean hasAttribute(DOMString name);
boolean hasAttributeNS(DOMString? namespace, DOMString localName);
+ Attr? getAttributeNode(DOMString name);
+ Attr? getAttributeNodeNS(DOMString? namespace, DOMString localName);
+ Attr? setAttributeNode(Attr attr);
+ Attr? setAttributeNodeNS(Attr attr);
+ Attr removeAttributeNode(Attr attr);
+
+ Element? closest(DOMString selectors);
+ boolean matches(DOMString selectors);
+
HTMLCollection getElementsByTagName(DOMString localName);
HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
HTMLCollection getElementsByClassName(DOMString classNames);
-
- readonly attribute HTMLCollection children;
- readonly attribute Element? firstElementChild;
- readonly attribute Element? lastElementChild;
- readonly attribute Element? previousElementSibling;
- readonly attribute Element? nextElementSibling;
- readonly attribute unsigned long childElementCount;
-
-
- // NEW
- void prepend((Node or DOMString)... nodes);
- void append((Node or DOMString)... nodes);
- void before((Node or DOMString)... nodes);
- void after((Node or DOMString)... nodes);
- void replace((Node or DOMString)... nodes);
- void remove();
+};
+[Exposed=Window]
+interface NamedNodeMap {
+ readonly attribute unsigned long length;
+ getter Attr? item(unsigned long index);
+ getter Attr? getNamedItem(DOMString name);
+ Attr? getNamedItemNS(DOMString? namespace, DOMString localName);
+ Attr? setNamedItem(Attr attr);
+ Attr? setNamedItemNS(Attr attr);
+ Attr removeNamedItem(DOMString name);
+ Attr removeNamedItemNS(DOMString? namespace, DOMString localName);
};
+[Exposed=Window]
interface Attr {
- readonly attribute DOMString name;
- attribute DOMString value;
-
readonly attribute DOMString? namespaceURI;
readonly attribute DOMString? prefix;
readonly attribute DOMString localName;
-};
+ readonly attribute DOMString name;
+ attribute DOMString value;
+ [TreatNullAs=EmptyString] attribute DOMString nodeValue; // legacy alias of .value
+ [TreatNullAs=EmptyString] attribute DOMString textContent; // legacy alias of .value
+
+ readonly attribute Element? ownerElement;
+ readonly attribute boolean specified; // useless; always returns true
+};
+[Exposed=Window]
interface CharacterData : Node {
[TreatNullAs=EmptyString] attribute DOMString data;
readonly attribute unsigned long length;
@@ -297,26 +347,25 @@ interface CharacterData : Node {
void insertData(unsigned long offset, DOMString data);
void deleteData(unsigned long offset, unsigned long count);
void replaceData(unsigned long offset, unsigned long count, DOMString data);
-
- // NEW
- void before((Node or DOMString)... nodes);
- void after((Node or DOMString)... nodes);
- void replace((Node or DOMString)... nodes);
- void remove();
};
+[Constructor(optional DOMString data = ""),
+ Exposed=Window]
interface Text : CharacterData {
- Text splitText(unsigned long offset);
+ [NewObject] Text splitText(unsigned long offset);
readonly attribute DOMString wholeText;
};
-
+[Exposed=Window]
interface ProcessingInstruction : CharacterData {
readonly attribute DOMString target;
};
-
+[Constructor(optional DOMString data = ""),
+ Exposed=Window]
interface Comment : CharacterData {
};
+[Constructor,
+ Exposed=Window]
interface Range {
readonly attribute Node startContainer;
readonly attribute unsigned long startOffset;
@@ -325,15 +374,15 @@ interface Range {
readonly attribute boolean collapsed;
readonly attribute Node commonAncestorContainer;
- void setStart(Node refNode, unsigned long offset);
- void setEnd(Node refNode, unsigned long offset);
- void setStartBefore(Node refNode);
- void setStartAfter(Node refNode);
- void setEndBefore(Node refNode);
- void setEndAfter(Node refNode);
- void collapse(boolean toStart);
- void selectNode(Node refNode);
- void selectNodeContents(Node refNode);
+ void setStart(Node node, unsigned long offset);
+ void setEnd(Node node, unsigned long offset);
+ void setStartBefore(Node node);
+ void setStartAfter(Node node);
+ void setEndBefore(Node node);
+ void setEndAfter(Node node);
+ void collapse(optional boolean toStart = false);
+ void selectNode(Node node);
+ void selectNodeContents(Node node);
const unsigned short START_TO_START = 0;
const unsigned short START_TO_END = 1;
@@ -342,12 +391,12 @@ interface Range {
short compareBoundaryPoints(unsigned short how, Range sourceRange);
void deleteContents();
- DocumentFragment extractContents();
- DocumentFragment cloneContents();
+ [NewObject] DocumentFragment extractContents();
+ [NewObject] DocumentFragment cloneContents();
void insertNode(Node node);
void surroundContents(Node newParent);
- Range cloneRange();
+ [NewObject] Range cloneRange();
void detach();
boolean isPointInRange(Node node, unsigned long offset);
@@ -358,9 +407,10 @@ interface Range {
stringifier;
};
+[Exposed=Window]
interface NodeIterator {
- readonly attribute Node root;
- readonly attribute Node? referenceNode;
+ [SameObject] readonly attribute Node root;
+ readonly attribute Node referenceNode;
readonly attribute boolean pointerBeforeReferenceNode;
readonly attribute unsigned long whatToShow;
readonly attribute NodeFilter? filter;
@@ -371,11 +421,11 @@ interface NodeIterator {
void detach();
};
+[Exposed=Window]
interface TreeWalker {
- readonly attribute Node root;
+ [SameObject] readonly attribute Node root;
readonly attribute unsigned long whatToShow;
readonly attribute NodeFilter? filter;
-
attribute Node currentNode;
Node? parentNode();
@@ -386,7 +436,7 @@ interface TreeWalker {
Node? previousNode();
Node? nextNode();
};
-
+[Exposed=Window]
callback interface NodeFilter {
// Constants for acceptNode()
const unsigned short FILTER_ACCEPT = 1;
@@ -411,25 +461,6 @@ callback interface NodeFilter {
unsigned short acceptNode(Node node);
};
-[ArrayClass]
-interface NodeList {
- getter Node? item(unsigned long index);
- readonly attribute unsigned long length;
-};
-
-interface HTMLCollection {
- readonly attribute unsigned long length;
- getter Element? item(unsigned long index);
- getter object? namedItem(DOMString name); // only returns Element
-};
-
-[NoInterfaceObject]
-interface DOMStringList {
- readonly attribute unsigned long length;
- getter DOMString? item(unsigned long index);
- boolean contains(DOMString string);
-};
-
interface DOMTokenList {
readonly attribute unsigned long length;
getter DOMString? item(unsigned long index);
@@ -438,9 +469,11 @@ interface DOMTokenList {
void remove(DOMString... tokens);
boolean toggle(DOMString token, optional boolean force);
stringifier;
+ iterable<DOMString>;
};
interface DOMSettableTokenList : DOMTokenList {
attribute DOMString value;
};
+
diff --git a/test/data/idl/html.idl b/test/data/idl/html.idl
index d4264c5..62d4967 100644
--- a/test/data/idl/html.idl
+++ b/test/data/idl/html.idl
@@ -1,37 +1,44 @@
-// HTML WebIDL
-// retrived from http://www.whatwg.org/specs/web-apps/current-work/
-// 23rd October 2012
+// HTML web IDL
+// Retrived from https://html.spec.whatwg.org/
+// Sat Jul 18 2015
+typedef (Int8Array or Uint8Array or Uint8ClampedArray or
+ Int16Array or Uint16Array or
+ Int32Array or Uint32Array or
+ Float32Array or Float64Array or
+ DataView) ArrayBufferView;
+
interface HTMLAllCollection : HTMLCollection {
- // inherits length and item()
- legacycaller getter object? namedItem(DOMString name); // overrides inherited namedItem()
- HTMLAllCollection tags(DOMString tagName);
+ // inherits length and 'getter'
+ Element? item(unsigned long index);
+ (HTMLCollection or Element)? item(DOMString name);
+ legacycaller getter (HTMLCollection or Element)? namedItem(DOMString name); // shadows inherited namedItem()
};
interface HTMLFormControlsCollection : HTMLCollection {
// inherits length and item()
- legacycaller getter object? namedItem(DOMString name); // overrides inherited namedItem()
+ legacycaller getter (RadioNodeList or Element)? namedItem(DOMString name); // shadows inherited namedItem()
};
interface RadioNodeList : NodeList {
- attribute DOMString value;
+ attribute DOMString value;
};
interface HTMLOptionsCollection : HTMLCollection {
// inherits item()
- attribute unsigned long length; // overrides inherited length
- legacycaller getter object? namedItem(DOMString name); // overrides inherited namedItem()
+ attribute unsigned long length; // shadows inherited length
+ legacycaller HTMLOptionElement? (DOMString name);
setter creator void (unsigned long index, HTMLOptionElement? option);
void add((HTMLOptionElement or HTMLOptGroupElement) element, optional (HTMLElement or long)? before = null);
void remove(long index);
- attribute long selectedIndex;
+ attribute long selectedIndex;
};
interface HTMLPropertiesCollection : HTMLCollection {
// inherits length and item()
- getter PropertyNodeList? namedItem(DOMString name); // overrides inherited namedItem()
- readonly attribute DOMString[] names;
+ getter PropertyNodeList? namedItem(DOMString name); // shadows inherited namedItem()
+ [SameObject] readonly attribute DOMString[] names;
};
typedef sequence<any> PropertyValueArray;
@@ -40,52 +47,55 @@ interface PropertyNodeList : NodeList {
PropertyValueArray getValues();
};
+[OverrideBuiltins, Exposed=(Window,Worker)]
interface DOMStringMap {
getter DOMString (DOMString name);
- setter void (DOMString name, DOMString value);
- creator void (DOMString name, DOMString value);
+ setter creator void (DOMString name, DOMString value);
deleter void (DOMString name);
};
interface DOMElementMap {
getter Element (DOMString name);
- setter void (DOMString name, Element value);
- creator void (DOMString name, Element value);
+ setter creator void (DOMString name, Element value);
deleter void (DOMString name);
};
-[NoInterfaceObject]
-interface Transferable { };
+typedef (ArrayBuffer or CanvasProxy or MessagePort) Transferable;
+
+callback FileCallback = void (File file);
+
+enum DocumentReadyState { "loading", "interactive", "complete" };
[OverrideBuiltins]
-partial interface Document {
+partial /*sealed*/ interface Document {
// resource metadata management
- [PutForwards=href] readonly attribute Location? location;
- attribute DOMString domain;
+ [PutForwards=href, Unforgeable] readonly attribute Location? location;
+ attribute DOMString domain;
readonly attribute DOMString referrer;
- attribute DOMString cookie;
+ attribute DOMString cookie;
readonly attribute DOMString lastModified;
- readonly attribute DOMString readyState;
+ readonly attribute DocumentReadyState readyState;
// DOM tree accessors
getter object (DOMString name);
- attribute DOMString title;
- attribute DOMString dir;
- attribute HTMLElement? body;
+ attribute DOMString title;
+ attribute DOMString dir;
+ attribute HTMLElement? body;
readonly attribute HTMLHeadElement? head;
- readonly attribute HTMLCollection images;
- readonly attribute HTMLCollection embeds;
- readonly attribute HTMLCollection plugins;
- readonly attribute HTMLCollection links;
- readonly attribute HTMLCollection forms;
- readonly attribute HTMLCollection scripts;
+ [SameObject] readonly attribute HTMLCollection images;
+ [SameObject] readonly attribute HTMLCollection embeds;
+ [SameObject] readonly attribute HTMLCollection plugins;
+ [SameObject] readonly attribute HTMLCollection links;
+ [SameObject] readonly attribute HTMLCollection forms;
+ [SameObject] readonly attribute HTMLCollection scripts;
NodeList getElementsByName(DOMString elementName);
- NodeList getItems(optional DOMString typeNames); // microdata
- readonly attribute DOMElementMap cssElementMap;
+ NodeList getItems(optional DOMString typeNames = ""); // microdata
+ [SameObject] readonly attribute DOMElementMap cssElementMap;
+ readonly attribute HTMLScriptElement? currentScript;
// dynamic markup insertion
- Document open(optional DOMString type, optional DOMString replace);
- WindowProxy open(DOMString url, DOMString name, DOMString features, optional boolean replace);
+ Document open(optional DOMString type = "text/html", optional DOMString replace = "");
+ WindowProxy open(DOMString url, DOMString name, DOMString features, optional boolean replace = false);
void close();
void write(DOMString... text);
void writeln(DOMString... text);
@@ -94,10 +104,8 @@ partial interface Document {
readonly attribute WindowProxy? defaultView;
readonly attribute Element? activeElement;
boolean hasFocus();
- attribute DOMString designMode;
- boolean execCommand(DOMString commandId);
- boolean execCommand(DOMString commandId, boolean showUI);
- boolean execCommand(DOMString commandId, boolean showUI, DOMString value);
+ attribute DOMString designMode;
+ boolean execCommand(DOMString commandId, optional boolean showUI = false, optional DOMString value = "");
boolean queryCommandEnabled(DOMString commandId);
boolean queryCommandIndeterm(DOMString commandId);
boolean queryCommandState(DOMString commandId);
@@ -105,66 +113,12 @@ partial interface Document {
DOMString queryCommandValue(DOMString commandId);
readonly attribute HTMLCollection commands;
- // event handler IDL attributes
- attribute EventHandler onabort;
- attribute EventHandler onblur;
- attribute EventHandler oncancel;
- attribute EventHandler oncanplay;
- attribute EventHandler oncanplaythrough;
- attribute EventHandler onchange;
- attribute EventHandler onclick;
- attribute EventHandler onclose;
- attribute EventHandler oncontextmenu;
- attribute EventHandler oncuechange;
- attribute EventHandler ondblclick;
- attribute EventHandler ondrag;
- attribute EventHandler ondragend;
- attribute EventHandler ondragenter;
- attribute EventHandler ondragleave;
- attribute EventHandler ondragover;
- attribute EventHandler ondragstart;
- attribute EventHandler ondrop;
- attribute EventHandler ondurationchange;
- attribute EventHandler onemptied;
- attribute EventHandler onended;
- attribute OnErrorEventHandler onerror;
- attribute EventHandler onfocus;
- attribute EventHandler oninput;
- attribute EventHandler oninvalid;
- attribute EventHandler onkeydown;
- attribute EventHandler onkeypress;
- attribute EventHandler onkeyup;
- attribute EventHandler onload;
- attribute EventHandler onloadeddata;
- attribute EventHandler onloadedmetadata;
- attribute EventHandler onloadstart;
- attribute EventHandler onmousedown;
- attribute EventHandler onmousemove;
- attribute EventHandler onmouseout;
- attribute EventHandler onmouseover;
- attribute EventHandler onmouseup;
- attribute EventHandler onmousewheel;
- attribute EventHandler onpause;
- attribute EventHandler onplay;
- attribute EventHandler onplaying;
- attribute EventHandler onprogress;
- attribute EventHandler onratechange;
- attribute EventHandler onreset;
- attribute EventHandler onscroll;
- attribute EventHandler onseeked;
- attribute EventHandler onseeking;
- attribute EventHandler onselect;
- attribute EventHandler onshow;
- attribute EventHandler onstalled;
- attribute EventHandler onsubmit;
- attribute EventHandler onsuspend;
- attribute EventHandler ontimeupdate;
- attribute EventHandler onvolumechange;
- attribute EventHandler onwaiting;
-
// special event handler IDL attributes that only apply to Document objects
[LenientThis] attribute EventHandler onreadystatechange;
+
+ // also has obsolete members
};
+Document implements GlobalEventHandlers;
partial interface XMLDocument {
boolean load(DOMString url);
@@ -172,35 +126,33 @@ partial interface XMLDocument {
interface HTMLElement : Element {
// metadata attributes
- attribute DOMString title;
- attribute DOMString lang;
- attribute boolean translate;
- attribute DOMString dir;
- readonly attribute DOMStringMap dataset;
+ attribute DOMString title;
+ attribute DOMString lang;
+ attribute boolean translate;
+ attribute DOMString dir;
+ [SameObject] readonly attribute DOMStringMap dataset;
// microdata
- attribute boolean itemScope;
+ attribute boolean itemScope;
[PutForwards=value] readonly attribute DOMSettableTokenList itemType;
- attribute DOMString itemId;
+ attribute DOMString itemId;
[PutForwards=value] readonly attribute DOMSettableTokenList itemRef;
[PutForwards=value] readonly attribute DOMSettableTokenList itemProp;
readonly attribute HTMLPropertiesCollection properties;
- attribute any itemValue; // acts as DOMString on setting
+ attribute any itemValue; // acts as DOMString on setting
// user interaction
- attribute boolean hidden;
+ attribute boolean hidden;
void click();
- attribute long tabIndex;
+ attribute long tabIndex;
void focus();
void blur();
- attribute DOMString accessKey;
+ attribute DOMString accessKey;
readonly attribute DOMString accessKeyLabel;
- attribute boolean draggable;
+ attribute boolean draggable;
[PutForwards=value] readonly attribute DOMSettableTokenList dropzone;
- attribute DOMString contentEditable;
- readonly attribute boolean isContentEditable;
- attribute HTMLMenuElement? contextMenu;
- attribute boolean spellcheck;
+ attribute HTMLMenuElement? contextMenu;
+ attribute boolean spellcheck;
void forceSpellCheck();
// command API
@@ -210,217 +162,157 @@ interface HTMLElement : Element {
readonly attribute boolean? commandHidden;
readonly attribute boolean? commandDisabled;
readonly attribute boolean? commandChecked;
-
- // styling
- readonly attribute CSSStyleDeclaration style;
-
- // event handler IDL attributes
- attribute EventHandler onabort;
- attribute EventHandler onblur;
- attribute EventHandler oncancel;
- attribute EventHandler oncanplay;
- attribute EventHandler oncanplaythrough;
- attribute EventHandler onchange;
- attribute EventHandler onclick;
- attribute EventHandler onclose;
- attribute EventHandler oncontextmenu;
- attribute EventHandler oncuechange;
- attribute EventHandler ondblclick;
- attribute EventHandler ondrag;
- attribute EventHandler ondragend;
- attribute EventHandler ondragenter;
- attribute EventHandler ondragleave;
- attribute EventHandler ondragover;
- attribute EventHandler ondragstart;
- attribute EventHandler ondrop;
- attribute EventHandler ondurationchange;
- attribute EventHandler onemptied;
- attribute EventHandler onended;
- attribute OnErrorEventHandler onerror;
- attribute EventHandler onfocus;
- attribute EventHandler oninput;
- attribute EventHandler oninvalid;
- attribute EventHandler onkeydown;
- attribute EventHandler onkeypress;
- attribute EventHandler onkeyup;
- attribute EventHandler onload;
- attribute EventHandler onloadeddata;
- attribute EventHandler onloadedmetadata;
- attribute EventHandler onloadstart;
- attribute EventHandler onmousedown;
- attribute EventHandler onmousemove;
- attribute EventHandler onmouseout;
- attribute EventHandler onmouseover;
- attribute EventHandler onmouseup;
- attribute EventHandler onmousewheel;
- attribute EventHandler onpause;
- attribute EventHandler onplay;
- attribute EventHandler onplaying;
- attribute EventHandler onprogress;
- attribute EventHandler onratechange;
- attribute EventHandler onreset;
- attribute EventHandler onscroll;
- attribute EventHandler onseeked;
- attribute EventHandler onseeking;
- attribute EventHandler onselect;
- attribute EventHandler onshow;
- attribute EventHandler onstalled;
- attribute EventHandler onsubmit;
- attribute EventHandler onsuspend;
- attribute EventHandler ontimeupdate;
- attribute EventHandler onvolumechange;
- attribute EventHandler onwaiting;
};
+HTMLElement implements GlobalEventHandlers;
+HTMLElement implements ElementContentEditable;
interface HTMLUnknownElement : HTMLElement { };
-interface HTMLHtmlElement : HTMLElement {};
+interface HTMLHtmlElement : HTMLElement {
+ // also has obsolete members
+};
interface HTMLHeadElement : HTMLElement {};
interface HTMLTitleElement : HTMLElement {
- attribute DOMString text;
+ attribute DOMString text;
};
interface HTMLBaseElement : HTMLElement {
- attribute DOMString href;
- attribute DOMString target;
+ attribute DOMString href;
+ attribute DOMString target;
};
interface HTMLLinkElement : HTMLElement {
- attribute boolean disabled;
- attribute DOMString href;
- attribute DOMString rel;
+ attribute DOMString href;
+ attribute DOMString? crossOrigin;
+ attribute DOMString rel;
readonly attribute DOMTokenList relList;
- attribute DOMString media;
- attribute DOMString hreflang;
- attribute DOMString type;
+ attribute DOMString media;
+ attribute DOMString hreflang;
+ attribute DOMString type;
[PutForwards=value] readonly attribute DOMSettableTokenList sizes;
+
+ // also has obsolete members
};
HTMLLinkElement implements LinkStyle;
interface HTMLMetaElement : HTMLElement {
- attribute DOMString name;
- attribute DOMString httpEquiv;
- attribute DOMString content;
+ attribute DOMString name;
+ attribute DOMString httpEquiv;
+ attribute DOMString content;
+
+ // also has obsolete members
};
interface HTMLStyleElement : HTMLElement {
- attribute boolean disabled;
- attribute DOMString media;
- attribute DOMString type;
- attribute boolean scoped;
+ attribute DOMString media;
+ attribute DOMString type;
+ attribute boolean scoped;
};
HTMLStyleElement implements LinkStyle;
-interface HTMLScriptElement : HTMLElement {
- attribute DOMString src;
- attribute boolean async;
- attribute boolean defer;
- attribute DOMString type;
- attribute DOMString charset;
- attribute DOMString text;
+interface HTMLBodyElement : HTMLElement {
+
+ // also has obsolete members
};
+HTMLBodyElement implements WindowEventHandlers;
-interface HTMLBodyElement : HTMLElement {
- attribute EventHandler onafterprint;
- attribute EventHandler onbeforeprint;
- attribute EventHandler onbeforeunload;
- attribute EventHandler onblur;
- attribute OnErrorEventHandler onerror;
- attribute EventHandler onfocus;
- attribute EventHandler onhashchange;
- attribute EventHandler onload;
- attribute EventHandler onmessage;
- attribute EventHandler onoffline;
- attribute EventHandler ononline;
- attribute EventHandler onpopstate;
- attribute EventHandler onpagehide;
- attribute EventHandler onpageshow;
- attribute EventHandler onresize;
- attribute EventHandler onscroll;
- attribute EventHandler onstorage;
- attribute EventHandler onunload;
-};
-
-interface HTMLHeadingElement : HTMLElement {};
-
-interface HTMLParagraphElement : HTMLElement {};
-
-interface HTMLHRElement : HTMLElement {};
-
-interface HTMLPreElement : HTMLElement {};
+interface HTMLHeadingElement : HTMLElement {
+ // also has obsolete members
+};
+
+interface HTMLParagraphElement : HTMLElement {
+ // also has obsolete members
+};
+
+interface HTMLHRElement : HTMLElement {
+ // also has obsolete members
+};
+
+interface HTMLPreElement : HTMLElement {
+ // also has obsolete members
+};
interface HTMLQuoteElement : HTMLElement {
- attribute DOMString cite;
+ attribute DOMString cite;
};
interface HTMLOListElement : HTMLElement {
- attribute boolean reversed;
- attribute long start;
- attribute DOMString type;
+ attribute boolean reversed;
+ attribute long start;
+ attribute DOMString type;
+
+ // also has obsolete members
};
-interface HTMLUListElement : HTMLElement {};
+interface HTMLUListElement : HTMLElement {
+ // also has obsolete members
+};
interface HTMLLIElement : HTMLElement {
- attribute long value;
+ attribute long value;
+
+ // also has obsolete members
};
-interface HTMLDListElement : HTMLElement {};
+interface HTMLDListElement : HTMLElement {
+ // also has obsolete members
+};
-interface HTMLDivElement : HTMLElement {};
+interface HTMLDivElement : HTMLElement {
+ // also has obsolete members
+};
interface HTMLAnchorElement : HTMLElement {
- stringifier attribute DOMString href;
- attribute DOMString target;
-
- attribute DOMString download;
- attribute DOMString ping;
-
- attribute DOMString rel;
+ attribute DOMString target;
+ attribute DOMString download;
+ [PutForwards=value] attribute DOMSettableTokenList ping;
+ attribute DOMString rel;
readonly attribute DOMTokenList relList;
- attribute DOMString media;
- attribute DOMString hreflang;
- attribute DOMString type;
+ attribute DOMString hreflang;
+ attribute DOMString type;
- attribute DOMString text;
+ attribute DOMString text;
- // URL decomposition IDL attributes
- attribute DOMString protocol;
- attribute DOMString host;
- attribute DOMString hostname;
- attribute DOMString port;
- attribute DOMString pathname;
- attribute DOMString search;
- attribute DOMString hash;
+ // also has obsolete members
};
+HTMLAnchorElement implements URLUtils;
interface HTMLDataElement : HTMLElement {
- attribute DOMString value;
+ attribute DOMString value;
};
interface HTMLTimeElement : HTMLElement {
- attribute DOMString datetime;
+ attribute DOMString dateTime;
};
interface HTMLSpanElement : HTMLElement {};
-interface HTMLBRElement : HTMLElement {};
+interface HTMLBRElement : HTMLElement {
+ // also has obsolete members
+};
interface HTMLModElement : HTMLElement {
- attribute DOMString cite;
- attribute DOMString dateTime;
+ attribute DOMString cite;
+ attribute DOMString dateTime;
+};
+
+interface HTMLPictureElement : HTMLElement {};
+
+partial interface HTMLSourceElement {
+ attribute DOMString srcset;
+ attribute DOMString sizes;
+ attribute DOMString media;
};
-[NamedConstructor=Image(),
- NamedConstructor=Image(unsigned long width),
- NamedConstructor=Image(unsigned long width, unsigned long height)]
+[NamedConstructor=Image(optional unsigned long width, optional unsigned long height)]
interface HTMLImageElement : HTMLElement {
attribute DOMString alt;
attribute DOMString src;
attribute DOMString srcset;
- attribute DOMString crossOrigin;
+ attribute DOMString sizes;
+ attribute DOMString? crossOrigin;
attribute DOMString useMap;
attribute boolean isMap;
attribute unsigned long width;
@@ -428,78 +320,94 @@ interface HTMLImageElement : HTMLElement {
readonly attribute unsigned long naturalWidth;
readonly attribute unsigned long naturalHeight;
readonly attribute boolean complete;
+ readonly attribute DOMString currentSrc;
+
+ // also has obsolete members
};
interface HTMLIFrameElement : HTMLElement {
- attribute DOMString src;
- attribute DOMString srcdoc;
- attribute DOMString name;
+ attribute DOMString src;
+ attribute DOMString srcdoc;
+ attribute DOMString name;
[PutForwards=value] readonly attribute DOMSettableTokenList sandbox;
- attribute boolean seamless;
- attribute DOMString width;
- attribute DOMString height;
+ attribute boolean seamless;
+ attribute boolean allowFullscreen;
+ attribute DOMString width;
+ attribute DOMString height;
readonly attribute Document? contentDocument;
readonly attribute WindowProxy? contentWindow;
+ Document? getSVGDocument();
+
+ // also has obsolete members
};
interface HTMLEmbedElement : HTMLElement {
- attribute DOMString src;
- attribute DOMString type;
- attribute DOMString width;
- attribute DOMString height;
+ attribute DOMString src;
+ attribute DOMString type;
+ attribute DOMString width;
+ attribute DOMString height;
+ Document? getSVGDocument();
legacycaller any (any... arguments);
+
+ // also has obsolete members
};
interface HTMLObjectElement : HTMLElement {
- attribute DOMString data;
- attribute DOMString type;
- attribute boolean typeMustMatch;
- attribute DOMString name;
- attribute DOMString useMap;
+ attribute DOMString data;
+ attribute DOMString type;
+ attribute boolean typeMustMatch;
+ attribute DOMString name;
+ attribute DOMString useMap;
readonly attribute HTMLFormElement? form;
- attribute DOMString width;
- attribute DOMString height;
+ attribute DOMString width;
+ attribute DOMString height;
readonly attribute Document? contentDocument;
readonly attribute WindowProxy? contentWindow;
+ Document? getSVGDocument();
readonly attribute boolean willValidate;
readonly attribute ValidityState validity;
readonly attribute DOMString validationMessage;
boolean checkValidity();
+ boolean reportValidity();
void setCustomValidity(DOMString error);
legacycaller any (any... arguments);
+
+ // also has obsolete members
};
interface HTMLParamElement : HTMLElement {
- attribute DOMString name;
- attribute DOMString value;
+ attribute DOMString name;
+ attribute DOMString value;
+
+ // also has obsolete members
};
interface HTMLVideoElement : HTMLMediaElement {
- attribute unsigned long width;
- attribute unsigned long height;
+ attribute unsigned long width;
+ attribute unsigned long height;
readonly attribute unsigned long videoWidth;
readonly attribute unsigned long videoHeight;
- attribute DOMString poster;
+ attribute DOMString poster;
};
-[NamedConstructor=Audio(),
- NamedConstructor=Audio(DOMString src)]
+[NamedConstructor=Audio(optional DOMString src)]
interface HTMLAudioElement : HTMLMediaElement {};
interface HTMLSourceElement : HTMLElement {
- attribute DOMString src;
- attribute DOMString type;
- attribute DOMString media;
+ attribute DOMString src;
+ attribute DOMString type;
+
+ // also has obsolete members
};
interface HTMLTrackElement : HTMLElement {
- attribute DOMString kind;
- attribute DOMString src;
- attribute DOMString srclang;
- attribute DOMString label;
- attribute boolean default;
+ attribute DOMString kind;
+ attribute DOMString src;
+ attribute DOMString srclang;
+ attribute DOMString label;
+ attribute boolean default;
const unsigned short NONE = 0;
const unsigned short LOADING = 1;
@@ -510,24 +418,27 @@ interface HTMLTrackElement : HTMLElement {
readonly attribute TextTrack track;
};
+enum CanPlayTypeResult { "" /* empty string */, "maybe", "probably" };
+typedef (MediaStream or MediaSource or Blob) MediaProvider;
interface HTMLMediaElement : HTMLElement {
// error state
readonly attribute MediaError? error;
// network state
- attribute DOMString src;
+ attribute DOMString src;
+ attribute MediaProvider? srcObject;
readonly attribute DOMString currentSrc;
- attribute DOMString crossOrigin;
+ attribute DOMString? crossOrigin;
const unsigned short NETWORK_EMPTY = 0;
const unsigned short NETWORK_IDLE = 1;
const unsigned short NETWORK_LOADING = 2;
const unsigned short NETWORK_NO_SOURCE = 3;
readonly attribute unsigned short networkState;
- attribute DOMString preload;
+ attribute DOMString preload;
readonly attribute TimeRanges buffered;
void load();
- DOMString canPlayType(DOMString type);
+ CanPlayTypeResult canPlayType(DOMString type);
// ready state
const unsigned short HAVE_NOTHING = 0;
@@ -539,36 +450,36 @@ interface HTMLMediaElement : HTMLElement {
readonly attribute boolean seeking;
// playback state
- attribute double currentTime;
+ attribute double currentTime;
void fastSeek(double time);
readonly attribute unrestricted double duration;
- readonly attribute Date startDate;
+ Date getStartDate();
readonly attribute boolean paused;
- attribute double defaultPlaybackRate;
- attribute double playbackRate;
+ attribute double defaultPlaybackRate;
+ attribute double playbackRate;
readonly attribute TimeRanges played;
readonly attribute TimeRanges seekable;
readonly attribute boolean ended;
- attribute boolean autoplay;
- attribute boolean loop;
+ attribute boolean autoplay;
+ attribute boolean loop;
void play();
void pause();
// media controller
- attribute DOMString mediaGroup;
- attribute MediaController? controller;
+ attribute DOMString mediaGroup;
+ attribute MediaController? controller;
// controls
- attribute boolean controls;
- attribute double volume;
- attribute boolean muted;
- attribute boolean defaultMuted;
+ attribute boolean controls;
+ attribute double volume;
+ attribute boolean muted;
+ attribute boolean defaultMuted;
// tracks
- readonly attribute AudioTrackList audioTracks;
- readonly attribute VideoTrackList videoTracks;
- readonly attribute TextTrackList textTracks;
- TextTrack addTextTrack(DOMString kind, optional DOMString label, optional DOMString language);
+ [SameObject] readonly attribute AudioTrackList audioTracks;
+ [SameObject] readonly attribute VideoTrackList videoTracks;
+ [SameObject] readonly attribute TextTrackList textTracks;
+ TextTrack addTextTrack(TextTrackKind kind, optional DOMString label = "", optional DOMString language = "");
};
interface MediaError {
@@ -584,9 +495,9 @@ interface AudioTrackList : EventTarget {
getter AudioTrack (unsigned long index);
AudioTrack? getTrackById(DOMString id);
- attribute EventHandler onchange;
- attribute EventHandler onaddtrack;
- attribute EventHandler onremovetrack;
+ attribute EventHandler onchange;
+ attribute EventHandler onaddtrack;
+ attribute EventHandler onremovetrack;
};
interface AudioTrack {
@@ -594,7 +505,7 @@ interface AudioTrack {
readonly attribute DOMString kind;
readonly attribute DOMString label;
readonly attribute DOMString language;
- attribute boolean enabled;
+ attribute boolean enabled;
};
interface VideoTrackList : EventTarget {
@@ -603,9 +514,9 @@ interface VideoTrackList : EventTarget {
VideoTrack? getTrackById(DOMString id);
readonly attribute long selectedIndex;
- attribute EventHandler onchange;
- attribute EventHandler onaddtrack;
- attribute EventHandler onremovetrack;
+ attribute EventHandler onchange;
+ attribute EventHandler onaddtrack;
+ attribute EventHandler onremovetrack;
};
interface VideoTrack {
@@ -613,7 +524,7 @@ interface VideoTrack {
readonly attribute DOMString kind;
readonly attribute DOMString label;
readonly attribute DOMString language;
- attribute boolean selected;
+ attribute boolean selected;
};
enum MediaControllerPlaybackState { "waiting", "playing", "ended" };
@@ -624,7 +535,7 @@ interface MediaController : EventTarget {
readonly attribute TimeRanges buffered;
readonly attribute TimeRanges seekable;
readonly attribute unrestricted double duration;
- attribute double currentTime;
+ attribute double currentTime;
readonly attribute boolean paused;
readonly attribute MediaControllerPlaybackState playbackState;
@@ -633,45 +544,50 @@ interface MediaController : EventTarget {
void unpause();
void play(); // calls play() on all media elements as well
- attribute double defaultPlaybackRate;
- attribute double playbackRate;
+ attribute double defaultPlaybackRate;
+ attribute double playbackRate;
- attribute double volume;
- attribute boolean muted;
+ attribute double volume;
+ attribute boolean muted;
- attribute EventHandler onemptied;
- attribute EventHandler onloadedmetadata;
- attribute EventHandler onloadeddata;
- attribute EventHandler oncanplay;
- attribute EventHandler oncanplaythrough;
- attribute EventHandler onplaying;
- attribute EventHandler onended;
- attribute EventHandler onwaiting;
+ attribute EventHandler onemptied;
+ attribute EventHandler onloadedmetadata;
+ attribute EventHandler onloadeddata;
+ attribute EventHandler oncanplay;
+ attribute EventHandler oncanplaythrough;
+ attribute EventHandler onplaying;
+ attribute EventHandler onended;
+ attribute EventHandler onwaiting;
- attribute EventHandler ondurationchange;
- attribute EventHandler ontimeupdate;
- attribute EventHandler onplay;
- attribute EventHandler onpause;
- attribute EventHandler onratechange;
- attribute EventHandler onvolumechange;
+ attribute EventHandler ondurationchange;
+ attribute EventHandler ontimeupdate;
+ attribute EventHandler onplay;
+ attribute EventHandler onpause;
+ attribute EventHandler onratechange;
+ attribute EventHandler onvolumechange;
};
interface TextTrackList : EventTarget {
readonly attribute unsigned long length;
getter TextTrack (unsigned long index);
+ TextTrack? getTrackById(DOMString id);
- attribute EventHandler onaddtrack;
- attribute EventHandler onremovetrack;
+ attribute EventHandler onchange;
+ attribute EventHandler onaddtrack;
+ attribute EventHandler onremovetrack;
};
-enum TextTrackMode { "disabled", "hidden", "showing" };
+enum TextTrackMode { "disabled", "hidden", "showing" };
+enum TextTrackKind { "subtitles", "captions", "descriptions", "chapters", "metadata" };
interface TextTrack : EventTarget {
- readonly attribute DOMString kind;
+ readonly attribute TextTrackKind kind;
readonly attribute DOMString label;
readonly attribute DOMString language;
+
+ readonly attribute DOMString id;
readonly attribute DOMString inBandMetadataTrackDispatchType;
- attribute TextTrackMode mode;
+ attribute TextTrackMode mode;
readonly attribute TextTrackCueList? cues;
readonly attribute TextTrackCueList? activeCues;
@@ -679,7 +595,7 @@ interface TextTrack : EventTarget {
void addCue(TextTrackCue cue);
void removeCue(TextTrackCue cue);
- attribute EventHandler oncuechange;
+ attribute EventHandler oncuechange;
};
interface TextTrackCueList {
@@ -688,26 +604,16 @@ interface TextTrackCueList {
TextTrackCue? getCueById(DOMString id);
};
-enum AutoKeyword { "auto" };
-[Constructor(double startTime, double endTime, DOMString text)]
interface TextTrackCue : EventTarget {
readonly attribute TextTrack? track;
- attribute DOMString id;
- attribute double startTime;
- attribute double endTime;
- attribute boolean pauseOnExit;
- attribute DOMString vertical;
- attribute boolean snapToLines;
- attribute (long or AutoKeyword) line;
- attribute long position;
- attribute long size;
- attribute DOMString align;
- attribute DOMString text;
- DocumentFragment getCueAsHTML();
+ attribute DOMString id;
+ attribute double startTime;
+ attribute double endTime;
+ attribute boolean pauseOnExit;
- attribute EventHandler onenter;
- attribute EventHandler onexit;
+ attribute EventHandler onenter;
+ attribute EventHandler onexit;
};
interface TimeRanges {
@@ -718,465 +624,254 @@ interface TimeRanges {
[Constructor(DOMString type, optional TrackEventInit eventInitDict)]
interface TrackEvent : Event {
- readonly attribute object? track;
+ readonly attribute (VideoTrack or AudioTrack or TextTrack)? track;
};
dictionary TrackEventInit : EventInit {
- object? track;
-};
-
-interface HTMLCanvasElement : HTMLElement {
- attribute unsigned long width;
- attribute unsigned long height;
-
- DOMString toDataURL(optional DOMString type, any... arguments);
- DOMString toDataURLHD(optional DOMString type, any... arguments);
- void toBlob(FileCallback? _callback, optional DOMString type, any... arguments);
- void toBlobHD(FileCallback? _callback, optional DOMString type, any... arguments);
-
- object? getContext(DOMString contextId, any... arguments);
- boolean supportsContext(DOMString contextId, any... arguments);
-};
-
-interface CanvasRenderingContext2D {
-
- // back-reference to the canvas
- readonly attribute HTMLCanvasElement canvas;
-
- // state
- void save(); // push state on state stack
- void restore(); // pop state stack and restore state
-
- // transformations (default transform is the identity matrix)
- attribute SVGMatrix currentTransform;
- void scale(unrestricted double x, unrestricted double y);
- void rotate(unrestricted double angle);
- void translate(unrestricted double x, unrestricted double y);
- void transform(unrestricted double a, unrestricted double b, unrestricted double c, unrestricted double d, unrestricted double e, unrestricted double f);
- void setTransform(unrestricted double a, unrestricted double b, unrestricted double c, unrestricted double d, unrestricted double e, unrestricted double f);
- void resetTransform();
-
- // compositing
- attribute unrestricted double globalAlpha; // (default 1.0)
- attribute DOMString globalCompositeOperation; // (default source-over)
-
- // image smoothing
- attribute boolean imageSmoothingEnabled; // (default true)
-
- // colors and styles (see also the CanvasDrawingStyles interface)
- attribute (DOMString or CanvasGradient or CanvasPattern) strokeStyle; // (default black)
- attribute (DOMString or CanvasGradient or CanvasPattern) fillStyle; // (default black)
- CanvasGradient createLinearGradient(double x0, double y0, double x1, double y1);
- CanvasGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1);
- CanvasPattern createPattern((HTMLImageElement or HTMLCanvasElement or HTMLVideoElement) image, DOMString repetition);
-
- // shadows
- attribute unrestricted double shadowOffsetX; // (default 0)
- attribute unrestricted double shadowOffsetY; // (default 0)
- attribute unrestricted double shadowBlur; // (default 0)
- attribute DOMString shadowColor; // (default transparent black)
-
- // rects
- void clearRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
- void fillRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
- void strokeRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
-
- // path API (see also CanvasPathMethods)
- void beginPath();
- void fill();
- void fill(Path path);
- void stroke();
- void stroke(Path path);
- void drawSystemFocusRing(Element element);
- void drawSystemFocusRing(Path path, Element element);
- boolean drawCustomFocusRing(Element element);
- boolean drawCustomFocusRing(Path path, Element element);
- void scrollPathIntoView();
- void scrollPathIntoView(Path path);
- void clip();
- void clip(Path path);
- void resetClip();
- boolean isPointInPath(unrestricted double x, unrestricted double y);
- boolean isPointInPath(Path path, unrestricted double x, unrestricted double y);
-
- // text (see also the CanvasDrawingStyles interface)
- void fillText(DOMString text, unrestricted double x, unrestricted double y, optional unrestricted double maxWidth);
- void strokeText(DOMString text, unrestricted double x, unrestricted double y, optional unrestricted double maxWidth);
- TextMetrics measureText(DOMString text);
-
- // drawing images
- void drawImage((HTMLImageElement or HTMLCanvasElement or HTMLVideoElement) image, unrestricted double dx, unrestricted double dy);
- void drawImage((HTMLImageElement or HTMLCanvasElement or HTMLVideoElement) image, unrestricted double dx, unrestricted double dy, unrestricted double dw, unrestricted double dh);
- void drawImage((HTMLImageElement or HTMLCanvasElement or HTMLVideoElement) image, unrestricted double sx, unrestricted double sy, unrestricted double sw, unrestricted double sh, unrestricted double dx, unrestricted double dy, unrestricted double dw, unrestricted double dh);
-
- // hit regions
- void addHitRegion(HitRegionOptions options);
- void removeHitRegion(HitRegionOptions options);
-
- // pixel manipulation
- ImageData createImageData(double sw, double sh);
- ImageData createImageData(ImageData imagedata);
- ImageData createImageDataHD(double sw, double sh);
- ImageData getImageData(double sx, double sy, double sw, double sh);
- ImageData getImageDataHD(double sx, double sy, double sw, double sh);
- void putImageData(ImageData imagedata, double dx, double dy);
- void putImageData(ImageData imagedata, double dx, double dy, double dirtyX, double dirtyY, double dirtyWidth, double dirtyHeight);
- void putImageDataHD(ImageData imagedata, double dx, double dy);
- void putImageDataHD(ImageData imagedata, double dx, double dy, double dirtyX, double dirtyY, double dirtyWidth, double dirtyHeight);
-};
-CanvasRenderingContext2D implements CanvasDrawingStyles;
-CanvasRenderingContext2D implements CanvasPathMethods;
-
-[NoInterfaceObject]
-interface CanvasDrawingStyles {
- // line caps/joins
- attribute unrestricted double lineWidth; // (default 1)
- attribute DOMString lineCap; // "butt", "round", "square" (default "butt")
- attribute DOMString lineJoin; // "round", "bevel", "miter" (default "miter")
- attribute unrestricted double miterLimit; // (default 10)
-
- // dashed lines
- void setLineDash(sequence<unrestricted double> segments); // default empty
- sequence<unrestricted double> getLineDash();
- attribute unrestricted double lineDashOffset;
-
- // text
- attribute DOMString font; // (default 10px sans-serif)
- attribute DOMString textAlign; // "start", "end", "left", "right", "center" (default: "start")
- attribute DOMString textBaseline; // "top", "hanging", "middle", "alphabetic", "ideographic", "bottom" (default: "alphabetic")
-};
-
-[NoInterfaceObject]
-interface CanvasPathMethods {
- // shared path API methods
- void closePath();
- void moveTo(unrestricted double x, unrestricted double y);
- void lineTo(unrestricted double x, unrestricted double y);
- void quadraticCurveTo(unrestricted double cpx, unrestricted double cpy, unrestricted double x, unrestricted double y);
- void bezierCurveTo(unrestricted double cp1x, unrestricted double cp1y, unrestricted double cp2x, unrestricted double cp2y, unrestricted double x, unrestricted double y);
- void arcTo(unrestricted double x1, unrestricted double y1, unrestricted double x2, unrestricted double y2, unrestricted double radius);
- void arcTo(unrestricted double x1, unrestricted double y1, unrestricted double x2, unrestricted double y2, unrestricted double radiusX, unrestricted double radiusY, unrestricted double rotation);
- void rect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
- void arc(unrestricted double x, unrestricted double y, unrestricted double radius, unrestricted double startAngle, unrestricted double endAngle, optional boolean anticlockwise = false);
- void ellipse(unrestricted double x, unrestricted double y, unrestricted double radiusX, unrestricted double radiusY, unrestricted double rotation, unrestricted double startAngle, unrestricted double endAngle, boolean anticlockwise);
-};
-
-interface CanvasGradient {
- // opaque object
- void addColorStop(double offset, DOMString color);
-};
-
-interface CanvasPattern {
- // opaque object
- void setTransform(SVGMatrix transform);
-};
-
-interface TextMetrics {
- // x-direction
- readonly attribute double width; // advance width
- readonly attribute double actualBoundingBoxLeft;
- readonly attribute double actualBoundingBoxRight;
-
- // y-direction
- readonly attribute double fontBoundingBoxAscent;
- readonly attribute double fontBoundingBoxDescent;
- readonly attribute double actualBoundingBoxAscent;
- readonly attribute double actualBoundingBoxDescent;
- readonly attribute double emHeightAscent;
- readonly attribute double emHeightDescent;
- readonly attribute double hangingBaseline;
- readonly attribute double alphabeticBaseline;
- readonly attribute double ideographicBaseline;
-};
-
-dictionary HitRegionOptions {
- Path? path = null;
- DOMString id = "";
- DOMString? parentID = null;
- DOMString cursor = "inherit";
- // for control-backed regions:
- Element? control = null;
- // for unbacked regions:
- DOMString? label = null;
- DOMString? role = null;
-};
-
-interface ImageData {
- readonly attribute unsigned long width;
- readonly attribute unsigned long height;
- readonly attribute Uint8ClampedArray data;
-};
-
-[Constructor(optional Element scope)]
-interface DrawingStyle { };
-DrawingStyle implements CanvasDrawingStyles;
-
-[Constructor,
- Constructor(Path path),
- Constructor(DOMString d)]
-interface Path {
- void addPath(Path path, SVGMatrix? transformation);
- void addPathByStrokingPath(Path path, CanvasDrawingStyles styles, SVGMatrix? transformation);
- void addText(DOMString text, CanvasDrawingStyles styles, SVGMatrix? transformation, unrestricted double x, unrestricted double y, optional unrestricted double maxWidth);
- void addPathByStrokingText(DOMString text, CanvasDrawingStyles styles, SVGMatrix? transformation, unrestricted double x, unrestricted double y, optional unrestricted double maxWidth);
- void addText(DOMString text, CanvasDrawingStyles styles, SVGMatrix? transformation, Path path, optional unrestricted double maxWidth);
- void addPathByStrokingText(DOMString text, CanvasDrawingStyles styles, SVGMatrix? transformation, Path path, optional unrestricted double maxWidth);
-};
-Path implements CanvasPathMethods;
-
-partial interface Screen {
- readonly attribute double canvasResolution;
-};
-
-partial interface MouseEvent {
- readonly attribute DOMString? region;
-};
-
-partial dictionary MouseEventInit {
- DOMString? region;
+ (VideoTrack or AudioTrack or TextTrack)? track;
};
interface HTMLMapElement : HTMLElement {
- attribute DOMString name;
+ attribute DOMString name;
readonly attribute HTMLCollection areas;
readonly attribute HTMLCollection images;
};
interface HTMLAreaElement : HTMLElement {
- attribute DOMString alt;
- attribute DOMString coords;
- attribute DOMString shape;
- stringifier attribute DOMString href;
- attribute DOMString target;
-
- attribute DOMString download;
- attribute DOMString ping;
-
- attribute DOMString rel;
+ attribute DOMString alt;
+ attribute DOMString coords;
+ attribute DOMString shape;
+ attribute DOMString target;
+ attribute DOMString download;
+ [PutForwards=value] attribute DOMSettableTokenList ping;
+ attribute DOMString rel;
readonly attribute DOMTokenList relList;
- attribute DOMString media;
- attribute DOMString hreflang;
- attribute DOMString type;
+ attribute DOMString hreflang;
+ attribute DOMString type;
- // URL decomposition IDL attributes
- attribute DOMString protocol;
- attribute DOMString host;
- attribute DOMString hostname;
- attribute DOMString port;
- attribute DOMString pathname;
- attribute DOMString search;
- attribute DOMString hash;
+ // also has obsolete members
};
+HTMLAreaElement implements URLUtils;
interface HTMLTableElement : HTMLElement {
- attribute HTMLTableCaptionElement? caption;
+ attribute HTMLTableCaptionElement? caption;
HTMLElement createCaption();
void deleteCaption();
- attribute HTMLTableSectionElement? tHead;
+ attribute HTMLTableSectionElement? tHead;
HTMLElement createTHead();
void deleteTHead();
- attribute HTMLTableSectionElement? tFoot;
+ attribute HTMLTableSectionElement? tFoot;
HTMLElement createTFoot();
void deleteTFoot();
readonly attribute HTMLCollection tBodies;
HTMLElement createTBody();
readonly attribute HTMLCollection rows;
- HTMLElement insertRow(optional long index);
+ HTMLElement insertRow(optional long index = -1);
void deleteRow(long index);
+ attribute boolean sortable;
+ void stopSorting();
+
+ // also has obsolete members
};
-interface HTMLTableCaptionElement : HTMLElement {};
+interface HTMLTableCaptionElement : HTMLElement {
+ // also has obsolete members
+};
interface HTMLTableColElement : HTMLElement {
- attribute unsigned long span;
+ attribute unsigned long span;
+
+ // also has obsolete members
};
interface HTMLTableSectionElement : HTMLElement {
readonly attribute HTMLCollection rows;
- HTMLElement insertRow(optional long index);
+ HTMLElement insertRow(optional long index = -1);
void deleteRow(long index);
+
+ // also has obsolete members
};
interface HTMLTableRowElement : HTMLElement {
readonly attribute long rowIndex;
readonly attribute long sectionRowIndex;
readonly attribute HTMLCollection cells;
- HTMLElement insertCell(optional long index);
+ HTMLElement insertCell(optional long index = -1);
void deleteCell(long index);
+
+ // also has obsolete members
};
-interface HTMLTableDataCellElement : HTMLTableCellElement {};
+interface HTMLTableDataCellElement : HTMLTableCellElement {
+ // also has obsolete members
+};
interface HTMLTableHeaderCellElement : HTMLTableCellElement {
- attribute DOMString scope;
- attribute DOMString abbr;
+ attribute DOMString scope;
+ attribute DOMString abbr;
+ attribute DOMString sorted;
+ void sort();
};
interface HTMLTableCellElement : HTMLElement {
- attribute unsigned long colSpan;
- attribute unsigned long rowSpan;
+ attribute unsigned long colSpan;
+ attribute unsigned long rowSpan;
[PutForwards=value] readonly attribute DOMSettableTokenList headers;
readonly attribute long cellIndex;
+
+ // also has obsolete members
};
[OverrideBuiltins]
interface HTMLFormElement : HTMLElement {
- attribute DOMString acceptCharset;
- attribute DOMString action;
- attribute DOMString autocomplete;
- attribute DOMString enctype;
- attribute DOMString encoding;
- attribute DOMString method;
- attribute DOMString name;
- attribute boolean noValidate;
- attribute DOMString target;
+ attribute DOMString acceptCharset;
+ attribute DOMString action;
+ attribute DOMString autocomplete;
+ attribute DOMString enctype;
+ attribute DOMString encoding;
+ attribute DOMString method;
+ attribute DOMString name;
+ attribute boolean noValidate;
+ attribute DOMString target;
readonly attribute HTMLFormControlsCollection elements;
readonly attribute long length;
getter Element (unsigned long index);
- getter object (DOMString name);
+ getter (RadioNodeList or Element) (DOMString name);
void submit();
void reset();
boolean checkValidity();
-};
+ boolean reportValidity();
-interface HTMLFieldSetElement : HTMLElement {
- attribute boolean disabled;
- readonly attribute HTMLFormElement? form;
- attribute DOMString name;
-
- readonly attribute DOMString type;
-
- readonly attribute HTMLFormControlsCollection elements;
-
- readonly attribute boolean willValidate;
- readonly attribute ValidityState validity;
- readonly attribute DOMString validationMessage;
- boolean checkValidity();
- void setCustomValidity(DOMString error);
-};
-
-interface HTMLLegendElement : HTMLElement {
- readonly attribute HTMLFormElement? form;
+ void requestAutocomplete();
};
interface HTMLLabelElement : HTMLElement {
readonly attribute HTMLFormElement? form;
- attribute DOMString htmlFor;
+ attribute DOMString htmlFor;
readonly attribute HTMLElement? control;
};
interface HTMLInputElement : HTMLElement {
- attribute DOMString accept;
- attribute DOMString alt;
- attribute DOMString autocomplete;
- attribute boolean autofocus;
- attribute boolean defaultChecked;
- attribute boolean checked;
- attribute DOMString dirName;
- attribute boolean disabled;
+ attribute DOMString accept;
+ attribute DOMString alt;
+ attribute DOMString autocomplete;
+ attribute boolean autofocus;
+ attribute boolean defaultChecked;
+ attribute boolean checked;
+ attribute DOMString dirName;
+ attribute boolean disabled;
readonly attribute HTMLFormElement? form;
readonly attribute FileList? files;
- attribute DOMString formAction;
- attribute DOMString formEnctype;
- attribute DOMString formMethod;
- attribute boolean formNoValidate;
- attribute DOMString formTarget;
- attribute unsigned long height;
- attribute boolean indeterminate;
- attribute DOMString inputMode;
+ attribute DOMString formAction;
+ attribute DOMString formEnctype;
+ attribute DOMString formMethod;
+ attribute boolean formNoValidate;
+ attribute DOMString formTarget;
+ attribute unsigned long height;
+ attribute boolean indeterminate;
+ attribute DOMString inputMode;
readonly attribute HTMLElement? list;
- attribute DOMString max;
- attribute long maxLength;
- attribute DOMString min;
- attribute boolean multiple;
- attribute DOMString name;
- attribute DOMString pattern;
- attribute DOMString placeholder;
- attribute boolean readOnly;
- attribute boolean required;
- attribute unsigned long size;
- attribute DOMString src;
- attribute DOMString step;
- attribute DOMString type;
- attribute DOMString defaultValue;
+ attribute DOMString max;
+ attribute long maxLength;
+ attribute DOMString min;
+ attribute long minLength;
+ attribute boolean multiple;
+ attribute DOMString name;
+ attribute DOMString pattern;
+ attribute DOMString placeholder;
+ attribute boolean readOnly;
+ attribute boolean required;
+ attribute unsigned long size;
+ attribute DOMString src;
+ attribute DOMString step;
+ attribute DOMString type;
+ attribute DOMString defaultValue;
[TreatNullAs=EmptyString] attribute DOMString value;
- attribute Date? valueAsDate;
- attribute unrestricted double valueAsNumber;
- attribute unsigned long width;
+ attribute Date? valueAsDate;
+ attribute unrestricted double valueAsNumber;
+ attribute double valueLow;
+ attribute double valueHigh;
+ attribute unsigned long width;
- void stepUp(optional long n);
- void stepDown(optional long n);
+ void stepUp(optional long n = 1);
+ void stepDown(optional long n = 1);
readonly attribute boolean willValidate;
readonly attribute ValidityState validity;
readonly attribute DOMString validationMessage;
boolean checkValidity();
+ boolean reportValidity();
void setCustomValidity(DOMString error);
readonly attribute NodeList labels;
void select();
- attribute unsigned long selectionStart;
- attribute unsigned long selectionEnd;
- attribute DOMString selectionDirection;
-
+ attribute unsigned long selectionStart;
+ attribute unsigned long selectionEnd;
+ attribute DOMString selectionDirection;
void setRangeText(DOMString replacement);
- void setRangeText(DOMString replacement, unsigned long start, unsigned long end, optional SelectionMode selectionMode);
-
+ void setRangeText(DOMString replacement, unsigned long start, unsigned long end, optional SelectionMode selectionMode = "preserve");
void setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction);
+
+ // also has obsolete members
};
interface HTMLButtonElement : HTMLElement {
- attribute boolean autofocus;
- attribute boolean disabled;
+ attribute boolean autofocus;
+ attribute boolean disabled;
readonly attribute HTMLFormElement? form;
- attribute DOMString formAction;
- attribute DOMString formEnctype;
- attribute DOMString formMethod;
- attribute boolean formNoValidate;
- attribute DOMString formTarget;
- attribute DOMString name;
- attribute DOMString type;
- attribute DOMString value;
+ attribute DOMString formAction;
+ attribute DOMString formEnctype;
+ attribute DOMString formMethod;
+ attribute boolean formNoValidate;
+ attribute DOMString formTarget;
+ attribute DOMString name;
+ attribute DOMString type;
+ attribute DOMString value;
+ attribute HTMLMenuElement? menu;
readonly attribute boolean willValidate;
readonly attribute ValidityState validity;
readonly attribute DOMString validationMessage;
boolean checkValidity();
+ boolean reportValidity();
void setCustomValidity(DOMString error);
readonly attribute NodeList labels;
};
interface HTMLSelectElement : HTMLElement {
- attribute boolean autofocus;
- attribute boolean disabled;
+ attribute DOMString autocomplete;
+ attribute boolean autofocus;
+ attribute boolean disabled;
readonly attribute HTMLFormElement? form;
- attribute boolean multiple;
- attribute DOMString name;
- attribute boolean required;
- attribute unsigned long size;
+ attribute boolean multiple;
+ attribute DOMString name;
+ attribute boolean required;
+ attribute unsigned long size;
readonly attribute DOMString type;
readonly attribute HTMLOptionsCollection options;
- attribute unsigned long length;
- getter Element item(unsigned long index);
- object namedItem(DOMString name);
+ attribute unsigned long length;
+ getter Element? item(unsigned long index);
+ HTMLOptionElement? namedItem(DOMString name);
void add((HTMLOptionElement or HTMLOptGroupElement) element, optional (HTMLElement or long)? before = null);
+ void remove(); // ChildNode overload
void remove(long index);
setter creator void (unsigned long index, HTMLOptionElement? option);
readonly attribute HTMLCollection selectedOptions;
- attribute long selectedIndex;
- attribute DOMString value;
+ attribute long selectedIndex;
+ attribute DOMString value;
readonly attribute boolean willValidate;
readonly attribute ValidityState validity;
readonly attribute DOMString validationMessage;
boolean checkValidity();
+ boolean reportValidity();
void setCustomValidity(DOMString error);
readonly attribute NodeList labels;
@@ -1187,45 +882,42 @@ interface HTMLDataListElement : HTMLElement {
};
interface HTMLOptGroupElement : HTMLElement {
- attribute boolean disabled;
- attribute DOMString label;
+ attribute boolean disabled;
+ attribute DOMString label;
};
-[NamedConstructor=Option(),
- NamedConstructor=Option(DOMString text),
- NamedConstructor=Option(DOMString text, DOMString value),
- NamedConstructor=Option(DOMString text, DOMString value, boolean defaultSelected),
- NamedConstructor=Option(DOMString text, DOMString value, boolean defaultSelected, boolean selected)]
+[NamedConstructor=Option(optional DOMString text = "", optional DOMString value, optional boolean defaultSelected = false, optional boolean selected = false)]
interface HTMLOptionElement : HTMLElement {
- attribute boolean disabled;
+ attribute boolean disabled;
readonly attribute HTMLFormElement? form;
- attribute DOMString label;
- attribute boolean defaultSelected;
- attribute boolean selected;
- attribute DOMString value;
+ attribute DOMString label;
+ attribute boolean defaultSelected;
+ attribute boolean selected;
+ attribute DOMString value;
- attribute DOMString text;
+ attribute DOMString text;
readonly attribute long index;
};
interface HTMLTextAreaElement : HTMLElement {
- attribute DOMString autocomplete;
- attribute boolean autofocus;
- attribute unsigned long cols;
- attribute DOMString dirName;
- attribute boolean disabled;
+ attribute DOMString autocomplete;
+ attribute boolean autofocus;
+ attribute unsigned long cols;
+ attribute DOMString dirName;
+ attribute boolean disabled;
readonly attribute HTMLFormElement? form;
- attribute DOMString inputMode;
- attribute long maxLength;
- attribute DOMString name;
- attribute DOMString placeholder;
- attribute boolean readOnly;
- attribute boolean required;
- attribute unsigned long rows;
- attribute DOMString wrap;
+ attribute DOMString inputMode;
+ attribute long maxLength;
+ attribute long minLength;
+ attribute DOMString name;
+ attribute DOMString placeholder;
+ attribute boolean readOnly;
+ attribute boolean required;
+ attribute unsigned long rows;
+ attribute DOMString wrap;
readonly attribute DOMString type;
- attribute DOMString defaultValue;
+ attribute DOMString defaultValue;
[TreatNullAs=EmptyString] attribute DOMString value;
readonly attribute unsigned long textLength;
@@ -1233,28 +925,27 @@ interface HTMLTextAreaElement : HTMLElement {
readonly attribute ValidityState validity;
readonly attribute DOMString validationMessage;
boolean checkValidity();
+ boolean reportValidity();
void setCustomValidity(DOMString error);
readonly attribute NodeList labels;
void select();
- attribute unsigned long selectionStart;
- attribute unsigned long selectionEnd;
- attribute DOMString selectionDirection;
-
+ attribute unsigned long selectionStart;
+ attribute unsigned long selectionEnd;
+ attribute DOMString selectionDirection;
void setRangeText(DOMString replacement);
- void setRangeText(DOMString replacement, unsigned long start, unsigned long end, optional SelectionMode selectionMode);
-
+ void setRangeText(DOMString replacement, unsigned long start, unsigned long end, optional SelectionMode selectionMode = "preserve");
void setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction);
};
interface HTMLKeygenElement : HTMLElement {
- attribute boolean autofocus;
- attribute DOMString challenge;
- attribute boolean disabled;
+ attribute boolean autofocus;
+ attribute DOMString challenge;
+ attribute boolean disabled;
readonly attribute HTMLFormElement? form;
- attribute DOMString keytype;
- attribute DOMString name;
+ attribute DOMString keytype;
+ attribute DOMString name;
readonly attribute DOMString type;
@@ -1262,6 +953,7 @@ interface HTMLKeygenElement : HTMLElement {
readonly attribute ValidityState validity;
readonly attribute DOMString validationMessage;
boolean checkValidity();
+ boolean reportValidity();
void setCustomValidity(DOMString error);
readonly attribute NodeList labels;
@@ -1270,85 +962,453 @@ interface HTMLKeygenElement : HTMLElement {
interface HTMLOutputElement : HTMLElement {
[PutForwards=value] readonly attribute DOMSettableTokenList htmlFor;
readonly attribute HTMLFormElement? form;
- attribute DOMString name;
+ attribute DOMString name;
readonly attribute DOMString type;
- attribute DOMString defaultValue;
- attribute DOMString value;
+ attribute DOMString defaultValue;
+ attribute DOMString value;
readonly attribute boolean willValidate;
readonly attribute ValidityState validity;
readonly attribute DOMString validationMessage;
boolean checkValidity();
+ boolean reportValidity();
void setCustomValidity(DOMString error);
readonly attribute NodeList labels;
};
interface HTMLProgressElement : HTMLElement {
- attribute double value;
- attribute double max;
+ attribute double value;
+ attribute double max;
readonly attribute double position;
readonly attribute NodeList labels;
};
interface HTMLMeterElement : HTMLElement {
- attribute double value;
- attribute double min;
- attribute double max;
- attribute double low;
- attribute double high;
- attribute double optimum;
+ attribute double value;
+ attribute double min;
+ attribute double max;
+ attribute double low;
+ attribute double high;
+ attribute double optimum;
readonly attribute NodeList labels;
};
+interface HTMLFieldSetElement : HTMLElement {
+ attribute boolean disabled;
+ readonly attribute HTMLFormElement? form;
+ attribute DOMString name;
+
+ readonly attribute DOMString type;
+
+ readonly attribute HTMLFormControlsCollection elements;
+
+ readonly attribute boolean willValidate;
+ [SameObject] readonly attribute ValidityState validity;
+ readonly attribute DOMString validationMessage;
+ boolean checkValidity();
+ boolean reportValidity();
+ void setCustomValidity(DOMString error);
+};
+
+interface HTMLLegendElement : HTMLElement {
+ readonly attribute HTMLFormElement? form;
+
+ // also has obsolete members
+};
+
+enum AutocompleteErrorReason { "" /* empty string */, "cancel", "disabled", "invalid" };
+
+[Constructor(DOMString type, optional AutocompleteErrorEventInit eventInitDict)]
+interface AutocompleteErrorEvent : Event {
+ readonly attribute AutocompleteErrorReason reason;
+};
+
+dictionary AutocompleteErrorEventInit : EventInit {
+ AutocompleteErrorReason reason;
+};
+
+enum SelectionMode {
+ "select",
+ "start",
+ "end",
+ "preserve", // default
+};
interface ValidityState {
readonly attribute boolean valueMissing;
readonly attribute boolean typeMismatch;
readonly attribute boolean patternMismatch;
readonly attribute boolean tooLong;
+ readonly attribute boolean tooShort;
readonly attribute boolean rangeUnderflow;
readonly attribute boolean rangeOverflow;
readonly attribute boolean stepMismatch;
+ readonly attribute boolean badInput;
readonly attribute boolean customError;
readonly attribute boolean valid;
};
interface HTMLDetailsElement : HTMLElement {
- attribute boolean open;
+ attribute boolean open;
+};
+
+interface HTMLMenuElement : HTMLElement {
+ attribute DOMString type;
+ attribute DOMString label;
+
+ // also has obsolete members
};
-interface HTMLCommandElement : HTMLElement {
- attribute DOMString type;
- attribute DOMString label;
- attribute DOMString icon;
- attribute boolean disabled;
- attribute boolean checked;
- attribute DOMString radiogroup;
+interface HTMLMenuItemElement : HTMLElement {
+ attribute DOMString type;
+ attribute DOMString label;
+ attribute DOMString icon;
+ attribute boolean disabled;
+ attribute boolean checked;
+ attribute DOMString radiogroup;
+ attribute boolean default;
readonly attribute HTMLElement? command;
};
-interface HTMLMenuElement : HTMLElement {
- attribute DOMString type;
- attribute DOMString label;
+[Constructor(DOMString type, optional RelatedEventInit eventInitDict)]
+interface RelatedEvent : Event {
+ readonly attribute EventTarget? relatedTarget;
+};
+
+dictionary RelatedEventInit : EventInit {
+ EventTarget? relatedTarget;
};
interface HTMLDialogElement : HTMLElement {
- attribute boolean open;
- attribute DOMString returnValue;
+ attribute boolean open;
+ attribute DOMString returnValue;
void show(optional (MouseEvent or Element) anchor);
void showModal(optional (MouseEvent or Element) anchor);
void close(optional DOMString returnValue);
};
-[NamedPropertiesObject]
-interface Window : EventTarget {
+interface HTMLScriptElement : HTMLElement {
+ attribute DOMString src;
+ attribute DOMString type;
+ attribute DOMString charset;
+ attribute boolean async;
+ attribute boolean defer;
+ attribute DOMString? crossOrigin;
+ attribute DOMString text;
+
+ // also has obsolete members
+};
+
+interface HTMLTemplateElement : HTMLElement {
+ readonly attribute DocumentFragment content;
+};
+
+typedef (CanvasRenderingContext2D or WebGLRenderingContext) RenderingContext;
+
+interface HTMLCanvasElement : HTMLElement {
+ attribute unsigned long width;
+ attribute unsigned long height;
+
+ RenderingContext? getContext(DOMString contextId, any... arguments);
+ boolean probablySupportsContext(DOMString contextId, any... arguments);
+
+ void setContext(RenderingContext context);
+ CanvasProxy transferControlToProxy();
+
+ DOMString toDataURL(optional DOMString type, any... arguments);
+ void toBlob(FileCallback? _callback, optional DOMString type, any... arguments);
+};
+
+[Exposed=(Window,Worker)]
+interface CanvasProxy {
+ void setContext(RenderingContext context);
+};
+// CanvasProxy implements Transferable;
+
+typedef (HTMLImageElement or
+ HTMLVideoElement or
+ HTMLCanvasElement or
+ CanvasRenderingContext2D or
+ ImageBitmap) CanvasImageSource;
+
+enum CanvasFillRule { "nonzero", "evenodd" };
+
+dictionary CanvasRenderingContext2DSettings {
+ boolean alpha = true;
+};
+
+[Constructor(),
+ Constructor(unsigned long width, unsigned long height),
+ Exposed=(Window,Worker)]
+interface CanvasRenderingContext2D {
+
+ // back-reference to the canvas
+ readonly attribute HTMLCanvasElement canvas;
+
+ // canvas dimensions
+ attribute unsigned long width;
+ attribute unsigned long height;
+
+ // for contexts that aren't directly fixed to a specific canvas
+ void commit(); // push the image to the output bitmap
+
+ // state
+ void save(); // push state on state stack
+ void restore(); // pop state stack and restore state
+
+ // transformations (default transform is the identity matrix)
+ attribute SVGMatrix currentTransform;
+ void scale(unrestricted double x, unrestricted double y);
+ void rotate(unrestricted double angle);
+ void translate(unrestricted double x, unrestricted double y);
+ void transform(unrestricted double a, unrestricted double b, unrestricted double c, unrestricted double d, unrestricted double e, unrestricted double f);
+ void setTransform(unrestricted double a, unrestricted double b, unrestricted double c, unrestricted double d, unrestricted double e, unrestricted double f);
+ void resetTransform();
+
+ // compositing
+ attribute unrestricted double globalAlpha; // (default 1.0)
+ attribute DOMString globalCompositeOperation; // (default source-over)
+
+ // image smoothing
+ attribute boolean imageSmoothingEnabled; // (default true)
+
+ // colours and styles (see also the CanvasDrawingStyles interface)
+ attribute (DOMString or CanvasGradient or CanvasPattern) strokeStyle; // (default black)
+ attribute (DOMString or CanvasGradient or CanvasPattern) fillStyle; // (default black)
+ CanvasGradient createLinearGradient(double x0, double y0, double x1, double y1);
+ CanvasGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1);
+ CanvasPattern createPattern(CanvasImageSource image, [TreatNullAs=EmptyString] DOMString repetition);
+
+ // shadows
+ attribute unrestricted double shadowOffsetX; // (default 0)
+ attribute unrestricted double shadowOffsetY; // (default 0)
+ attribute unrestricted double shadowBlur; // (default 0)
+ attribute DOMString shadowColor; // (default transparent black)
+
+ // rects
+ void clearRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
+ void fillRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
+ void strokeRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
+
+ // path API (see also CanvasPathMethods)
+ void beginPath();
+ void fill(optional CanvasFillRule fillRule = "nonzero");
+ void fill(Path2D path, optional CanvasFillRule fillRule = "nonzero");
+ void stroke();
+ void stroke(Path2D path);
+ void drawFocusIfNeeded(Element element);
+ void drawFocusIfNeeded(Path2D path, Element element);
+ void scrollPathIntoView();
+ void scrollPathIntoView(Path2D path);
+ void clip(optional CanvasFillRule fillRule = "nonzero");
+ void clip(Path2D path, optional CanvasFillRule fillRule = "nonzero");
+ void resetClip();
+ boolean isPointInPath(unrestricted double x, unrestricted double y, optional CanvasFillRule fillRule = "nonzero");
+ boolean isPointInPath(Path2D path, unrestricted double x, unrestricted double y, optional CanvasFillRule fillRule = "nonzero");
+ boolean isPointInStroke(unrestricted double x, unrestricted double y);
+ boolean isPointInStroke(Path2D path, unrestricted double x, unrestricted double y);
+
+ // text (see also the CanvasDrawingStyles interface)
+ void fillText(DOMString text, unrestricted double x, unrestricted double y, optional unrestricted double maxWidth);
+ void strokeText(DOMString text, unrestricted double x, unrestricted double y, optional unrestricted double maxWidth);
+ TextMetrics measureText(DOMString text);
+
+ // drawing images
+ void drawImage(CanvasImageSource image, unrestricted double dx, unrestricted double dy);
+ void drawImage(CanvasImageSource image, unrestricted double dx, unrestricted double dy, unrestricted double dw, unrestricted double dh);
+ void drawImage(CanvasImageSource image, unrestricted double sx, unrestricted double sy, unrestricted double sw, unrestricted double sh, unrestricted double dx, unrestricted double dy, unrestricted double dw, unrestricted double dh);
+
+ // hit regions
+ void addHitRegion(optional HitRegionOptions options);
+ void removeHitRegion(DOMString id);
+ void clearHitRegions();
+
+ // pixel manipulation
+ ImageData createImageData(double sw, double sh);
+ ImageData createImageData(ImageData imagedata);
+ ImageData getImageData(double sx, double sy, double sw, double sh);
+ void putImageData(ImageData imagedata, double dx, double dy);
+ void putImageData(ImageData imagedata, double dx, double dy, double dirtyX, double dirtyY, double dirtyWidth, double dirtyHeight);
+};
+CanvasRenderingContext2D implements CanvasDrawingStyles;
+CanvasRenderingContext2D implements CanvasPathMethods;
+
+[NoInterfaceObject, Exposed=(Window,Worker)]
+interface CanvasDrawingStyles {
+ // line caps/joins
+ attribute unrestricted double lineWidth; // (default 1)
+ attribute DOMString lineCap; // "butt", "round", "square" (default "butt")
+ attribute DOMString lineJoin; // "round", "bevel", "miter" (default "miter")
+ attribute unrestricted double miterLimit; // (default 10)
+
+ // dashed lines
+ void setLineDash(sequence<unrestricted double> segments); // default empty
+ sequence<unrestricted double> getLineDash();
+ attribute unrestricted double lineDashOffset;
+
+ // text
+ attribute DOMString font; // (default 10px sans-serif)
+ attribute DOMString textAlign; // "start", "end", "left", "right", "center" (default: "start")
+ attribute DOMString textBaseline; // "top", "hanging", "middle", "alphabetic", "ideographic", "bottom" (default: "alphabetic")
+ attribute DOMString direction; // "ltr", "rtl", "inherit" (default: "inherit")
+};
+
+[NoInterfaceObject, Exposed=(Window,Worker)]
+interface CanvasPathMethods {
+ // shared path API methods
+ void closePath();
+ void moveTo(unrestricted double x, unrestricted double y);
+ void lineTo(unrestricted double x, unrestricted double y);
+ void quadraticCurveTo(unrestricted double cpx, unrestricted double cpy, unrestricted double x, unrestricted double y);
+ void bezierCurveTo(unrestricted double cp1x, unrestricted double cp1y, unrestricted double cp2x, unrestricted double cp2y, unrestricted double x, unrestricted double y);
+ void arcTo(unrestricted double x1, unrestricted double y1, unrestricted double x2, unrestricted double y2, unrestricted double radius);
+ void arcTo(unrestricted double x1, unrestricted double y1, unrestricted double x2, unrestricted double y2, unrestricted double radiusX, unrestricted double radiusY, unrestricted double rotation);
+ void rect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
+ void arc(unrestricted double x, unrestricted double y, unrestricted double radius, unrestricted double startAngle, unrestricted double endAngle, optional boolean anticlockwise = false);
+ void ellipse(unrestricted double x, unrestricted double y, unrestricted double radiusX, unrestricted double radiusY, unrestricted double rotation, unrestricted double startAngle, unrestricted double endAngle, optional boolean anticlockwise = false);
+};
+
+[Exposed=(Window,Worker)]
+interface CanvasGradient {
+ // opaque object
+ void addColorStop(double offset, DOMString color);
+};
+
+[Exposed=(Window,Worker)]
+interface CanvasPattern {
+ // opaque object
+ void setTransform(SVGMatrix transform);
+};
+
+[Exposed=(Window,Worker)]
+interface TextMetrics {
+ // x-direction
+ readonly attribute double width; // advance width
+ readonly attribute double actualBoundingBoxLeft;
+ readonly attribute double actualBoundingBoxRight;
+
+ // y-direction
+ readonly attribute double fontBoundingBoxAscent;
+ readonly attribute double fontBoundingBoxDescent;
+ readonly attribute double actualBoundingBoxAscent;
+ readonly attribute double actualBoundingBoxDescent;
+ readonly attribute double emHeightAscent;
+ readonly attribute double emHeightDescent;
+ readonly attribute double hangingBaseline;
+ readonly attribute double alphabeticBaseline;
+ readonly attribute double ideographicBaseline;
+};
+
+dictionary HitRegionOptions {
+ Path2D? path = null;
+ CanvasFillRule fillRule = "nonzero";
+ DOMString id = "";
+ DOMString? parentID = null;
+ DOMString cursor = "inherit";
+ // for control-backed regions:
+ Element? control = null;
+ // for unbacked regions:
+ DOMString? label = null;
+ DOMString? role = null;
+};
+
+[Constructor(unsigned long sw, unsigned long sh),
+ Constructor(Uint8ClampedArray data, unsigned long sw, optional unsigned long sh),
+ Exposed=(Window,Worker)]
+interface ImageData {
+ readonly attribute unsigned long width;
+ readonly attribute unsigned long height;
+ readonly attribute Uint8ClampedArray data;
+};
+
+[Constructor(optional Element scope), Exposed=(Window,Worker)]
+interface DrawingStyle { };
+DrawingStyle implements CanvasDrawingStyles;
+
+[Constructor,
+ Constructor(Path2D path),
+ Constructor(Path2D[] paths, optional CanvasFillRule fillRule = "nonzero"),
+ Constructor(DOMString d), Exposed=(Window,Worker)]
+interface Path2D {
+ void addPath(Path2D path, optional SVGMatrix? transformation = null);
+ void addPathByStrokingPath(Path2D path, CanvasDrawingStyles styles, optional SVGMatrix? transformation = null);
+ void addText(DOMString text, CanvasDrawingStyles styles, SVGMatrix? transformation, unrestricted double x, unrestricted double y, optional unrestricted double maxWidth);
+ void addPathByStrokingText(DOMString text, CanvasDrawingStyles styles, SVGMatrix? transformation, unrestricted double x, unrestricted double y, optional unrestricted double maxWidth);
+ void addText(DOMString text, CanvasDrawingStyles styles, SVGMatrix? transformation, Path2D path, optional unrestricted double maxWidth);
+ void addPathByStrokingText(DOMString text, CanvasDrawingStyles styles, SVGMatrix? transformation, Path2D path, optional unrestricted double maxWidth);
+};
+Path2D implements CanvasPathMethods;
+
+partial interface MouseEvent {
+ readonly attribute DOMString? region;
+};
+
+partial dictionary MouseEventInit {
+ DOMString? region;
+};
+
+partial interface Touch {
+ readonly attribute DOMString? region;
+};
+
+[NoInterfaceObject]
+interface ElementContentEditable {
+ attribute DOMString contentEditable;
+ readonly attribute boolean isContentEditable;
+};
+
+interface DataTransfer {
+ attribute DOMString dropEffect;
+ attribute DOMString effectAllowed;
+
+ [SameObject] readonly attribute DataTransferItemList items;
+
+ void setDragImage(Element image, long x, long y);
+
+ /* old interface */
+ [SameObject] readonly attribute DOMString[] types;
+ DOMString getData(DOMString format);
+ void setData(DOMString format, DOMString data);
+ void clearData(optional DOMString format);
+ [SameObject] readonly attribute FileList files;
+};
+
+interface DataTransferItemList {
+ readonly attribute unsigned long length;
+ getter DataTransferItem (unsigned long index);
+ DataTransferItem? add(DOMString data, DOMString type);
+ DataTransferItem? add(File data);
+ void remove(unsigned long index);
+ void clear();
+};
+
+interface DataTransferItem {
+ readonly attribute DOMString kind;
+ readonly attribute DOMString type;
+ void getAsString(FunctionStringCallback? _callback);
+ File? getAsFile();
+};
+
+callback FunctionStringCallback = void (DOMString data);
+
+[Constructor(DOMString type, optional DragEventInit eventInitDict)]
+interface DragEvent : MouseEvent {
+ readonly attribute DataTransfer? dataTransfer;
+};
+
+dictionary DragEventInit : MouseEventInit {
+ DataTransfer? dataTransfer;
+};
+
+[PrimaryGlobal]
+/*sealed*/ interface Window : EventTarget {
// the current browsing context
[Unforgeable] readonly attribute WindowProxy window;
[Replaceable] readonly attribute WindowProxy self;
[Unforgeable] readonly attribute Document document;
- attribute DOMString name;
+ attribute DOMString name;
[PutForwards=href, Unforgeable] readonly attribute Location location;
readonly attribute History history;
[Replaceable] readonly attribute BarProp locationbar;
@@ -1357,8 +1417,9 @@ interface Window : EventTarget {
[Replaceable] readonly attribute BarProp scrollbars;
[Replaceable] readonly attribute BarProp statusbar;
[Replaceable] readonly attribute BarProp toolbar;
- attribute DOMString status;
+ attribute DOMString status;
void close();
+ readonly attribute boolean closed;
void stop();
void focus();
void blur();
@@ -1367,102 +1428,38 @@ interface Window : EventTarget {
[Replaceable] readonly attribute WindowProxy frames;
[Replaceable] readonly attribute unsigned long length;
[Unforgeable] readonly attribute WindowProxy top;
- attribute WindowProxy? opener;
- readonly attribute WindowProxy parent;
+ attribute any opener;
+ [Replaceable] readonly attribute WindowProxy parent;
readonly attribute Element? frameElement;
- WindowProxy open(optional DOMString url, optional DOMString target, optional DOMString features, optional boolean replace);
+ WindowProxy open(optional DOMString url = "about:blank", optional DOMString target = "_blank", [TreatNullAs=EmptyString] optional DOMString features = "", optional boolean replace = false);
getter WindowProxy (unsigned long index);
getter object (DOMString name);
// the user agent
readonly attribute Navigator navigator;
-
- readonly attribute External external;
+ [Replaceable, SameObject] readonly attribute External external;
readonly attribute ApplicationCache applicationCache;
// user prompts
+ void alert();
void alert(DOMString message);
- boolean confirm(DOMString message);
- DOMString? prompt(DOMString message, optional DOMString default);
+ boolean confirm(optional DOMString message = "");
+ DOMString? prompt(optional DOMString message = "", optional DOMString default = "");
void print();
- any showModalDialog(DOMString url, optional any argument);
+ any showModalDialog(DOMString url, optional any argument); // deprecated
+
+ long requestAnimationFrame(FrameRequestCallback callback);
+ void cancelAnimationFrame(long handle);
- // cross-document messaging
void postMessage(any message, DOMString targetOrigin, optional sequence<Transferable> transfer);
- // event handler IDL attributes
- attribute EventHandler onabort;
- attribute EventHandler onafterprint;
- attribute EventHandler onbeforeprint;
- attribute EventHandler onbeforeunload;
- attribute EventHandler onblur;
- attribute EventHandler oncancel;
- attribute EventHandler oncanplay;
- attribute EventHandler oncanplaythrough;
- attribute EventHandler onchange;
- attribute EventHandler onclick;
- attribute EventHandler onclose;
- attribute EventHandler oncontextmenu;
- attribute EventHandler oncuechange;
- attribute EventHandler ondblclick;
- attribute EventHandler ondrag;
- attribute EventHandler ondragend;
- attribute EventHandler ondragenter;
- attribute EventHandler ondragleave;
- attribute EventHandler ondragover;
- attribute EventHandler ondragstart;
- attribute EventHandler ondrop;
- attribute EventHandler ondurationchange;
- attribute EventHandler onemptied;
- attribute EventHandler onended;
- attribute OnErrorEventHandler onerror;
- attribute EventHandler onfocus;
- attribute EventHandler onhashchange;
- attribute EventHandler oninput;
- attribute EventHandler oninvalid;
- attribute EventHandler onkeydown;
- attribute EventHandler onkeypress;
- attribute EventHandler onkeyup;
- attribute EventHandler onload;
- attribute EventHandler onloadeddata;
- attribute EventHandler onloadedmetadata;
- attribute EventHandler onloadstart;
- attribute EventHandler onmessage;
- attribute EventHandler onmousedown;
- attribute EventHandler onmousemove;
- attribute EventHandler onmouseout;
- attribute EventHandler onmouseover;
- attribute EventHandler onmouseup;
- attribute EventHandler onmousewheel;
- attribute EventHandler onoffline;
- attribute EventHandler ononline;
- attribute EventHandler onpause;
- attribute EventHandler onplay;
- attribute EventHandler onplaying;
- attribute EventHandler onpagehide;
- attribute EventHandler onpageshow;
- attribute EventHandler onpopstate;
- attribute EventHandler onprogress;
- attribute EventHandler onratechange;
- attribute EventHandler onreset;
- attribute EventHandler onresize;
- attribute EventHandler onscroll;
- attribute EventHandler onseeked;
- attribute EventHandler onseeking;
- attribute EventHandler onselect;
- attribute EventHandler onshow;
- attribute EventHandler onstalled;
- attribute EventHandler onstorage;
- attribute EventHandler onsubmit;
- attribute EventHandler onsuspend;
- attribute EventHandler ontimeupdate;
- attribute EventHandler onunload;
- attribute EventHandler onvolumechange;
- attribute EventHandler onwaiting;
+ // also has obsolete members
};
+Window implements GlobalEventHandlers;
+Window implements WindowEventHandlers;
interface BarProp {
- attribute boolean visible;
+ attribute boolean visible;
};
interface History {
@@ -1471,27 +1468,20 @@ interface History {
void go(optional long delta);
void back();
void forward();
- void pushState(any data, DOMString title, optional DOMString url);
- void replaceState(any data, DOMString title, optional DOMString url);
+ void pushState(any data, DOMString title, optional DOMString? url = null);
+ void replaceState(any data, DOMString title, optional DOMString? url = null);
};
-interface Location {
- stringifier attribute DOMString href;
+[Unforgeable] interface Location {
void assign(DOMString url);
void replace(DOMString url);
void reload();
- // URL decomposition IDL attributes
- attribute DOMString protocol;
- attribute DOMString host;
- attribute DOMString hostname;
- attribute DOMString port;
- attribute DOMString pathname;
- attribute DOMString search;
- attribute DOMString hash;
+ [SameObject] readonly attribute DOMString[] ancestorOrigins;
};
+Location implements URLUtils;
-[Constructor(DOMString type, optional PopStateEventInit eventInitDict)]
+[Constructor(DOMString type, optional PopStateEventInit eventInitDict), Exposed=(Window,Worker)]
interface PopStateEvent : Event {
readonly attribute any state;
};
@@ -1500,7 +1490,7 @@ dictionary PopStateEventInit : EventInit {
any state;
};
-[Constructor(DOMString type, optional HashChangeEventInit eventInitDict)]
+[Constructor(DOMString type, optional HashChangeEventInit eventInitDict), Exposed=(Window,Worker)]
interface HashChangeEvent : Event {
readonly attribute DOMString oldURL;
readonly attribute DOMString newURL;
@@ -1511,7 +1501,7 @@ dictionary HashChangeEventInit : EventInit {
DOMString newURL;
};
-[Constructor(DOMString type, optional PageTransitionEventInit eventInitDict)]
+[Constructor(DOMString type, optional PageTransitionEventInit eventInitDict), Exposed=(Window,Worker)]
interface PageTransitionEvent : Event {
readonly attribute boolean persisted;
};
@@ -1521,9 +1511,10 @@ dictionary PageTransitionEventInit : EventInit {
};
interface BeforeUnloadEvent : Event {
- attribute DOMString returnValue;
+ attribute DOMString returnValue;
};
+[Exposed=(Window,SharedWorker)]
interface ApplicationCache : EventTarget {
// update status
@@ -1541,66 +1532,184 @@ interface ApplicationCache : EventTarget {
void swapCache();
// events
- attribute EventHandler onchecking;
- attribute EventHandler onerror;
- attribute EventHandler onnoupdate;
- attribute EventHandler ondownloading;
- attribute EventHandler onprogress;
- attribute EventHandler onupdateready;
- attribute EventHandler oncached;
- attribute EventHandler onobsolete;
+ attribute EventHandler onchecking;
+ attribute EventHandler onerror;
+ attribute EventHandler onnoupdate;
+ attribute EventHandler ondownloading;
+ attribute EventHandler onprogress;
+ attribute EventHandler onupdateready;
+ attribute EventHandler oncached;
+ attribute EventHandler onobsolete;
};
-[NoInterfaceObject]
+[NoInterfaceObject, Exposed=(Window,Worker)]
interface NavigatorOnLine {
readonly attribute boolean onLine;
};
-[TreatNonCallableAsNull]
+[Constructor(DOMString type, optional ErrorEventInit eventInitDict), Exposed=(Window,Worker)]
+interface ErrorEvent : Event {
+ readonly attribute DOMString message;
+ readonly attribute DOMString filename;
+ readonly attribute unsigned long lineno;
+ readonly attribute unsigned long colno;
+ readonly attribute any error;
+};
+
+dictionary ErrorEventInit : EventInit {
+ DOMString message;
+ DOMString filename;
+ unsigned long lineno;
+ unsigned long colno;
+ any error;
+};
+
+[TreatNonObjectAsNull]
callback EventHandlerNonNull = any (Event event);
typedef EventHandlerNonNull? EventHandler;
-[TreatNonCallableAsNull]
-callback OnErrorEventHandlerNonNull = any ((Event or DOMString) event, DOMString source, unsigned long lineno, unsigned long column);
+[TreatNonObjectAsNull]
+callback OnErrorEventHandlerNonNull = any ((Event or DOMString) event, optional DOMString source, optional unsigned long lineno, optional unsigned long column, optional any error);
typedef OnErrorEventHandlerNonNull? OnErrorEventHandler;
+[TreatNonObjectAsNull]
+callback OnBeforeUnloadEventHandlerNonNull = DOMString? (Event event);
+typedef OnBeforeUnloadEventHandlerNonNull? OnBeforeUnloadEventHandler;
+
[NoInterfaceObject]
+interface GlobalEventHandlers {
+ attribute EventHandler onabort;
+ attribute EventHandler onautocomplete;
+ attribute EventHandler onautocompleteerror;
+ attribute EventHandler onblur;
+ attribute EventHandler oncancel;
+ attribute EventHandler oncanplay;
+ attribute EventHandler oncanplaythrough;
+ attribute EventHandler onchange;
+ attribute EventHandler onclick;
+ attribute EventHandler onclose;
+ attribute EventHandler oncontextmenu;
+ attribute EventHandler oncuechange;
+ attribute EventHandler ondblclick;
+ attribute EventHandler ondrag;
+ attribute EventHandler ondragend;
+ attribute EventHandler ondragenter;
+ attribute EventHandler ondragexit;
+ attribute EventHandler ondragleave;
+ attribute EventHandler ondragover;
+ attribute EventHandler ondragstart;
+ attribute EventHandler ondrop;
+ attribute EventHandler ondurationchange;
+ attribute EventHandler onemptied;
+ attribute EventHandler onended;
+ attribute OnErrorEventHandler onerror;
+ attribute EventHandler onfocus;
+ attribute EventHandler oninput;
+ attribute EventHandler oninvalid;
+ attribute EventHandler onkeydown;
+ attribute EventHandler onkeypress;
+ attribute EventHandler onkeyup;
+ attribute EventHandler onload;
+ attribute EventHandler onloadeddata;
+ attribute EventHandler onloadedmetadata;
+ attribute EventHandler onloadstart;
+ attribute EventHandler onmousedown;
+ [LenientThis] attribute EventHandler onmouseenter;
+ [LenientThis] attribute EventHandler onmouseleave;
+ attribute EventHandler onmousemove;
+ attribute EventHandler onmouseout;
+ attribute EventHandler onmouseover;
+ attribute EventHandler onmouseup;
+ attribute EventHandler onmousewheel;
+ attribute EventHandler onpause;
+ attribute EventHandler onplay;
+ attribute EventHandler onplaying;
+ attribute EventHandler onprogress;
+ attribute EventHandler onratechange;
+ attribute EventHandler onreset;
+ attribute EventHandler onresize;
+ attribute EventHandler onscroll;
+ attribute EventHandler onseeked;
+ attribute EventHandler onseeking;
+ attribute EventHandler onselect;
+ attribute EventHandler onshow;
+ attribute EventHandler onsort;
+ attribute EventHandler onstalled;
+ attribute EventHandler onsubmit;
+ attribute EventHandler onsuspend;
+ attribute EventHandler ontimeupdate;
+ attribute EventHandler ontoggle;
+ attribute EventHandler onvolumechange;
+ attribute EventHandler onwaiting;
+};
+
+[NoInterfaceObject]
+interface WindowEventHandlers {
+ attribute EventHandler onafterprint;
+ attribute EventHandler onbeforeprint;
+ attribute OnBeforeUnloadEventHandler onbeforeunload;
+ attribute EventHandler onhashchange;
+ attribute EventHandler onlanguagechange;
+ attribute EventHandler onmessage;
+ attribute EventHandler onoffline;
+ attribute EventHandler ononline;
+ attribute EventHandler onpagehide;
+ attribute EventHandler onpageshow;
+ attribute EventHandler onpopstate;
+ attribute EventHandler onstorage;
+ attribute EventHandler onunload;
+};
+
+[NoInterfaceObject, Exposed=(Window,Worker)]
interface WindowBase64 {
DOMString btoa(DOMString btoa);
DOMString atob(DOMString atob);
};
Window implements WindowBase64;
-[NoInterfaceObject]
+[NoInterfaceObject, Exposed=(Window,Worker)]
interface WindowTimers {
- long setTimeout(Function handler, optional long timeout, any... arguments);
- long setTimeout(DOMString handler, optional long timeout, any... arguments);
- void clearTimeout(long handle);
- long setInterval(Function handler, optional long timeout, any... arguments);
- long setInterval(DOMString handler, optional long timeout, any... arguments);
- void clearInterval(long handle);
+ long setTimeout(Function handler, optional long timeout = 0, any... arguments);
+ long setTimeout(DOMString handler, optional long timeout = 0, any... arguments);
+ void clearTimeout(optional long handle = 0);
+ long setInterval(Function handler, optional long timeout = 0, any... arguments);
+ long setInterval(DOMString handler, optional long timeout = 0, any... arguments);
+ void clearInterval(optional long handle = 0);
};
Window implements WindowTimers;
-[NoInterfaceObject] interface WindowModal {
+[NoInterfaceObject]
+interface WindowModal {
readonly attribute any dialogArguments;
- attribute DOMString returnValue;
+ attribute any returnValue;
};
interface Navigator {
// objects implementing this interface also implement the interfaces given below
};
Navigator implements NavigatorID;
+Navigator implements NavigatorLanguage;
Navigator implements NavigatorOnLine;
Navigator implements NavigatorContentUtils;
Navigator implements NavigatorStorageUtils;
+Navigator implements NavigatorPlugins;
-[NoInterfaceObject]
+[NoInterfaceObject, Exposed=(Window,Worker)]
interface NavigatorID {
+ readonly attribute DOMString appCodeName; // constant "Mozilla"
readonly attribute DOMString appName;
readonly attribute DOMString appVersion;
readonly attribute DOMString platform;
+ readonly attribute DOMString product; // constant "Gecko"
+ boolean taintEnabled(); // constant false
readonly attribute DOMString userAgent;
+ readonly attribute DOMString vendorSub;
+};
+
+[NoInterfaceObject, Exposed=(Window,Worker)]
+interface NavigatorLanguage {
+ readonly attribute DOMString? language;
+ readonly attribute DOMString[] languages;
};
[NoInterfaceObject]
@@ -1616,162 +1725,93 @@ interface NavigatorContentUtils {
[NoInterfaceObject]
interface NavigatorStorageUtils {
+ readonly attribute boolean cookieEnabled;
void yieldForStorageUpdates();
};
-interface External {
- void AddSearchProvider(DOMString engineURL);
- unsigned long IsSearchProviderInstalled(DOMString engineURL);
-};
-
-interface DataTransfer {
- attribute DOMString dropEffect;
- attribute DOMString effectAllowed;
-
- readonly attribute DataTransferItemList items;
-
- void setDragImage(Element image, long x, long y);
-
- /* old interface */
- readonly attribute DOMString[] types;
- DOMString getData(DOMString format);
- void setData(DOMString format, DOMString data);
- void clearData(optional DOMString format);
- readonly attribute FileList files;
+[NoInterfaceObject]
+interface NavigatorPlugins {
+ [SameObject] readonly attribute PluginArray plugins;
+ [SameObject] readonly attribute MimeTypeArray mimeTypes;
+ readonly attribute boolean javaEnabled;
};
-interface DataTransferItemList {
+interface PluginArray {
+ void refresh(optional boolean reload = false);
readonly attribute unsigned long length;
- getter DataTransferItem (unsigned long index);
- deleter void (unsigned long index);
- void clear();
-
- DataTransferItem? add(DOMString data, DOMString type);
- DataTransferItem? add(File data);
+ getter Plugin? item(unsigned long index);
+ getter Plugin? namedItem(DOMString name);
};
-interface DataTransferItem {
- readonly attribute DOMString kind;
- readonly attribute DOMString type;
- void getAsString(FunctionStringCallback? _callback);
-
- File? getAsFile();
-};
-
-[Callback, NoInterfaceObject]
-interface FunctionStringCallback {
- void handleEvent(DOMString data);
-};
-
-[Constructor(DOMString type, optional DragEventInit eventInitDict)]
-interface DragEvent : MouseEvent {
- readonly attribute DataTransfer? dataTransfer;
-};
-
-dictionary DragEventInit : MouseEventInit {
- DataTransfer? dataTransfer;
-};
-
-interface WorkerGlobalScope : EventTarget {
- readonly attribute WorkerGlobalScope self;
- readonly attribute WorkerLocation location;
-
- void close();
- attribute EventHandler onerror;
- attribute EventHandler onoffline;
- attribute EventHandler ononline;
-};
-WorkerGlobalScope implements WorkerUtils;
-
-interface DedicatedWorkerGlobalScope : WorkerGlobalScope {
- void postMessage(any message, optional sequence<Transferable> transfer);
- attribute EventHandler onmessage;
+interface MimeTypeArray {
+ readonly attribute unsigned long length;
+ getter MimeType? item(unsigned long index);
+ getter MimeType? namedItem(DOMString name);
};
-interface SharedWorkerGlobalScope : WorkerGlobalScope {
+interface Plugin {
readonly attribute DOMString name;
- readonly attribute ApplicationCache applicationCache;
- attribute EventHandler onconnect;
-};
-
-[Constructor(DOMString type, optional ErrorEventInit eventInitDict)]
-interface ErrorEvent : Event {
- readonly attribute DOMString message;
+ readonly attribute DOMString description;
readonly attribute DOMString filename;
- readonly attribute unsigned long lineno;
- readonly attribute unsigned long column;
-};
-
-dictionary ErrorEventInit : EventInit {
- DOMString message;
- DOMString filename;
- unsigned long lineno;
- unsigned long column;
-};
-
-[NoInterfaceObject]
-interface AbstractWorker {
- attribute EventHandler onerror;
-
+ readonly attribute unsigned long length;
+ getter MimeType? item(unsigned long index);
+ getter MimeType? namedItem(DOMString name);
};
-[Constructor(DOMString scriptURL)]
-interface Worker : EventTarget {
- void terminate();
-
- void postMessage(any message, optional sequence<Transferable> transfer);
- attribute EventHandler onmessage;
+interface MimeType {
+ readonly attribute DOMString type;
+ readonly attribute DOMString description;
+ readonly attribute DOMString suffixes; // comma-separated
+ readonly attribute Plugin enabledPlugin;
};
-Worker implements AbstractWorker;
-[Constructor(DOMString scriptURL, optional DOMString name)]
-interface SharedWorker : EventTarget {
- readonly attribute MessagePort port;
+interface External {
+ void AddSearchProvider(DOMString engineURL);
+ unsigned long IsSearchProviderInstalled(DOMString engineURL);
};
-SharedWorker implements AbstractWorker;
-[NoInterfaceObject]
-interface WorkerUtils {
- void importScripts(DOMString... urls);
- readonly attribute WorkerNavigator navigator;
+[Exposed=(Window,Worker)]
+interface ImageBitmap {
+ readonly attribute unsigned long width;
+ readonly attribute unsigned long height;
};
-WorkerUtils implements WindowTimers;
-WorkerUtils implements WindowBase64;
-interface WorkerNavigator {};
-WorkerNavigator implements NavigatorID;
-WorkerNavigator implements NavigatorOnLine;
+typedef (HTMLImageElement or
+ HTMLVideoElement or
+ HTMLCanvasElement or
+ Blob or
+ ImageData or
+ CanvasRenderingContext2D or
+ ImageBitmap) ImageBitmapSource;
-interface WorkerLocation {
- // URL decomposition IDL attributes
- stringifier readonly attribute DOMString href;
- readonly attribute DOMString protocol;
- readonly attribute DOMString host;
- readonly attribute DOMString hostname;
- readonly attribute DOMString port;
- readonly attribute DOMString pathname;
- readonly attribute DOMString search;
- readonly attribute DOMString hash;
+[NoInterfaceObject, Exposed=(Window,Worker)]
+interface ImageBitmapFactories {
+ Promise<ImageBitmap> createImageBitmap(ImageBitmapSource image);
+ Promise<ImageBitmap> createImageBitmap(ImageBitmapSource image, long sx, long sy, long sw, long sh);
};
+Window implements ImageBitmapFactories;
+WorkerGlobalScope implements ImageBitmapFactories;
-[Constructor(DOMString type, optional MessageEventInit eventInitDict)]
+[Constructor(DOMString type, optional MessageEventInit eventInitDict), Exposed=(Window,Worker)]
interface MessageEvent : Event {
readonly attribute any data;
readonly attribute DOMString origin;
readonly attribute DOMString lastEventId;
readonly attribute (WindowProxy or MessagePort)? source;
readonly attribute MessagePort[]? ports;
+
+ void initMessageEvent(DOMString typeArg, boolean canBubbleArg, boolean cancelableArg, any dataArg, DOMString originArg, DOMString lastEventIdArg, (WindowProxy or MessagePort) sourceArg, sequence<MessagePort>? portsArg);
};
dictionary MessageEventInit : EventInit {
any data;
DOMString origin;
DOMString lastEventId;
- WindowProxy? source;
- MessagePort[]? ports;
+ (WindowProxy or MessagePort)? source;
+ sequence<MessagePort> ports;
};
-[Constructor(DOMString url, optional EventSourceInit eventSourceInitDict)]
+[Constructor(DOMString url, optional EventSourceInit eventSourceInitDict), Exposed=(Window,Worker)]
interface EventSource : EventTarget {
readonly attribute DOMString url;
readonly attribute boolean withCredentials;
@@ -1783,9 +1823,9 @@ interface EventSource : EventTarget {
readonly attribute unsigned short readyState;
// networking
- attribute EventHandler onopen;
- attribute EventHandler onmessage;
- attribute EventHandler onerror;
+ attribute EventHandler onopen;
+ attribute EventHandler onmessage;
+ attribute EventHandler onerror;
void close();
};
@@ -1794,7 +1834,7 @@ dictionary EventSourceInit {
};
enum BinaryType { "blob", "arraybuffer" };
-[Constructor(DOMString url, optional (DOMString or DOMString[]) protocols)]
+[Constructor(DOMString url, optional (DOMString or DOMString[]) protocols), Exposed=(Window,Worker)]
interface WebSocket : EventTarget {
readonly attribute DOMString url;
@@ -1807,23 +1847,23 @@ interface WebSocket : EventTarget {
readonly attribute unsigned long bufferedAmount;
// networking
- attribute EventHandler onopen;
- attribute EventHandler onerror;
- attribute EventHandler onclose;
+ attribute EventHandler onopen;
+ attribute EventHandler onerror;
+ attribute EventHandler onclose;
readonly attribute DOMString extensions;
readonly attribute DOMString protocol;
- void close([Clamp] optional unsigned short code, optional DOMString reason);
+ void close([Clamp] optional unsigned short code, optional USVString reason);
// messaging
- attribute EventHandler onmessage;
- attribute BinaryType binaryType;
- void send(DOMString data);
+ attribute EventHandler onmessage;
+ attribute BinaryType binaryType;
+ void send(USVString data);
void send(Blob data);
void send(ArrayBuffer data);
void send(ArrayBufferView data);
};
-[Constructor(DOMString type, optional CloseEventInit eventInitDict)]
+[Constructor(DOMString type, optional CloseEventInit eventInitDict), Exposed=(Window,Worker)]
interface CloseEvent : Event {
readonly attribute boolean wasClean;
readonly attribute unsigned short code;
@@ -1836,26 +1876,110 @@ dictionary CloseEventInit : EventInit {
DOMString reason;
};
-[Constructor]
+[Constructor, Exposed=(Window,Worker)]
interface MessageChannel {
readonly attribute MessagePort port1;
readonly attribute MessagePort port2;
};
+[Exposed=(Window,Worker)]
interface MessagePort : EventTarget {
void postMessage(any message, optional sequence<Transferable> transfer);
void start();
void close();
// event handlers
- attribute EventHandler onmessage;
+ attribute EventHandler onmessage;
+};
+// MessagePort implements Transferable;
+
+[Constructor, Exposed=(Window,Worker)]
+interface PortCollection {
+ void add(MessagePort port);
+ void remove(MessagePort port);
+ void clear();
+ void iterate(PortCollectionCallback callback);
+};
+
+callback PortCollectionCallback = void (MessagePort port);
+
+[Constructor(DOMString channel), Exposed=(Window,Worker)]
+interface BroadcastChannel : EventTarget {
+ readonly attribute DOMString name;
+ void postMessage(any message);
+ void close();
+ attribute EventHandler onmessage;
+};
+
+[Exposed=Worker]
+interface WorkerGlobalScope : EventTarget {
+ readonly attribute WorkerGlobalScope self;
+ readonly attribute WorkerLocation location;
+
+ void close();
+ attribute OnErrorEventHandler onerror;
+ attribute EventHandler onlanguagechange;
+ attribute EventHandler onoffline;
+ attribute EventHandler ononline;
+
+ // also has additional members in a partial interface
+};
+
+[Global=(Worker,DedicatedWorker),Exposed=DedicatedWorker]
+/*sealed*/ interface DedicatedWorkerGlobalScope : WorkerGlobalScope {
+ void postMessage(any message, optional sequence<Transferable> transfer);
+ attribute EventHandler onmessage;
+};
+
+[Global=(Worker,SharedWorker),Exposed=SharedWorker]
+/*sealed*/ interface SharedWorkerGlobalScope : WorkerGlobalScope {
+ readonly attribute DOMString name;
+ readonly attribute ApplicationCache applicationCache;
+ attribute EventHandler onconnect;
};
-MessagePort implements Transferable;
+
+[NoInterfaceObject, Exposed=(Window,Worker)]
+interface AbstractWorker {
+ attribute EventHandler onerror;
+};
+
+[Constructor(DOMString scriptURL), Exposed=(Window,Worker)]
+interface Worker : EventTarget {
+ void terminate();
+
+ void postMessage(any message, optional sequence<Transferable> transfer);
+ attribute EventHandler onmessage;
+};
+Worker implements AbstractWorker;
+
+[Constructor(DOMString scriptURL, optional DOMString name), Exposed=(Window,Worker)]
+interface SharedWorker : EventTarget {
+ readonly attribute MessagePort port;
+};
+SharedWorker implements AbstractWorker;
+
+[Exposed=Worker]
+partial interface WorkerGlobalScope { // not obsolete
+ void importScripts(DOMString... urls);
+ readonly attribute WorkerNavigator navigator;
+};
+WorkerGlobalScope implements WindowTimers;
+WorkerGlobalScope implements WindowBase64;
+
+[Exposed=Worker]
+interface WorkerNavigator {};
+WorkerNavigator implements NavigatorID;
+WorkerNavigator implements NavigatorLanguage;
+WorkerNavigator implements NavigatorOnLine;
+
+[Exposed=Worker]
+interface WorkerLocation { };
+WorkerLocation implements URLUtilsReadOnly;
interface Storage {
readonly attribute unsigned long length;
DOMString? key(unsigned long index);
- getter DOMString getItem(DOMString key);
+ getter DOMString? getItem(DOMString key);
setter creator void setItem(DOMString key, DOMString value);
deleter void removeItem(DOMString key);
void clear();
@@ -1891,70 +2015,53 @@ dictionary StorageEventInit : EventInit {
};
interface HTMLAppletElement : HTMLElement {
- attribute DOMString align;
- attribute DOMString alt;
- attribute DOMString archive;
- attribute DOMString code;
- attribute DOMString codeBase;
- attribute DOMString height;
- attribute unsigned long hspace;
- attribute DOMString name;
- attribute DOMString _object; // the underscore is not part of the identifier
- attribute unsigned long vspace;
- attribute DOMString width;
+ attribute DOMString align;
+ attribute DOMString alt;
+ attribute DOMString archive;
+ attribute DOMString code;
+ attribute DOMString codeBase;
+ attribute DOMString height;
+ attribute unsigned long hspace;
+ attribute DOMString name;
+ attribute DOMString _object; // the underscore is not part of the identifier
+ attribute unsigned long vspace;
+ attribute DOMString width;
};
interface HTMLMarqueeElement : HTMLElement {
- attribute DOMString behavior;
- attribute DOMString bgColor;
- attribute DOMString direction;
- attribute DOMString height;
- attribute unsigned long hspace;
- attribute long loop;
- attribute unsigned long scrollAmount;
- attribute unsigned long scrollDelay;
- attribute boolean trueSpeed;
- attribute unsigned long vspace;
- attribute DOMString width;
-
- attribute EventHandler onbounce;
- attribute EventHandler onfinish;
- attribute EventHandler onstart;
+ attribute DOMString behavior;
+ attribute DOMString bgColor;
+ attribute DOMString direction;
+ attribute DOMString height;
+ attribute unsigned long hspace;
+ attribute long loop;
+ attribute unsigned long scrollAmount;
+ attribute unsigned long scrollDelay;
+ attribute boolean trueSpeed;
+ attribute unsigned long vspace;
+ attribute DOMString width;
+
+ attribute EventHandler onbounce;
+ attribute EventHandler onfinish;
+ attribute EventHandler onstart;
void start();
void stop();
};
interface HTMLFrameSetElement : HTMLElement {
- attribute DOMString cols;
- attribute DOMString rows;
- attribute EventHandler onafterprint;
- attribute EventHandler onbeforeprint;
- attribute EventHandler onbeforeunload;
- attribute EventHandler onblur;
- attribute EventHandler onerror;
- attribute EventHandler onfocus;
- attribute EventHandler onhashchange;
- attribute EventHandler onload;
- attribute EventHandler onmessage;
- attribute EventHandler onoffline;
- attribute EventHandler ononline;
- attribute EventHandler onpagehide;
- attribute EventHandler onpageshow;
- attribute EventHandler onpopstate;
- attribute EventHandler onresize;
- attribute EventHandler onscroll;
- attribute EventHandler onstorage;
- attribute EventHandler onunload;
+ attribute DOMString cols;
+ attribute DOMString rows;
};
+HTMLFrameSetElement implements WindowEventHandlers;
interface HTMLFrameElement : HTMLElement {
- attribute DOMString name;
- attribute DOMString scrolling;
- attribute DOMString src;
- attribute DOMString frameBorder;
- attribute DOMString longDesc;
- attribute boolean noResize;
+ attribute DOMString name;
+ attribute DOMString scrolling;
+ attribute DOMString src;
+ attribute DOMString frameBorder;
+ attribute DOMString longDesc;
+ attribute boolean noResize;
readonly attribute Document? contentDocument;
readonly attribute WindowProxy? contentWindow;
@@ -1963,22 +2070,15 @@ interface HTMLFrameElement : HTMLElement {
};
partial interface HTMLAnchorElement {
- attribute DOMString coords;
- attribute DOMString charset;
- attribute DOMString name;
- attribute DOMString rev;
- attribute DOMString shape;
+ attribute DOMString coords;
+ attribute DOMString charset;
+ attribute DOMString name;
+ attribute DOMString rev;
+ attribute DOMString shape;
};
partial interface HTMLAreaElement {
- attribute boolean noHref;
-};
-
-interface HTMLBaseFontElement : HTMLElement {
- attribute DOMString color;
- attribute DOMString face;
- attribute long size;
-
+ attribute boolean noHref;
};
partial interface HTMLBodyElement {
@@ -1987,155 +2087,155 @@ partial interface HTMLBodyElement {
[TreatNullAs=EmptyString] attribute DOMString vLink;
[TreatNullAs=EmptyString] attribute DOMString aLink;
[TreatNullAs=EmptyString] attribute DOMString bgColor;
- attribute DOMString background;
+ attribute DOMString background;
};
partial interface HTMLBRElement {
- attribute DOMString clear;
+ attribute DOMString clear;
};
partial interface HTMLTableCaptionElement {
- attribute DOMString align;
+ attribute DOMString align;
};
partial interface HTMLTableColElement {
- attribute DOMString align;
- attribute DOMString ch;
- attribute DOMString chOff;
- attribute DOMString vAlign;
- attribute DOMString width;
+ attribute DOMString align;
+ attribute DOMString ch;
+ attribute DOMString chOff;
+ attribute DOMString vAlign;
+ attribute DOMString width;
};
interface HTMLDirectoryElement : HTMLElement {
- attribute boolean compact;
+ attribute boolean compact;
};
partial interface HTMLDivElement {
- attribute DOMString align;
+ attribute DOMString align;
};
partial interface HTMLDListElement {
- attribute boolean compact;
+ attribute boolean compact;
};
partial interface HTMLEmbedElement {
- attribute DOMString align;
- attribute DOMString name;
+ attribute DOMString align;
+ attribute DOMString name;
};
interface HTMLFontElement : HTMLElement {
[TreatNullAs=EmptyString] attribute DOMString color;
- attribute DOMString face;
- attribute DOMString size;
-
+ attribute DOMString face;
+ attribute DOMString size;
};
partial interface HTMLHeadingElement {
- attribute DOMString align;
+ attribute DOMString align;
};
partial interface HTMLHRElement {
- attribute DOMString align;
- attribute DOMString color;
- attribute boolean noShade;
- attribute DOMString size;
- attribute DOMString width;
+ attribute DOMString align;
+ attribute DOMString color;
+ attribute boolean noShade;
+ attribute DOMString size;
+ attribute DOMString width;
};
partial interface HTMLHtmlElement {
- attribute DOMString version;
+ attribute DOMString version;
};
partial interface HTMLIFrameElement {
- attribute DOMString align;
- attribute DOMString scrolling;
- attribute DOMString frameBorder;
- attribute DOMString longDesc;
+ attribute DOMString align;
+ attribute DOMString scrolling;
+ attribute DOMString frameBorder;
+ attribute DOMString longDesc;
[TreatNullAs=EmptyString] attribute DOMString marginHeight;
[TreatNullAs=EmptyString] attribute DOMString marginWidth;
};
partial interface HTMLImageElement {
- attribute DOMString name;
- attribute DOMString align;
- attribute unsigned long hspace;
- attribute unsigned long vspace;
- attribute DOMString longDesc;
+ attribute DOMString name;
+ attribute DOMString lowsrc;
+ attribute DOMString align;
+ attribute unsigned long hspace;
+ attribute unsigned long vspace;
+ attribute DOMString longDesc;
[TreatNullAs=EmptyString] attribute DOMString border;
};
partial interface HTMLInputElement {
- attribute DOMString align;
- attribute DOMString useMap;
+ attribute DOMString align;
+ attribute DOMString useMap;
};
partial interface HTMLLegendElement {
- attribute DOMString align;
+ attribute DOMString align;
};
partial interface HTMLLIElement {
- attribute DOMString type;
+ attribute DOMString type;
};
partial interface HTMLLinkElement {
- attribute DOMString charset;
- attribute DOMString rev;
- attribute DOMString target;
+ attribute DOMString charset;
+ attribute DOMString rev;
+ attribute DOMString target;
};
partial interface HTMLMenuElement {
- attribute boolean compact;
+ attribute boolean compact;
};
partial interface HTMLMetaElement {
- attribute DOMString scheme;
+ attribute DOMString scheme;
};
partial interface HTMLObjectElement {
- attribute DOMString align;
- attribute DOMString archive;
- attribute DOMString code;
- attribute boolean declare;
- attribute unsigned long hspace;
- attribute DOMString standby;
- attribute unsigned long vspace;
- attribute DOMString codeBase;
- attribute DOMString codeType;
+ attribute DOMString align;
+ attribute DOMString archive;
+ attribute DOMString code;
+ attribute boolean declare;
+ attribute unsigned long hspace;
+ attribute DOMString standby;
+ attribute unsigned long vspace;
+ attribute DOMString codeBase;
+ attribute DOMString codeType;
[TreatNullAs=EmptyString] attribute DOMString border;
};
partial interface HTMLOListElement {
- attribute boolean compact;
+ attribute boolean compact;
};
partial interface HTMLParagraphElement {
- attribute DOMString align;
+ attribute DOMString align;
};
partial interface HTMLParamElement {
- attribute DOMString type;
- attribute DOMString valueType;
+ attribute DOMString type;
+ attribute DOMString valueType;
};
partial interface HTMLPreElement {
- attribute long width;
+ attribute long width;
};
partial interface HTMLScriptElement {
- attribute DOMString event;
- attribute DOMString htmlFor;
+ attribute DOMString event;
+ attribute DOMString htmlFor;
};
partial interface HTMLTableElement {
- attribute DOMString align;
- attribute DOMString border;
- attribute DOMString frame;
- attribute DOMString rules;
- attribute DOMString summary;
- attribute DOMString width;
+ attribute DOMString align;
+ attribute DOMString border;
+ attribute DOMString frame;
+ attribute DOMString rules;
+ attribute DOMString summary;
+ attribute DOMString width;
[TreatNullAs=EmptyString] attribute DOMString bgColor;
[TreatNullAs=EmptyString] attribute DOMString cellPadding;
@@ -2143,39 +2243,42 @@ partial interface HTMLTableElement {
};
partial interface HTMLTableSectionElement {
- attribute DOMString align;
- attribute DOMString ch;
- attribute DOMString chOff;
- attribute DOMString vAlign;
+ attribute DOMString align;
+ attribute DOMString ch;
+ attribute DOMString chOff;
+ attribute DOMString vAlign;
};
partial interface HTMLTableCellElement {
- attribute DOMString abbr;
- attribute DOMString align;
- attribute DOMString axis;
- attribute DOMString height;
- attribute DOMString width;
+ attribute DOMString align;
+ attribute DOMString axis;
+ attribute DOMString height;
+ attribute DOMString width;
- attribute DOMString ch;
- attribute DOMString chOff;
- attribute boolean noWrap;
- attribute DOMString vAlign;
+ attribute DOMString ch;
+ attribute DOMString chOff;
+ attribute boolean noWrap;
+ attribute DOMString vAlign;
[TreatNullAs=EmptyString] attribute DOMString bgColor;
};
+partial interface HTMLTableDataCellElement {
+ attribute DOMString abbr;
+};
+
partial interface HTMLTableRowElement {
- attribute DOMString align;
- attribute DOMString ch;
- attribute DOMString chOff;
- attribute DOMString vAlign;
+ attribute DOMString align;
+ attribute DOMString ch;
+ attribute DOMString chOff;
+ attribute DOMString vAlign;
[TreatNullAs=EmptyString] attribute DOMString bgColor;
};
partial interface HTMLUListElement {
- attribute boolean compact;
- attribute DOMString type;
+ attribute boolean compact;
+ attribute DOMString type;
};
partial interface Document {
@@ -2189,7 +2292,14 @@ partial interface Document {
readonly attribute HTMLCollection applets;
void clear();
+ void captureEvents();
+ void releaseEvents();
readonly attribute HTMLAllCollection all;
};
+partial interface Window {
+ void captureEvents();
+ void releaseEvents();
+};
+