luzhox / ie7-js

Automatically exported from code.google.com/p/ie7-js
0 stars 0 forks source link

font: inherit; fails on IE7 and lower #354

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. set font: inherit; on element

What is the expected output? What do you see instead?
- script fails on element.runtimeStyle[propertyName] = 
element.parentElement.currentStyle[propertyName];

What version of the product are you using? On what operating system?
- ie7 and ie6, win7

Please provide any additional information below.

There's no currentStyle['font'], only fontFamily, fontVariant etc.
I've fixed it this way:

          if (propertyName == 'font') {
            var propPreg = new RegExp("^" + propertyName);
            for (prop in element.runtimeStyle) {
                if (prop == propertyName || !propPreg.test(prop)) continue;
                element.runtimeStyle[prop] = element.parentElement.currentStyle[prop];
            }
        } else {
            element.runtimeStyle[propertyName] = element.parentElement.currentStyle[propertyName];
          }

It may also apply to other css-shorthands. I've checked background - it IS in 
currentStyle, so we don't have to fix it.

Original issue reported on code.google.com by var...@gmail.com on 20 Dec 2011 at 12:35

GoogleCodeExporter commented 8 years ago
Sorry, look's like it's dublicated several times already, but at least it 
contains fix :)

Original comment by var...@gmail.com on 20 Dec 2011 at 12:37

GoogleCodeExporter commented 8 years ago
The same happens for 'background' property.
I guess a real fix is needed.

Original comment by dentxinho@gmail.com on 12 Mar 2012 at 6:16