add attributeChange event for detecting when attributes have changed