I'm traversing the entire window, and picking out elements with certain attributes. I fixed my problem by passing the beginning window into the (recursive) traversal function, and setting it on the element placeholder when I get one I want to keep.