improve def scope
when manipulating the DOM, its often necessary to use the correct class
def scope debugging
fix for def scope dom
Merge pull request #563 from theresaanna/master

Improvements for definition scoping
upstream merge