bdi.js 777 B

123456789101112131415161718192021222324252627282930
  1. /*!
  2. {
  3. "name": "bdi Element",
  4. "property": "bdi",
  5. "notes": [{
  6. "name": "MDN Docs",
  7. "href": "https://developer.mozilla.org/en-US/docs/Web/HTML/Element/bdi"
  8. }]
  9. }
  10. !*/
  11. /* DOC
  12. Detect support for the bdi element, a way to have text that is isolated from its possibly bidirectional surroundings
  13. */
  14. define(['Modernizr', 'createElement', 'docElement', 'computedStyle'], function(Modernizr, createElement, docElement, computedStyle) {
  15. Modernizr.addTest('bdi', function() {
  16. var div = createElement('div');
  17. var bdi = createElement('bdi');
  18. bdi.innerHTML = 'إ';
  19. div.appendChild(bdi);
  20. docElement.appendChild(div);
  21. var supports = computedStyle(bdi, null, 'direction') === 'rtl';
  22. docElement.removeChild(div);
  23. return supports;
  24. });
  25. });