img.js 431 B

123456789101112131415161718192021
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports["default"] = getImplicitRoleForImg;
  6. var _jsxAstUtils = require("jsx-ast-utils");
  7. /**
  8. * Returns the implicit role for an img tag.
  9. */
  10. function getImplicitRoleForImg(attributes) {
  11. var alt = (0, _jsxAstUtils.getProp)(attributes, 'alt');
  12. if (alt && (0, _jsxAstUtils.getLiteralPropValue)(alt) === '') {
  13. return '';
  14. }
  15. return 'img';
  16. }