[jQuery] Why does $.width return innerWidth but set outerWidth?
Hi all,
I was just writing a bit of JS to set the width of some buttons to the
width of the largest.
While doing this I found that the largest one would shrink!
Doing this in a debugger gives:
$("#x").width(); // 222
$("#x").width(222); // makes element shrink
$("#x").width(); // 216
The number returned from $.width() is equal to the innerWidth() (at
least it is on my button, which has a border but no padding).
When you set it though, if you set it to the value returned, it will
shrink! It won't do this if you pass the return from $.outerWidth().
This seems backwards; I would never expect that passing the return of
a getter to its corresponding setter to change the return from the
getter!
Can someone tell me if this is a bug or is by design - and if by
design, why?
TIA,
--rob