blur.js 372 B

123456789101112131415
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.blur = blur;
  6. var _utils = require("./utils");
  7. function blur(element) {
  8. if (!(0, _utils.isFocusable)(element)) return;
  9. const wasActive = (0, _utils.getActiveElement)(element.ownerDocument) === element;
  10. if (!wasActive) return;
  11. (0, _utils.eventWrapper)(() => element.blur());
  12. }