make dom implement node-like API, improve selector parsing