// Called when the element is added into a hierarchy. void OnChildAdd( Element* element ) { Element::OnChildAdd( element ); if( element == this ) { Element *document = GetOwnerDocument(); if( document == NULL ) return; document->AddEventListener( "invalidate", this ); } }