implement NodeList and consolidate common scope and context retrieval
auto merge of #1018 : ttaubert/servo/nodelist, r=jdm

This should fix #652 and #775. I'm not sure if that's all that is needed to properly implement NodeList? Should we add tests somewhere? Sorry for any stupid stuff I might have done :)

r? @jdm