vml.js 908 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*!
  2. {
  3. "name": "VML",
  4. "property": "vml",
  5. "tags": ["vml"],
  6. "authors": ["Craig Andrews (@candrews)"],
  7. "notes": [{
  8. "name": "W3C Spec",
  9. "href": "https://www.w3.org/TR/NOTE-VML"
  10. },{
  11. "name": "MSDN Documentation",
  12. "href": "https://docs.microsoft.com/en-us/windows/desktop/VML/msdn-online-vml-introduction"
  13. }]
  14. }
  15. !*/
  16. /* DOC
  17. Detects support for VML.
  18. */
  19. define(['Modernizr', 'createElement', 'isSVG'], function(Modernizr, createElement, isSVG) {
  20. Modernizr.addTest('vml', function() {
  21. var containerDiv = createElement('div');
  22. var supports = false;
  23. var shape;
  24. if (!isSVG) {
  25. containerDiv.innerHTML = '<v:shape id="vml_flag1" adj="1" />';
  26. shape = containerDiv.firstChild;
  27. if ('style' in shape) {
  28. shape.style.behavior = 'url(#default#VML)';
  29. }
  30. supports = shape ? typeof shape.adj === 'object' : true;
  31. }
  32. return supports;
  33. });
  34. });