Placeholders.js icon indicating copy to clipboard operation
Placeholders.js copied to clipboard

Placeholders do not work in IE7 Standards when being emulated by IE10

Open seiyria opened this issue 11 years ago • 5 comments

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

seiyria avatar Jun 07 '13 15:06 seiyria

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.

jamesallardice avatar Jun 09 '13 15:06 jamesallardice

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.

jamesallardice avatar Jun 10 '13 07:06 jamesallardice

Fixed as of 2.1.0 release.

jamesallardice avatar Jun 10 '13 19:06 jamesallardice

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 avatar Jun 18 '13 08:06 Florisschimandl

@Florisschimandl Thanks, confirmed. I'll reopen this and try to fix that soon.

jamesallardice avatar Jun 18 '13 08:06 jamesallardice