fix equality check in resize()

Prevent a lot of unnecessary round-trips to the DOM.