When creating a new Element('img') in IE 9, the browser (sometimes)
add width and height attributes to the tag.
If you inspect the Mootools images in http://jsfiddle.net/woomla/6py5D/
you see that in IE9 they have a width of 180 and a height of 60.
Is this a bug in IE? Can mootools do anything about it?
W.
On Nov 18, 3:58 pm, woomla <woo...@gmail.com> wrote:
> Hi,
>
> When creating a new Element('img') in IE 9, the browser (sometimes)
> add width and height attributes to the tag.
>
> If you inspect the Mootools images inhttp://jsfiddle.net/woomla/6py5D/
Changes the display size from auto (file dimensions) to a fixed size,
n'eh? Not that we are supposed to be use using auto....
-- S.
Point taken. The prob is that the attributes stick when you change
`src` programatically, then.
> I'm also having trouble reproducing the width height attribute problem in
> IE9 with your fiddle.
Haven't tested the Fiddle yet myself, maybe I should shut up for now.
-- S.,
> Sure, but those images *are** 180 x 60*. :D
Point taken. The prob is that the attributes stick when you change
`src` programatically, then.
I can repro it every time in IE 9.0.8112.16421 x64, but not in the IE
9.0.8112.16421 Win32 nor in v9.02 Win32. So 64-bit thing?
Create the el with a given src, set the src to something smaller,
inject it, keeps the dims of the original src. I haven't looked at it
much more than that.
-- S.
It's apparently linked to the caching of the original src in some way
(IE has other `src` caching bugs like this). Looks like if you have a
query string, regardless of the actual HTTP-level cacheability, the
problem does not occur. Otherwise it is sporadic (based on some other
heuristic). Play with path?dummy and you should see a diff:
http://jsfiddle.net/sanford/mS6KR/.
-- S.
Makes sense to me as the brute-force way -- but do you not think it's
something that could go in core as a behavior standardization/fix?
Not that I care about this myself, mind you...
-- S.
I solved this same issue a couple days ago, where we have an "image
viewer" that lazily loads the image via AJAX and then the image is
constrained to the width of the viewport via CSS (max-width: 100%). In
IE9 the image got distorted aspect ratio (height remained the
original), and on IE8 it had the width of the padding box of the
parent. Removed width and height attributes in the load event, and
then everything worked even back to IE7.
-- S.
Interesting, yeah, maybe that's the difference; in my testbed (2
Win7/IE9 boxes) the query string, any query string, fixes it.
-- S.