Prevent JS error for elements without resize property