fixed a typo that would cause the dom module not to load in node-webkit
udpated tests
added some utility functions for encode/decoding strings