Trim HTML before setting content