Sha256: f02e9340e48e50080668beacc6e268b045ba7e1bdb3e5da754e437c0d40ae184

Contents?: true

Size: 1.06 KB

Versions: 51

Compression:

Stored size: 1.06 KB

Contents

"use strict";

const { createEventAccessor } = require("../helpers/create-event-accessor");

const events = new Set([
  // WindowEventHandlers
  "afterprint",
  "beforeprint",
  "beforeunload",
  "hashchange",
  "languagechange",
  "message",
  "messageerror",
  "offline",
  "online",
  "pagehide",
  "pageshow",
  "popstate",
  "rejectionhandled",
  "storage",
  "unhandledrejection",
  "unload",

  // inherited and overridden
  "blur",
  "error",
  "focus",
  "load",
  "resize",
  "scroll"
]);

// This class builds on GlobalEventHandlers, which must be mixed in first.
class WindowEventHandlersImpl {
  _proxyWindowEventsToWindow() {
    // We're a <body> or <frameset>, so we need to proxy these specific events to the Window (if it exists)
    this._getEventHandlerTarget = event => {
      if (events.has(event)) {
        return this.ownerDocument.defaultView || null;
      }
      return this;
    };
  }
}

for (const event of events) {
  createEventAccessor(WindowEventHandlersImpl.prototype, event);
}

module.exports = {
  implementation: WindowEventHandlersImpl
};

Version data entries

51 entries across 48 versions & 3 rubygems

Version Path
clapton-0.0.26 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/living/nodes/WindowEventHandlers-impl.js
clapton-0.0.25 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/living/nodes/WindowEventHandlers-impl.js
clapton-0.0.24 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/living/nodes/WindowEventHandlers-impl.js
clapton-0.0.23 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/living/nodes/WindowEventHandlers-impl.js
clapton-0.0.22 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/living/nodes/WindowEventHandlers-impl.js
clapton-0.0.21 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/living/nodes/WindowEventHandlers-impl.js
clapton-0.0.20 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/living/nodes/WindowEventHandlers-impl.js
clapton-0.0.19 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/living/nodes/WindowEventHandlers-impl.js
clapton-0.0.18 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/living/nodes/WindowEventHandlers-impl.js
clapton-0.0.17 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/living/nodes/WindowEventHandlers-impl.js
clapton-0.0.16 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/living/nodes/WindowEventHandlers-impl.js
clapton-0.0.15 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/living/nodes/WindowEventHandlers-impl.js
clapton-0.0.14 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/living/nodes/WindowEventHandlers-impl.js
clapton-0.0.13 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/living/nodes/WindowEventHandlers-impl.js
clapton-0.0.12 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/living/nodes/WindowEventHandlers-impl.js
clapton-0.0.11 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/living/nodes/WindowEventHandlers-impl.js
clapton-0.0.10 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/living/nodes/WindowEventHandlers-impl.js
clapton-0.0.9 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/living/nodes/WindowEventHandlers-impl.js
clapton-0.0.8 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/living/nodes/WindowEventHandlers-impl.js
clapton-0.0.7 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/living/nodes/WindowEventHandlers-impl.js