added dom4 extra dependency and improved CustomEvent like behavior