unicode.js 952 B

1234567891011121314151617181920212223242526272829303132
  1. /**
  2. * Unicode special character support
  3. *
  4. * Detection is made by testing missing glyph box rendering against star character
  5. * If widths are the same, this "probably" means the browser didn't support the star character and rendered a glyph box instead
  6. * Just need to ensure the font characters have different widths
  7. *
  8. * Warning : positive Unicode support doesn't mean you can use it inside <title>, this seams more related to OS & Language packs
  9. */
  10. Modernizr.addTest('unicode', function() {
  11. var bool,
  12. missingGlyph = document.createElement('span'),
  13. star = document.createElement('span');
  14. Modernizr.testStyles('#modernizr{font-family:Arial,sans;font-size:300em;}', function(node) {
  15. missingGlyph.innerHTML = '&#5987';
  16. star.innerHTML = '&#9734';
  17. node.appendChild(missingGlyph);
  18. node.appendChild(star);
  19. bool = 'offsetWidth' in missingGlyph && missingGlyph.offsetWidth !== star.offsetWidth;
  20. });
  21. return bool;
  22. });