From 9569005ce473d614375576ff28a9095b19d94ed0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ulrich-Matthias=20Sch=C3=A4fer?= Date: Tue, 27 Feb 2018 10:07:56 +0100 Subject: [PATCH] fix errors found by linter (jeah it works!) --- src/element.js | 2 +- src/event.js | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/element.js b/src/element.js index a2c8cc5..f35dc19 100644 --- a/src/element.js +++ b/src/element.js @@ -2,7 +2,7 @@ SVG.Element = SVG.invent({ // Initialize node - create: function(node) { + create: function (node) { // event listener this.events = {} diff --git a/src/event.js b/src/event.js index 6501beb..f0d0e0c 100644 --- a/src/event.js +++ b/src/event.js @@ -26,24 +26,24 @@ SVG.listenerId = 0 // Add event binder in the SVG namespace SVG.on = function (node, events, listener, binding, options) { - var l = listener.bind(binding || node), - n = node instanceof SVG.Element ? node.node : node + var l = listener.bind(binding || node) + var n = node instanceof SVG.Element ? node.node : node // ensure instance object for nodes which are not adopted n.instance = n.instance || {events: {}} var bag = n.instance.events - // ensure valid object - bag[ev] = bag[ev] || {} - bag[ev][ns] = bag[ev][ns] || {} - // add id to listener if (!listener._svgjsListenerId) { listener._svgjsListenerId = ++SVG.listenerId } events.split(SVG.regex.delimiter).forEach(function (event) { - var ev = event.split('.')[0], - ns = event.split('.')[1] || '*' + var ev = event.split('.')[0] + var ns = event.split('.')[1] || '*' + + // ensure valid object + bag[ev] = bag[ev] || {} + bag[ev][ns] = bag[ev][ns] || {} // reference listener bag[ev][ns][listener._svgjsListenerId] = l @@ -67,9 +67,9 @@ SVG.off = function (node, events, listener, options) { var bag = n.instance.events ;(events || '').split(SVG.regex.delimiter).forEach(function (event) { - var ev = event && event.split('.')[0], - ns = event && event.split('.')[1], - namespace + var ev = event && event.split('.')[0] + var ns = event && event.split('.')[1] + var namespace if (listener) { // remove listener reference -- 2.39.5