Sha256: d72d1b28a283b46d44031073a20aefd89007acea9557e810c3032e1329bf6542

Contents?: true

Size: 974 Bytes

Versions: 63

Compression:

Stored size: 974 Bytes

Contents

import './matches.mjs'

(function(undefined) {

  // Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-service/1f3c09b402f65bf6e393f933a15ba63f1b86ef1f/packages/polyfill-library/polyfills/Element/prototype/closest/detect.js
  var detect = (
    'document' in this && "closest" in document.documentElement
  )

  if (detect) return

  // Polyfill from https://raw.githubusercontent.com/Financial-Times/polyfill-service/1f3c09b402f65bf6e393f933a15ba63f1b86ef1f/packages/polyfill-library/polyfills/Element/prototype/closest/polyfill.js
  Element.prototype.closest = function closest(selector) {
    var node = this;

    while (node) {
      if (node.matches(selector)) return node;
      else node = 'SVGElement' in window && node instanceof SVGElement ? node.parentNode : node.parentElement;
    }

    return null;
  };

}).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});

Version data entries

63 entries across 63 versions & 1 rubygems

Version Path
govuk_publishing_components-35.3.3 node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/closest.mjs
govuk_publishing_components-35.3.2 node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/closest.mjs
govuk_publishing_components-35.3.1 node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/closest.mjs
govuk_publishing_components-35.3.0 node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/closest.mjs
govuk_publishing_components-35.2.0 node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/closest.mjs
govuk_publishing_components-35.1.1 node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/closest.mjs
govuk_publishing_components-35.1.0 node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/closest.mjs
govuk_publishing_components-35.0.0 node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/closest.mjs
govuk_publishing_components-34.14.0 node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/closest.mjs
govuk_publishing_components-34.13.0 node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/closest.mjs
govuk_publishing_components-34.12.0 node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/closest.mjs
govuk_publishing_components-34.11.0 node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/closest.mjs
govuk_publishing_components-34.10.1 node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/closest.mjs
govuk_publishing_components-34.10.0 node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/closest.mjs
govuk_publishing_components-34.9.1 node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/closest.mjs
govuk_publishing_components-34.9.0 node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/closest.mjs
govuk_publishing_components-34.8.1 node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/closest.mjs
govuk_publishing_components-34.8.0 node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/closest.mjs
govuk_publishing_components-34.7.1 node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/closest.mjs
govuk_publishing_components-34.7.0 node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/closest.mjs