add IFFE that checks for domComplete