Socket
Socket
Sign inDemoInstall

event-target-shim

Package Overview
Dependencies
0
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.0 to 0.1.1

2

package.json
{
"name": "event-target-shim",
"version": "0.1.0",
"version": "0.1.1",
"description": "A polyfill for W3C EventTarget Constructor.",

@@ -5,0 +5,0 @@ "main": "lib/EventTarget.js",

@@ -19,3 +19,4 @@ "use strict";

set: function(value) { this[SET_ATTRIBUTE_LISTENER]("${type}", value); },
configurable: true
configurable: true,
enumerable: true
},

@@ -22,0 +23,0 @@ `;

@@ -9,2 +9,7 @@ "use strict";

const HAS_EVENT_TARGET_INTERFACE =
(typeof window !== "undefined" && typeof window.EventTarget !== "undefined");
const IS_CHROME =
(typeof navigator !== "undefined" && /Chrome/.test(navigator.userAgent));
// A helper to create an event.

@@ -37,11 +42,9 @@ function createEvent(type, bubbles = false, cancelable = false, detail = null) {

if (typeof window !== "undefined" && typeof window.EventTarget !== "undefined") {
it("should be instanceof `window.EventTarget`.", () => {
expect(target).to.be.instanceof(window.EventTarget);
});
(HAS_EVENT_TARGET_INTERFACE ? it : xit)("should be instanceof `window.EventTarget`.", () => {
expect(target).to.be.instanceof(window.EventTarget);
});
it("should not equal `EventTarget` and `window.EventTarget`.", () => {
expect(EventTarget).to.not.equal(window.EventTarget);
});
}
(HAS_EVENT_TARGET_INTERFACE ? it : xit)("should not equal `EventTarget` and `window.EventTarget`.", () => {
expect(EventTarget).to.not.equal(window.EventTarget);
});

@@ -206,2 +209,13 @@ it("should call registered listeners on called `dispatchEvent()`.", () => {

// V8 has a bug.
// See Also: https://code.google.com/p/v8/issues/detail?id=705
(IS_CHROME ? xit : it)("should properties of attribute listener are enumerable.", () => {
let keys = [];
for (let key in target) {
keys.push(key);
}
expect(keys).to.deep.equal(["ontest"]);
});
it("should call attribute listeners when called `dispatchEvent()`.", () => {

@@ -208,0 +222,0 @@ let listener = chai.spy();

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc