Export to GitHub

ie7-js - issue #307

“font: inherit;” (as used in Eric Meyer’s CSS Reset 2.0) causes JavaScript error in IE 6 and 7


Posted on Mar 2, 2011 by Happy Bird

What steps will reproduce the problem?

  1. In IE 6 or 7, visit http://www.pauldwaite.co.uk/test-pages/ie7-reset2/

What is the expected output?

No JavaScript errors.

What do you see instead?

Line: 2080 Char: 11 Error: Invalid argument Code: 0

What version of the product are you using? On what operating system?

ie7-2.1(beta 4)/src/IE9.js

Please provide any additional information below.

Version 2 of Eric Meyer’s CSS reset uses the CSS rule “font: inherit” in its first declaration. When ie7-js encounters this, the following line throws an “invalid argument” error in IE 6 and 7.

element.runtimeStyle[propertyName] = element.parentElement.currentStyle[propertyName];

I’ve put a reduced test page up at http://www.pauldwaite.co.uk/test-pages/ie7-reset2/. This uses a stylesheet that only applies the CSS rule to the <body> element, and does nothing else.

If the rule is applied to an HTML element not on the page, the error disappears.

Comment #1

Posted on Mar 7, 2011 by Helpful Ox

This avoids this bug:

change font: inherit; to font-weight: inherit; font-style: inherit; font-family: inherit;

Comment #2

Posted on Mar 7, 2011 by Happy Bird

Hey, that it does: excellent.

Comment #3

Posted on Apr 14, 2011 by Helpful Rabbit

That does provide a temp fix to the bug but we really need an actual fix for this. I believe this issue is also related to Issue #300 (or at least was for me).

Comment #4

Posted on Apr 14, 2011 by Massive Rhino

I'm also using v2 of Eric Meyer's reset and was having the same JS error with IE9.js - thanks for posting the temporary workaround.

Comment #5

Posted on Dec 20, 2011 by Happy Lion

Solution is in this ticket: http://code.google.com/p/ie7-js/issues/detail?id=354

Comment #6

Posted on Dec 20, 2011 by Happy Bird

Aha, good spot. Excellent.

Status: New

Labels:
Type-Defect Priority-Medium