Sha256: 77fe034066438cb39ff91c295d234d6b5cc3762adace6e52ee3272b811138853
Contents?: true
Size: 971 Bytes
Versions: 66
Compression:
Stored size: 971 Bytes
Contents
// see https://github.com/alphagov/govuk_publishing_components/blob/main/docs/lib/trigger_event.md (function (root) { 'use strict' window.GOVUK = window.GOVUK || {} window.GOVUK.triggerEvent = function (element, eventName, parameters) { var params = parameters || {} var event var keyCode = params.keyCode if (!Object.prototype.hasOwnProperty.call(params, 'bubbles')) { params.bubbles = true } if (!Object.prototype.hasOwnProperty.call(params, 'cancelable')) { params.cancelable = true } if (typeof window.CustomEvent === 'function') { event = new window.CustomEvent(eventName, params) } else { event = document.createEvent('CustomEvent') event.initCustomEvent(eventName, params.bubbles, params.cancelable, params.detail) } if (keyCode) { event.keyCode = keyCode } if (params.shiftKey) { event.shiftKey = true } element.dispatchEvent(event) } }(window))
Version data entries
66 entries across 66 versions & 1 rubygems