background-size-polyfill icon indicating copy to clipboard operation
background-size-polyfill copied to clipboard

Is this really work in IE8 just with adding -ms-behavior?

Open Metafalica opened this issue 11 years ago • 17 comments

First of all, I think - when you giving example, it should be minimal, so everyone can understand what he need to make it work.

Your index.html is visually good, but not that good at explaining what I need to do to make it work. So, I followed your instruction and created this simplest code: Err, I don't know how to paste code here, since [code] no work and html disappears. Look code here: http://stackoverflow.com/questions/25338009/background-size-polyfill-does-not-work-in-ie8

I made this minimal test page and background-size: contain and cover completely no work. In IE8 background acts the same way as without this thing.

Metafalica avatar Aug 16 '14 18:08 Metafalica

I left an answer on StackOverflow as well, but I'll answer here for posterity.

You need to place the .htaccess file inside a running Apache server. You have it placed on your Windows desktop for your local testing, so it doesn't get served at all, which precludes the requirement "served with the correct MIME type."

If you're using server software other than Apache, you don't need to include .htaccess; the server will automatically take care of that for you.

tigt avatar Aug 18 '14 04:08 tigt

But... index.html that comes in package works in that way! I also viewing it from folder by double clicking the page without any servers.

Metafalica avatar Aug 18 '14 06:08 Metafalica

Yeah. Frustratingly inconsistent, isn't it?

tigt avatar Aug 18 '14 06:08 tigt

I don't understand what you means. If index.html page works fine in IE8 without any servers, why my page no work as expected? What I ask is what else I must do to make it work.

Metafalica avatar Aug 18 '14 06:08 Metafalica

Does your file have a standards mode DOCTYPE?

<!DOCTYPE html>

The polyfill doesn't work in quirks mode (this is a known issue).

jefferyto avatar Aug 18 '14 06:08 jefferyto

Oh it started working... Thank you. However, I think it would be good to add this into instructions where is said about adding -ms-behavior.

Metafalica avatar Aug 18 '14 06:08 Metafalica

Good to hear :-) Thanks for your suggestion - I'll add it to the Readme.

(Also thanks @tigt - having a proper localhost is IMHO best practice.)

jefferyto avatar Aug 18 '14 06:08 jefferyto

You have any ideas why it no work in quirks mode? Actually, I use quirks on purpose to avoid table height calculation bug in IE8 - 10. I though maybe I can make a fix for quirks mode.

Metafalica avatar Aug 18 '14 06:08 Metafalica

I'm not sure why it doesn't work in quirks mode. (I'm afraid I don't have enough free time at the moment to investigate.) I would consider any fix to be for existing sites that can't convert to standards mode; every new project should really use standards mode. There will be bugs in IE either way ;-)

jefferyto avatar Aug 18 '14 06:08 jefferyto

Maybe you can tell me how to debug htc? Line by line execution and viewing variables data.

Metafalica avatar Aug 18 '14 06:08 Metafalica

This should help: http://msdn.microsoft.com/en-us/library/dd565628(v=vs.85).aspx

jefferyto avatar Aug 18 '14 06:08 jefferyto

Ok thank you very much. I will see what I can do.

Metafalica avatar Aug 18 '14 06:08 Metafalica

Looks like I found why it no work in quirks, but I don't know why that happens. In quirks the code in htc is not executed at all. I tried adding alert('asd'); right after script opening tag, but it alerts with doctype only. I will try to redo all this into *.js file

Metafalica avatar Aug 18 '14 08:08 Metafalica

According to this http://msdn.microsoft.com/en-us/library/ie/ms530723(v=vs.85).aspx, when IE8 isn't in Standards mode, -ms-behavior is just called behavior. Does that work?

tigt avatar Aug 18 '14 14:08 tigt

Well... for some really weird reason the background simply disappears. But at least code in htc executed.

Metafalica avatar Aug 18 '14 14:08 Metafalica

I fear there might be methods in the .htc that IE8 doesn't support in Quirks Mode. Without a JavaScript console in IE8, that would be very hard to fix.

tigt avatar Aug 18 '14 15:08 tigt

Hm. Interesting. I have the same issue than you Metafalica. The code is executed (I had to use behavior instead of -ms-behavior though), and the background simply disappeared. Did you ever find out what was happening ?

I also made sure that I wasn't in quirk mode, using this piece of code: mode = (document.compatMode=='CSS1Compat'?'Standards':'Quirks')

Plaristote avatar Dec 02 '14 18:12 Plaristote