Implement vtables for DOM nodes

Fixes #1527. Does *not* include the code for #1528.

(Originally by @jdm in #1688 and #1866.)