Use stack based DOM tree up-traversal (instead of using the parentNode property) to handle IE's corruption of the DOM tree in case of mismatched or un-closed HTML tags.