fix issue with backward compatibility for HTMLDocument