|
|
@@ -2172,6 +2172,27 @@ static int node_has(js_State *state, void *p, const char *name)
|
|
|
return 1;
|
|
|
}
|
|
|
}
|
|
|
+ /* <video>/<audio> are placeholder boxes: give them the
|
|
|
+ * HTMLMediaElement methods from the prelude (__nb_media) and report a
|
|
|
+ * paused, never-loaded element. The global object stays below the
|
|
|
+ * method on the stack; the hook result is the top value. */
|
|
|
+ if (n->type == BR_NODE_ELEM &&
|
|
|
+ (n->tag == BR_TAG_VIDEO || n->tag == BR_TAG_AUDIO)) {
|
|
|
+ if (!strcmp(name, "play") || !strcmp(name, "pause") ||
|
|
|
+ !strcmp(name, "load") || !strcmp(name, "canPlayType")) {
|
|
|
+ js_getglobal(state, "__nb_media");
|
|
|
+ js_getproperty(state, -1, name);
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ if (!strcmp(name, "paused")) {
|
|
|
+ js_pushboolean(state, 1);
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ if (!strcmp(name, "readyState")) {
|
|
|
+ js_pushnumber(state, 0);
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
/* An <option> without a value attribute has its text as value. */
|
|
|
if (n->type == BR_NODE_ELEM && n->tag == BR_TAG_OPTION &&
|
|
|
!strcmp(name, "value") && !node_attr(node, "value")) {
|
|
|
@@ -2463,6 +2484,11 @@ static int node_put(js_State *state, void *p, const char *name)
|
|
|
js_setregistry(state, key);
|
|
|
return 1;
|
|
|
}
|
|
|
+ /* There are no scrollable inner boxes, so an element's scroll offset
|
|
|
+ * stays 0; accept the write (jQuery's scrollTop(0) in Bootstrap's
|
|
|
+ * modal show) instead of letting the getter make it read-only. */
|
|
|
+ if (!strcmp(name, "scrollTop") || !strcmp(name, "scrollLeft"))
|
|
|
+ return 1;
|
|
|
if (!strcmp(name, "style")) {
|
|
|
if (js_isstring(state, -1))
|
|
|
node_set_string(node, "style",
|