Skip to content

Commit

Permalink
Fix an @font-face false positive in Opera 9.
Browse files Browse the repository at this point in the history
  • Loading branch information
devongovett committed Dec 19, 2010
1 parent 17085bf commit 6968d6e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modernizr.js
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ window.Modernizr = (function(window,document,undefined){
var result = false;
try {
sheet.insertRule(rule, 0);
result = !(/unknown/i).test(sheet.cssRules[0].cssText);
result = (/src/i).test(sheet.cssRules[0].cssText);
sheet.deleteRule(sheet.cssRules.length - 1);
} catch(e) { }
return result;
Expand All @@ -593,13 +593,13 @@ window.Modernizr = (function(window,document,undefined){
if (!(sheet && rule)) return false;
sheet.cssText = rule;

return sheet.cssText.length !== 0 && !(/unknown/i).test(sheet.cssText) &&
return sheet.cssText.length !== 0 && (/src/i).test(sheet.cssText) &&
sheet.cssText
.replace(/\r+|\n+/g, '')
.indexOf(rule.split(' ')[0]) === 0;
};

bool = supportAtRule('@font-face { font-family: "font"; src: "font.ttf"; }');
bool = supportAtRule('@font-face { font-family: "font"; src: url(font.ttf); }');
head.removeChild(style);
return bool;
};
Expand Down

0 comments on commit 6968d6e

Please sign in to comment.