@sandlada/vue-mdc
Version:

23 lines (22 loc) • 615 B
JavaScript
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: Apache-2.0
*
* @link https://github.com/material-components/material-web/blob/main/internal/events/redispatch-event.ts
*/
function redispatchEvent(element, event) {
if (event.bubbles && (!element.shadowRoot || event.composed)) {
event.stopPropagation();
}
const copy = Reflect.construct(event.constructor, [event.type, event]);
const dispatched = element.dispatchEvent(copy);
if (!dispatched) {
event.preventDefault();
}
return dispatched;
}
export {
redispatchEvent
};
//# sourceMappingURL=redispatch-event.js.map