@@ -49,7 +49,20 @@ const OP_TABLE = [
49 const pointer2 = mem32[i++];
49 const pointer2 = mem32[i++];
50 const length2 = mem32[i++];
50 const length2 = mem32[i++];
51 const value = string(mem8, pointer2, length2);
51 const value = string(mem8, pointer2, length2);
52+ const node = top(changeList.stack);
52− top(changeList.stack).setAttribute(name, value);
53+ node.setAttribute(name, value);
55+ // Some attributes are "volatile" and don't work through `setAttribute`.
56+ if (name === "value") {
59+ if (name === "checked") {
62+ if (name === "selected") {
63+ node.selected = true;
@@ -58,7 +71,20 @@ const OP_TABLE = [
58 const pointer = mem32[i++];
71 const pointer = mem32[i++];
59 const length = mem32[i++];
72 const length = mem32[i++];
60 const name = string(mem8, pointer, length);
73 const name = string(mem8, pointer, length);
74+ const node = top(changeList.stack);
61− top(changeList.stack).removeAttribute(name);
75+ node.removeAttribute(name);
77+ // Some attributes are "volatile" and don't work through `removeAttribute`.
78+ if (name === "value") {
81+ if (name === "checked") {
82+ node.checked = false;
84+ if (name === "selected") {
85+ node.selected = false;