JS width() and height() implementation