add conditionals; clean up stuff
fix attr check on non-element nodes
fix ie9+ compatibility