I don't understand why would you remove the parameters for this function whose purpose is to set the width and height - it either is an issue of the API not being clear or another issue that throws the DOM exception you're getting somewhere else. Maybe you're setting the width and height to 0 inadvertently?