Placeholders.js
Placeholders.js copied to clipboard
Placeholders do not work in IE7 Standards when being emulated by IE10
Using IE10 to emulate IE7 on Windows 7 causes the placeholders to not show up. A screenshot of the Placeholders site in my environment: http://puu.sh/3amKt.png
However, it seems using IE8 to emulate IE7 (on XP) works: http://cl.ly/image/450h3V2T2e2e
Thanks for reporting this. It's definitely a bug, but I can't work out what is going on. IE10 dropped into IE7 standards mode seems to somehow remove the placeholder
attribute from the elements (although it shows up in the DOM inspector). Attempting to get the value of the attribute via getAttribute
always returns null
.
This is not the case for IE8 or 9 emulation, both of which appear to work as expected.
Currently, we are checking for the presence of a placeholder
attribute on each input
and textarea
element in the DOM as follows:
placeholder = elem.getAttribute("placeholder");
The only way I can see so far that this issue could be fixed is to use the Node.attributes
property, which does seem to contain the correct value for the placeholder
attribute. Something like this:
placeholder = elem.getAttribute("placeholder") || elem.attributes.placeholder;
I'm questioning the value of this fix, since IE10 dropped into IE7 mode is something that should only be done for testing, but it is a relatively simple fix so I think I will probably include it.
Fixed as of 2.1.0 release.
It does work when entering a page. But when you refresh (f5) a page all placeholders change into values and thus show up as normal black text. (Using latest IE10 to emulate IE7 on Windows 8)
@Florisschimandl Thanks, confirmed. I'll reopen this and try to fix that soon.