Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<title>CSSFontFaceRule</title>
<script src="https://rawgit.com/w3c/web-platform-tests/master/resources/testharness.js"></script>
<script src="https://rawgit.com/w3c/web-platform-tests/master/resources/testharnessreport.js"></script>
<style>
@font-face {
  font-family: 'Foo Bar';
  src: url('FooBar.ttf');
}
</style>
<script>
test(function() {
  const rule = document.styleSheets[0].cssRules[0];
  assert_true(rule instanceof CSSFontFaceRule);
  const style = rule.style;
  // check that the same object is returned every time
  assert_equals(style, rule.style);
  console.log(style);
  assert_equals(style.getPropertyValue("font-family"), '"Foo Bar"');
  assert_equals(style.getPropertyValue("src"), 'url("FooBar.ttf")');
});
</script>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
foolippro
0viewers