Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

can-event-dom-radiochange

Package Overview
Dependencies
Maintainers
5
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

can-event-dom-radiochange - npm Package Compare versions

Comparing version 0.0.2 to 1.0.0

61

can-event-dom-radiochange-test.js

@@ -5,2 +5,4 @@ 'use strict';

var domEvents = require('can-dom-events');
var oldEvents = require('can-util/dom/events/events');
var definition = require('./can-event-dom-radiochange');
var compat = require('./compat');

@@ -12,4 +14,23 @@

var overrideStrategy = {
name: 'override()',
// Fix oldEvent calls to match new syntax
function newifyOldEvents (oldEvents) {
return {
addEventListener: function (target) {
var args = Array.prototype.slice.call(arguments, 1);
return oldEvents.addEventListener.apply(target, args);
},
removeEventListener: function (target) {
var args = Array.prototype.slice.call(arguments, 1);
return oldEvents.removeEventListener.apply(target, args);
},
dispatch: function (target) {
var args = Array.prototype.slice.call(arguments, 1);
return oldEvents.dispatch.apply(target, args);
},
};
}
var compatWithNew = {
name: 'compat with can-dom-events',
domEvents: domEvents,
setup: function () {

@@ -23,2 +44,30 @@ this.removeEvent = compat(domEvents);

var compatWithOld = {
name: 'compat with can-util/dom/events',
domEvents: newifyOldEvents(oldEvents),
setup: function () {
this.removeEvent = compat(oldEvents);
},
teardown: function () {
this.removeEvent();
}
};
var rawNewDomEvents = {
name: 'plain with can-dom-events',
domEvents: domEvents,
setup: function () {
this.removeEvent = domEvents.addEvent(definition);
},
teardown: function () {
this.removeEvent();
}
};
var suites = [
compatWithOld,
compatWithNew,
rawNewDomEvents
];
function runTests (mod) {

@@ -30,4 +79,6 @@ QUnit.module(mod.name, {

var domEvents = mod.domEvents;
test("subscription to an untracked radio should call listener", function (assert) {
expect(1);
assert.expect(1);
var listener = document.createElement('input');

@@ -55,3 +106,3 @@ listener.id = 'listener';

test("subscription to a tracked radio should call itself", function (assert) {
expect(1);
assert.expect(1);
var radio = document.createElement('input');

@@ -73,2 +124,2 @@ radio.id = 'selfish';

runTests(overrideStrategy);
suites.forEach(runTests);

2

can-event-dom-radiochange.js

@@ -111,3 +111,3 @@ 'use strict';

/**
* @module {events} can-event-radiochange
* @module {events} can-event-dom-radiochange
* @parent can-infrastructure

@@ -114,0 +114,0 @@ *

{
"name": "can-event-dom-radiochange",
"description": "Custom radiochange event",
"version": "0.0.2",
"version": "1.0.0",
"author": {

@@ -14,3 +14,3 @@ "name": "Chris Andrejewski",

"dependencies": {
"can-dom-events": "0.0.3",
"can-dom-events": "^1.0.2",
"can-util": "^3.8.4"

@@ -17,0 +17,0 @@ },

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc