Could you help me to add a fix the IE9.js way ?

104 views
Skip to first unread message

Max

unread,
Apr 15, 2012, 9:37:51 AM4/15/12
to ie7-js
Hi,

I like IE9.js very much, and would like to use one of its functions to
write my own fix, using IE7.CSS.addFix. (I think)

I would like to do this fix:

For every element that has a CSS rule "background: linear-
gradient( *** )" applied, I'd like to add this fix for IE < 10: "-pie-
background: linear-gradient( *** ) .

That -pie- rule will be read by CSS3Pie, which enables (amongst other
things) linear-gradients on IE < 10.

So I tried to add this in a test page (it's just the first step of the
definitive fix):

<!--[if lt IE 9]><script src="IE9.js">var IE7_PNG_SUFFIX=".png";</
script><![endif]-->

<script>
IE7.CSS.addFix(/\bbackground\s*:\s*/, function(match, value) {
alert(match + ' ' + value);
//return "-pie-background:" + value;
});
</script>

<style>
div { width: 50px; height: 50px; padding: 50px; border: 1px
solid black; background:linear-gradient(#000, #fff); }
</style>

<div>
gradient!
</div>


When I visit that page on IE, I get many alerts saying "background:
undefined", and it's normal -I guess- because my regexp isn't
complete.

if I add linear-gradient inside my regexp ( /\bbackground\s*:\s*linear-
gradient/ ) and refresh, there's no alert anymore.

IE7.js parses the CSS files and <style> elements, doesn't it?
So why is it unable to see that rule?
Do you think it's possible to achieve what i'm trying to do? Can you
help me?

Thanks!
Reply all
Reply to author
Forward
0 new messages