html: split out the title event generation handler