diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2015-02-22 14:27:45 +0100 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2015-02-22 14:27:45 +0100 |
commit | 4b2e055187f2f33d14f9e7573ce34b9333b553a3 (patch) | |
tree | 747caedf93b1e3b98c34d8efbc7d28aa50494e71 /src | |
parent | 6bb7b47b00205509917237c6c175c8cf0d5bcd71 (diff) | |
download | svg.js-4b2e055187f2f33d14f9e7573ce34b9333b553a3.tar.gz svg.js-4b2e055187f2f33d14f9e7573ce34b9333b553a3.zip |
Fixed Custom Events with data #317
Keeps the `registerEvent`-function only for consistency
Diffstat (limited to 'src')
-rwxr-xr-x | src/event.js | 17 | ||||
-rwxr-xr-x | src/text.js | 3 |
2 files changed, 4 insertions, 16 deletions
diff --git a/src/event.js b/src/event.js index 63764ed..d7a83b2 100755 --- a/src/event.js +++ b/src/event.js @@ -27,15 +27,11 @@ }) -// Initialize events and listeners stack -SVG.events = {} +// Initialize listeners stack SVG.listeners = {} -// Event constructor -SVG.registerEvent = function(event) { - if (!SVG.events[event]) - SVG.events[event] = new CustomEvent(event) -} +// Only kept for consistency of API +SVG.registerEvent = function(){}; // Add event binder in the SVG namespace SVG.on = function(node, event, listener) { @@ -100,14 +96,9 @@ SVG.extend(SVG.Element, { } // Fire given event , fire: function(event, data) { - // Add detail data to event - SVG.events[event].detail = data // Dispatch event - this.node.dispatchEvent(SVG.events[event]) - - // Remove detail - delete SVG.events[event].detail + this.node.dispatchEvent(new CustomEvent(event, {detail:data})) return this } diff --git a/src/text.js b/src/text.js index 1b6bd94..38d4ecc 100755 --- a/src/text.js +++ b/src/text.js @@ -222,6 +222,3 @@ SVG.extend(SVG.Text, SVG.TSpan, { return this.node.getComputedTextLength() } }) - -// Register rebuild event -SVG.registerEvent('rebuild') |