I've made a bookmarklet that, among other things, loads a form in a "popup" div. I reset every CSS tag known to mankind on every element I create, and as far as I can tell examining it in firebug, no CSS tag is "bleeding through". However, on some pages, the input width includes its padding:
input.clientWidth = input.style.width
on other pages, the input width does not include the padding:
input.clientWidth = input.style.width + input.style.paddingLeft + input.style.paddingRight
As such, here is a small code snippet:
input.style.width = '300px';
input.style.border = '1px solid grey';
input.style.padding = '20px';
alert(input.clientWidth);
On some pages, this alerts 298 (300 - the 1px border), and on other pages this alerts 338 (300 - the 1px border + 20 + 20). What causes this? And more importantly, what can I do to get consistent behavior?
Edit:
This is all in the same browser - Firefox 3.6.8