Clean up memoization internals, add unit test coverage

Covered level1/level2 core, innerHTML, attribute setting,
and querySelector via Sizzle