keithclark / selectivizr

selectivizr is a JavaScript utility that emulates CSS3 pseudo-classes and attribute selectors in Internet Explorer 6-8.
1.71k stars 246 forks source link

[IE8] Background image, jquery, selectivizr and absolute/relative paths. #15

Closed mhulse closed 13 years ago

mhulse commented 13 years ago

Take this code for example:

https://gist.github.com/983983

When testing via IE8.0.6001.19019/Vista:

Based on my bare-bones example, there appears to be a bug and/or conflict with jQuery, Selectivizr, externally-linked CSS and background images not on same server as CSS file.

When I embed the CSS into the document, then both relative and/or absolute (to another server) background image URIs work.

When I link to the CSS and point my background-image to an absolute URI (on different server) then the background image disappears from view. When background image URI is relative to CSS file then the image will appear on page.

When I remove link to jQuery from foot of document, then everything works.

I am not sure what all of this means... Heck, is this a bug with Selectivizr or Jquery? Both? Am I doing something wrong?

The solution would be:

  1. Don't use jquery
  2. Find alternative to #flag CSS.
  3. Embed css
  4. Use relative URI to background image.
  5. Other?

Selectivizr is some awesome code!!! I hope I am not missing something obvious here.

Thanks for listening.

Cheers, Micky

keithclark commented 13 years ago

I think I know what's causing this. resolveUrl() was written to fully qualify relative urls for style sheets and @imports. Part of it's job just is to return null if an unsafe url was requested, preventing security errors when requested css files from another domain

The problem is; resolveUrl() is now used to qualify asset urls, so the same security restrictions are implied - which is wrong. I'll patch this ready for the next release.

mhulse commented 13 years ago

Thanks for looking into this Keith! I really appreciate it. Let me know if I can help test anything. :)

Thanks so much for sharing your awesome code with the rest of the world!

Have a great day.

Cheers, Micky

keithclark commented 13 years ago

Your welcome. Issue is fixed in this commit: SHA: 0f239c30851eefe3be36b03c95f0cb86b070f477

mhulse commented 13 years ago

Awesome! thanks Keith! You rock!!! :)