I decided I had to write my own Document Object Model implementation because the models available to me just won’t meet my requirements. That involves writing a lot of code, though, and ensuring that Element nodes, Text nodes, etc. all implement Node properties like firstChild, childNodes, etc., and methods like appendChild() correctly.
- Write tests for the Node interface’s methods and properties
- Designate Element as inheriting from Node, and
- Provide some functions to build “typical” instances of Element,
This code is for debugging purposes only; in my opinion, it’s a little extreme to include these tests in a production environment.
Please, let me know what you think!