UNPKG

yoastseo

Version:

Yoast client-side content analysis

24 lines (23 loc) 793 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = _default; var _stripSpaces = _interopRequireDefault(require("../sanitize/stripSpaces.js")); function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } /** * Checks for an alt attribute in the image and returns its content. * * @param {Node} imageNode Text string to match the alt attribute. * @returns {String} The contents of the alt attribute, empty if none is set. */ function _default(imageNode) { let alt = ""; if (imageNode.name === "img") { alt = (0, _stripSpaces.default)(imageNode.attributes.alt || ""); alt = alt.replace(/"/g, "\""); alt = alt.replace(/'/g, "'"); } return alt; } //# sourceMappingURL=getAltAttribute.js.map