Sha256: 7de80b57056db31a01e4658fbb25033bec7ec03fb83d94a1bc951437be80dc99

Contents?: true

Size: 739 Bytes

Versions: 75

Compression:

Stored size: 739 Bytes

Contents

import '../vendor/polyfills/Element/prototype/closest.mjs';

/**
 * Returns the value of the given attribute closest to the given element (including itself)
 *
 * @deprecated Will be made private in v5.0
 * @param {Element} $element - The element to start walking the DOM tree up
 * @param {string} attributeName - The name of the attribute
 * @returns {string | null} Attribute value
 */
function closestAttributeValue ($element, attributeName) {
  var $closestElementWithAttribute = $element.closest('[' + attributeName + ']');
  return $closestElementWithAttribute
    ? $closestElementWithAttribute.getAttribute(attributeName)
    : null
}

export { closestAttributeValue };
//# sourceMappingURL=common/closest-attribute-value.mjs.map

Version data entries

75 entries across 75 versions & 1 rubygems

Version Path
govuk_publishing_components-39.2.5 node_modules/govuk-frontend/govuk-esm/common/closest-attribute-value.mjs
govuk_publishing_components-39.2.4 node_modules/govuk-frontend/govuk-esm/common/closest-attribute-value.mjs
govuk_publishing_components-39.2.3 node_modules/govuk-frontend/govuk-esm/common/closest-attribute-value.mjs
govuk_publishing_components-39.2.2 node_modules/govuk-frontend/govuk-esm/common/closest-attribute-value.mjs
govuk_publishing_components-39.2.1 node_modules/govuk-frontend/govuk-esm/common/closest-attribute-value.mjs
govuk_publishing_components-39.2.0 node_modules/govuk-frontend/govuk-esm/common/closest-attribute-value.mjs
govuk_publishing_components-39.1.0 node_modules/govuk-frontend/govuk-esm/common/closest-attribute-value.mjs
govuk_publishing_components-39.0.0 node_modules/govuk-frontend/govuk-esm/common/closest-attribute-value.mjs
govuk_publishing_components-38.4.2 node_modules/govuk-frontend/govuk-esm/common/closest-attribute-value.mjs
govuk_publishing_components-38.1.1 node_modules/govuk-frontend/govuk-esm/common/closest-attribute-value.mjs
govuk_publishing_components-38.1.0 node_modules/govuk-frontend/govuk-esm/common/closest-attribute-value.mjs
govuk_publishing_components-38.0.1 node_modules/govuk-frontend/govuk-esm/common/closest-attribute-value.mjs
govuk_publishing_components-38.0.0 node_modules/govuk-frontend/govuk-esm/common/closest-attribute-value.mjs
govuk_publishing_components-37.10.0 node_modules/govuk-frontend/govuk-esm/common/closest-attribute-value.mjs
govuk_publishing_components-37.9.1 node_modules/govuk-frontend/govuk-esm/common/closest-attribute-value.mjs
govuk_publishing_components-37.9.0 node_modules/govuk-frontend/govuk-esm/common/closest-attribute-value.mjs
govuk_publishing_components-37.8.1 node_modules/govuk-frontend/govuk-esm/common/closest-attribute-value.mjs
govuk_publishing_components-37.8.0 node_modules/govuk-frontend/govuk-esm/common/closest-attribute-value.mjs
govuk_publishing_components-37.7.1 node_modules/govuk-frontend/govuk-esm/common/closest-attribute-value.mjs
govuk_publishing_components-37.7.0 node_modules/govuk-frontend/govuk-esm/common/closest-attribute-value.mjs