diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2018-11-05 21:53:40 +0100 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2018-11-05 21:53:40 +0100 |
commit | 9f2696e8a2cf7e4eebc1cc7e31027fe2070094fa (patch) | |
tree | e3c3fc10be69a8e461c27680736f89ffb84e4165 /src | |
parent | 306b167b46bf500f710855e503b335e22ab99497 (diff) | |
download | svg.js-9f2696e8a2cf7e4eebc1cc7e31027fe2070094fa.tar.gz svg.js-9f2696e8a2cf7e4eebc1cc7e31027fe2070094fa.zip |
removed unused comments and files
Diffstat (limited to 'src')
-rw-r--r-- | src/ClipPath.js | 1 | ||||
-rw-r--r-- | src/Doc.js | 15 | ||||
-rw-r--r-- | src/Dom.js | 3 | ||||
-rw-r--r-- | src/Element.js | 9 | ||||
-rw-r--r-- | src/EventTarget.js | 10 | ||||
-rw-r--r-- | src/Gradient.js | 1 | ||||
-rw-r--r-- | src/Mask.js | 1 | ||||
-rw-r--r-- | src/PathArray.js | 217 | ||||
-rw-r--r-- | src/Pattern.js | 1 | ||||
-rw-r--r-- | src/PointArray.js | 124 | ||||
-rw-r--r-- | src/SVGArray.js | 50 | ||||
-rw-r--r-- | src/attr.js | 2 | ||||
-rw-r--r-- | src/classes.js | 91 | ||||
-rw-r--r-- | src/containers.js | 15 | ||||
-rw-r--r-- | src/elements.js | 25 | ||||
-rw-r--r-- | src/event.js | 12 | ||||
-rw-r--r-- | src/memory.js | 7 | ||||
-rw-r--r-- | src/methods.js | 5 | ||||
-rw-r--r-- | src/selector.js | 23 |
19 files changed, 29 insertions, 583 deletions
diff --git a/src/ClipPath.js b/src/ClipPath.js index 2321656..953d5cf 100644 --- a/src/ClipPath.js +++ b/src/ClipPath.js @@ -19,7 +19,6 @@ export default class ClipPath extends Container { // remove clipPath from parent return super.remove() - // return remove.call(this) } targets () { @@ -22,7 +22,6 @@ export default class Doc extends Container { doc () { if (this.isRoot()) return this return super.doc() - // return doc.call(this) } // Add namespaces @@ -51,22 +50,8 @@ export default class Doc extends Container { } return super.parent(type) - // return parent.call(this, type) } - // Removes the doc from the DOM - // remove() { - // if (!this.isRoot()) { - // return super.remove() - // } - // - // if (this.parent()) { - // this.parent().remove(this) - // } - // - // return this - // } - clear () { // remove children while (this.node.hasChildNodes()) { @@ -186,7 +186,7 @@ export default class Dom extends EventTarget { // Replace element replace (element) { - // FIXME: after might not be available here + // FIXME: after() might not be available here this.after(element).remove() return element @@ -234,4 +234,5 @@ export default class Dom extends EventTarget { return this } } + extend(Dom, { attr }) diff --git a/src/Element.js b/src/Element.js index 8161b6a..4c3dcf6 100644 --- a/src/Element.js +++ b/src/Element.js @@ -136,12 +136,3 @@ export default class Element extends Dom { return this.attr('y', y) } } - -// registerMethods('Element', { -// x, y, cx, cy, move, center, width, height, size, clone, remove, replace, -// addTo, putIn, id, inside, toString, classes, hasClass, addClass, removeClass, -// toggleClass, reference, doc, defs, parent, parents, matches, native, svg, -// writeDataToDom, setData, getEventTarget -// }) -// -// registerConstructor('Element', setup) diff --git a/src/EventTarget.js b/src/EventTarget.js index e306271..bc7a09c 100644 --- a/src/EventTarget.js +++ b/src/EventTarget.js @@ -1,6 +1,6 @@ import Base from './Base.js' import { on, off, dispatch } from './event.js' -import { extend } from './tools.js' +import { registerMethods } from './methods.js' export default class EventTarget extends Base { constructor ({ events = {} } = {}) { @@ -87,10 +87,4 @@ const methods = [ 'click', return last }, {}) -extend(EventTarget, methods) - -// registerMethods('EventTarget', { -// on, off, dispatch, fire -// }) -// -// registerConstructor('EventTarget', setup) +registerMethods('Element', methods) diff --git a/src/Gradient.js b/src/Gradient.js index 7e8075e..5d7dd2a 100644 --- a/src/Gradient.js +++ b/src/Gradient.js @@ -48,7 +48,6 @@ export default class Gradient extends Container { attr (a, b, c) { if (a === 'transform') a = 'gradientTransform' return super.attr(a, b, c) - // return attr.call(this, a, b, c) } targets () { diff --git a/src/Mask.js b/src/Mask.js index fb599b9..c5a2faa 100644 --- a/src/Mask.js +++ b/src/Mask.js @@ -20,7 +20,6 @@ export default class Mask extends Container { // remove mask from parent return super.remove() - // return remove.call(this) } targets () { diff --git a/src/PathArray.js b/src/PathArray.js index 5c4fa5e..9fa5b99 100644 --- a/src/PathArray.js +++ b/src/PathArray.js @@ -289,220 +289,3 @@ extend(PathArray, { return parser.nodes.path.getBBox() } }) - -// export default class PathArray extends SVGArray { -// constructor (array, fallback = [['M', 0, 0]]) { -// super(array, fallback) -// } -// -// // Convert array to string -// toString () { -// return arrayToString(this) -// } -// -// toArray () { -// return this.reduce(function (prev, curr) { -// return [].concat.call(prev, curr) -// }, []) -// } -// -// // Move path string -// move (x, y) { -// // get bounding box of current situation -// var box = this.bbox() -// -// // get relative offset -// x -= box.x -// y -= box.y -// -// if (!isNaN(x) && !isNaN(y)) { -// // move every point -// for (var l, i = this.length - 1; i >= 0; i--) { -// l = this[i][0] -// -// if (l === 'M' || l === 'L' || l === 'T') { -// this[i][1] += x -// this[i][2] += y -// } else if (l === 'H') { -// this[i][1] += x -// } else if (l === 'V') { -// this[i][1] += y -// } else if (l === 'C' || l === 'S' || l === 'Q') { -// this[i][1] += x -// this[i][2] += y -// this[i][3] += x -// this[i][4] += y -// -// if (l === 'C') { -// this[i][5] += x -// this[i][6] += y -// } -// } else if (l === 'A') { -// this[i][6] += x -// this[i][7] += y -// } -// } -// } -// -// return this -// } -// -// // Resize path string -// size (width, height) { -// // get bounding box of current situation -// var box = this.bbox() -// var i, l -// -// // recalculate position of all points according to new size -// for (i = this.length - 1; i >= 0; i--) { -// l = this[i][0] -// -// if (l === 'M' || l === 'L' || l === 'T') { -// this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x -// this[i][2] = ((this[i][2] - box.y) * height) / box.height + box.y -// } else if (l === 'H') { -// this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x -// } else if (l === 'V') { -// this[i][1] = ((this[i][1] - box.y) * height) / box.height + box.y -// } else if (l === 'C' || l === 'S' || l === 'Q') { -// this[i][1] = ((this[i][1] - box.x) * width) / box.width + box.x -// this[i][2] = ((this[i][2] - box.y) * height) / box.height + box.y -// this[i][3] = ((this[i][3] - box.x) * width) / box.width + box.x -// this[i][4] = ((this[i][4] - box.y) * height) / box.height + box.y -// -// if (l === 'C') { -// this[i][5] = ((this[i][5] - box.x) * width) / box.width + box.x -// this[i][6] = ((this[i][6] - box.y) * height) / box.height + box.y -// } -// } else if (l === 'A') { -// // resize radii -// this[i][1] = (this[i][1] * width) / box.width -// this[i][2] = (this[i][2] * height) / box.height -// -// // move position values -// this[i][6] = ((this[i][6] - box.x) * width) / box.width + box.x -// this[i][7] = ((this[i][7] - box.y) * height) / box.height + box.y -// } -// } -// -// return this -// } -// -// // Test if the passed path array use the same path data commands as this path array -// equalCommands (pathArray) { -// var i, il, equalCommands -// -// pathArray = new PathArray(pathArray) -// -// equalCommands = this.length === pathArray.value.length -// for (i = 0, il = this.length; equalCommands && i < il; i++) { -// equalCommands = this[i][0] === pathArray.value[i][0] -// } -// -// return equalCommands -// } -// -// // Make path array morphable -// morph (pathArray) { -// pathArray = new PathArray(pathArray) -// -// if (this.equalCommands(pathArray)) { -// this.destination = pathArray -// } else { -// this.destination = null -// } -// -// return this -// } -// -// // Get morphed path array at given position -// at (pos) { -// // make sure a destination is defined -// if (!this.destination) return this -// -// var sourceArray = this -// var destinationArray = this.destination.value -// var array = [] -// var pathArray = new PathArray() -// var i, il, j, jl -// -// // Animate has specified in the SVG spec -// // See: https://www.w3.org/TR/SVG11/paths.html#PathElement -// for (i = 0, il = sourceArray.length; i < il; i++) { -// array[i] = [sourceArray[i][0]] -// for (j = 1, jl = sourceArray[i].length; j < jl; j++) { -// array[i][j] = sourceArray[i][j] + (destinationArray[i][j] - sourceArray[i][j]) * pos -// } -// // For the two flags of the elliptical arc command, the SVG spec say: -// // Flags and booleans are interpolated as fractions between zero and one, with any non-zero value considered to be a value of one/true -// // Elliptical arc command as an array followed by corresponding indexes: -// // ['A', rx, ry, x-axis-rotation, large-arc-flag, sweep-flag, x, y] -// // 0 1 2 3 4 5 6 7 -// if (array[i][0] === 'A') { -// array[i][4] = +(array[i][4] !== 0) -// array[i][5] = +(array[i][5] !== 0) -// } -// } -// -// // Directly modify the value of a path array, this is done this way for performance -// pathArray.value = array -// return pathArray -// } -// -// // Absolutize and parse path to array -// parse (array) { -// // if it's already a patharray, no need to parse it -// if (array instanceof PathArray) return array.valueOf() -// -// // prepare for parsing -// var s -// var paramCnt = { 'M': 2, 'L': 2, 'H': 1, 'V': 1, 'C': 6, 'S': 4, 'Q': 4, 'T': 2, 'A': 7, 'Z': 0 } -// -// if (typeof array === 'string') { -// array = array -// .replace(numbersWithDots, pathRegReplace) // convert 45.123.123 to 45.123 .123 -// .replace(pathLetters, ' $& ') // put some room between letters and numbers -// .replace(hyphen, '$1 -') // add space before hyphen -// .trim() // trim -// .split(delimiter) // split into array -// } else { -// array = array.reduce(function (prev, curr) { -// return [].concat.call(prev, curr) -// }, []) -// } -// -// // array now is an array containing all parts of a path e.g. ['M', '0', '0', 'L', '30', '30' ...] -// var result = [] -// var p = new Point() -// var p0 = new Point() -// var index = 0 -// var len = array.length -// -// do { -// // Test if we have a path letter -// if (isPathLetter.test(array[index])) { -// s = array[index] -// ++index -// // If last letter was a move command and we got no new, it defaults to [L]ine -// } else if (s === 'M') { -// s = 'L' -// } else if (s === 'm') { -// s = 'l' -// } -// -// result.push(pathHandlers[s].call(null, -// array.slice(index, (index = index + paramCnt[s.toUpperCase()])).map(parseFloat), -// p, p0 -// ) -// ) -// } while (len > index) -// -// return result -// } -// -// // Get bounding box of path -// bbox () { -// parser().path.setAttribute('d', this.toString()) -// return parser.nodes.path.getBBox() -// } -// } diff --git a/src/Pattern.js b/src/Pattern.js index 6f56e58..4a3e1ad 100644 --- a/src/Pattern.js +++ b/src/Pattern.js @@ -39,7 +39,6 @@ export default class Pattern extends Container { attr (a, b, c) { if (a === 'transform') a = 'patternTransform' return super.attr(a, b, c) - // return attr.call(this, a, b, c) } targets () { diff --git a/src/PointArray.js b/src/PointArray.js index 68aeddc..42299e0 100644 --- a/src/PointArray.js +++ b/src/PointArray.js @@ -118,127 +118,3 @@ extend(PointArray, { return { x: minX, y: minY, width: maxX - minX, height: maxY - minY } } }) - -// export default class PointArray extends SVGArray { -// constructor (array, fallback = [[0, 0]]) { -// super(array, fallback) -// } -// -// // Convert array to string -// toString () { -// // convert to a poly point string -// for (var i = 0, il = this.length, array = []; i < il; i++) { -// array.push(this[i].join(',')) -// } -// -// return array.join(' ') -// } -// -// // toArray () { -// // return this.reduce(function (prev, curr) { -// // return [].concat.call(prev, curr) -// // }, []) -// // } -// -// // Convert array to line object -// toLine () { -// return { -// x1: this[0][0], -// y1: this[0][1], -// x2: this[1][0], -// y2: this[1][1] -// } -// } -// -// // Get morphed array at given position -// at (pos) { -// // make sure a destination is defined -// if (!this.destination) return this -// -// // generate morphed point string -// for (var i = 0, il = this.length, array = []; i < il; i++) { -// array.push([ -// this[i][0] + (this.destination[i][0] - this[i][0]) * pos, -// this[i][1] + (this.destination[i][1] - this[i][1]) * pos -// ]) -// } -// -// return new PointArray(array) -// } -// -// // Parse point string and flat array -// parse (array) { -// var points = [] -// -// array = array.valueOf() -// -// // if it is an array -// if (Array.isArray(array)) { -// // and it is not flat, there is no need to parse it -// if (Array.isArray(array[0])) { -// return array -// } -// } else { // Else, it is considered as a string -// // parse points -// array = array.trim().split(delimiter).map(parseFloat) -// } -// -// // validate points - https://svgwg.org/svg2-draft/shapes.html#DataTypePoints -// // Odd number of coordinates is an error. In such cases, drop the last odd coordinate. -// if (array.length % 2 !== 0) array.pop() -// -// // wrap points in two-tuples and parse points as floats -// for (var i = 0, len = array.length; i < len; i = i + 2) { -// points.push([ array[i], array[i + 1] ]) -// } -// -// return points -// } -// -// // Move point string -// move (x, y) { -// var box = this.bbox() -// -// // get relative offset -// x -= box.x -// y -= box.y -// -// // move every point -// if (!isNaN(x) && !isNaN(y)) { -// for (var i = this.length - 1; i >= 0; i--) { -// this[i] = [this[i][0] + x, this[i][1] + y] -// } -// } -// -// return this -// } -// -// // Resize poly string -// size (width, height) { -// var i -// var box = this.bbox() -// -// // recalculate position of all points according to new size -// for (i = this.length - 1; i >= 0; i--) { -// if (box.width) this[i][0] = ((this[i][0] - box.x) * width) / box.width + box.x -// if (box.height) this[i][1] = ((this[i][1] - box.y) * height) / box.height + box.y -// } -// -// return this -// } -// -// // Get bounding box of points -// bbox () { -// var maxX = -Infinity -// var maxY = -Infinity -// var minX = Infinity -// var minY = Infinity -// this.forEach(function (el) { -// maxX = Math.max(el[0], maxX) -// maxY = Math.max(el[1], maxY) -// minX = Math.min(el[0], minX) -// minY = Math.min(el[1], minY) -// }) -// return {x: minX, y: minY, width: maxX - minX, height: maxY - minY} -// } -// } diff --git a/src/SVGArray.js b/src/SVGArray.js index 247f0b2..351e166 100644 --- a/src/SVGArray.js +++ b/src/SVGArray.js @@ -10,15 +10,11 @@ export default SVGArray extend(SVGArray, { init (...args) { - // this.splice(0, this.length) this.length = 0 this.push(...this.parse(...args)) }, toArray () { - // const ret = [] - // ret.push(...this) - // return ret return Array.prototype.concat.apply([], this) }, @@ -31,13 +27,10 @@ extend(SVGArray, { const ret = [] ret.push(...this) return ret - // return this.toArray() }, // Parse whitespace separated string parse (array = []) { - // array = array.valueOf() - // If already is an array, no need to parse it if (array instanceof Array) return array @@ -52,46 +45,3 @@ extend(SVGArray, { return new Set(this) } }) - -// export default class SVGArray extends BaseArray { -// constructor (...args) { -// super() -// this.init(...args) -// } -// -// init (array, fallback = []) { -// //this.splice(0, this.length) -// this.length = 0 -// this.push(...this.parse(array || fallback)) -// } -// -// toArray () { -// return [].concat(this) -// } -// -// toString () { -// return this.join(' ') -// } -// -// valueOf () { -// return this.toArray() -// } -// -// // Parse whitespace separated string -// parse (array) { -// array = array.valueOf() -// -// // if already is an array, no need to parse it -// if (Array.isArray(array)) return array -// -// return array.trim().split(delimiter).map(parseFloat) -// } -// -// clone () { -// return new this.constructor(this) -// } -// -// toSet () { -// return new Set(this) -// } -// } diff --git a/src/attr.js b/src/attr.js index cccc340..f3aa230 100644 --- a/src/attr.js +++ b/src/attr.js @@ -79,5 +79,3 @@ export default function attr (attr, val, ns) { return this } - -// registerMethods('Element', {attr}) diff --git a/src/classes.js b/src/classes.js index a4cc758..8e1b866 100644 --- a/src/classes.js +++ b/src/classes.js @@ -1,87 +1,44 @@ -export { default as EventTarget } from './EventTarget.js' -export { default as Dom } from './Dom.js' -export { default as Element } from './Element.js' -export { default as Shape } from './Shape.js' -export { default as Container } from './Container.js' -export { default as HtmlNode } from './HtmlNode.js' -export { default as Doc } from './Doc.js' -export { default as Defs } from './Defs.js' -export { default as G } from './G.js' export { default as Animator } from './Animator.js' +export { default as SVGArray } from './SVGArray.js' export { default as Bare } from './Bare.js' +export { default as Box } from './Box.js' export { default as Circle } from './Circle.js' export { default as ClipPath } from './ClipPath.js' -export { default as A } from './A.js' +export { default as Color } from './Color.js' +export { default as Container } from './Container.js' +export { Controller, Ease, PID, Spring } from './Controller.js' +export { default as Defs } from './Defs.js' +export { default as Doc } from './Doc.js' +export { default as Dom } from './Dom.js' +export { default as Element } from './Element.js' export { default as Ellipse } from './Ellipse.js' -export { default as Stop } from './Stop.js' +export { default as EventTarget } from './EventTarget.js' export { default as Gradient } from './Gradient.js' +export { default as G } from './G.js' +export { default as HtmlNode } from './HtmlNode.js' +export { default as A } from './A.js' export { default as Image } from './Image.js' export { default as Line } from './Line.js' export { default as Marker } from './Marker.js' export { default as Mask } from './Mask.js' +export { default as Matrix } from './Matrix.js' +export { default as Morphable } from './Morphable.js' +export { default as SVGNumber } from './SVGNumber.js' export { default as Path } from './Path.js' +export { default as PathArray } from './PathArray.js' export { default as Pattern } from './Pattern.js' +export { default as Point } from './Point.js' +export { default as PointArray } from './PointArray.js' export { default as Polygon } from './Polygon.js' export { default as Polyline } from './Polyline.js' +export { default as Queue } from './Queue.js' export { default as Rect } from './Rect.js' +export { default as Runner } from './Runner.js' +export { default as Shape } from './Shape.js' +export { default as Stop } from './Stop.js' export { default as Symbol } from './Symbol.js' export { default as Text } from './Text.js' export { default as TextPath } from './TextPath.js' +export { default as Timeline } from './Timeline.js' export { default as Tspan } from './Tspan.js' export { default as Use } from './Use.js' -export { default as SVGNumber } from './SVGNumber.js' -export { default as SVGArray } from './SVGArray.js' -export { default as PathArray } from './PathArray.js' -export { default as PointArray } from './PointArray.js' -export { default as Matrix } from './Matrix.js' -export { default as Point } from './Point.js' -export { default as Box } from './Box.js' -export { default as Color } from './Color.js' -export { default as Morphable } from './Morphable.js' -export { default as Queue } from './Queue.js' -export { default as Runner } from './Runner.js' -export { default as Timeline } from './Timeline.js' -export { Controller, Ease, PID, Spring } from './Controller.js' - -// export {default as Animator} from './Animator.js' -// export {default as SVGArray} from './SVGArray.js' -// export {default as Bare} from './Bare.js' -// export {default as Box} from './Box.js' -// export {default as Circle} from './Circle.js' -// export {default as ClipPath} from './ClipPath.js' -// export {default as Color} from './Color.js' -// export {default as Container} from './Container.js' -// export {Controller, Ease, PID, Spring} from './Controller.js' -// export {default as Defs} from './Defs.js' -// export {default as Doc} from './Doc.js' -// export {default as Element} from './Element.js' -// export {default as Ellipse} from './Ellipse.js' -// export {default as EventTarget} from './EventTarget.js' -// export {default as Gradient} from './Gradient.js' -// export {default as G} from './G.js' -// export {default as HtmlNode} from './HtmlNode.js' -// export {default as A} from './A.js' -// export {default as Image} from './Image.js' -// export {default as Line} from './Line.js' -// export {default as Marker} from './Marker.js' -// export {default as Mask} from './Mask.js' -// export {default as Matrix} from './Matrix.js' -// export {default as Morphable} from './Morphable.js' -// export {default as SVGNumber} from './SVGNumber.js' -// export {default as Path} from './Path.js' -// export {default as PathArray} from './PathArray.js' -// export {default as Pattern} from './Pattern.js' -// export {default as Point} from './Point.js' -// export {default as PointArray} from './PointArray.js' -// export {default as Polygon} from './Polygon.js' -// export {default as Polyline} from './Polyline.js' -// export {default as Queue} from './Queue.js' -// export {default as Rect} from './Rect.js' -// export {default as Runner} from './Runner.js' -// export {default as Shape} from './Shape.js' -// export {default as Stop} from './Stop.js' -// export {default as Symbol} from './Symbol.js' -// export {default as Text} from './Text.js' -// export {default as TextPath} from './TextPath.js' -// export {default as Timeline} from './Timeline.js' -// export {default as Use} from './Use.js' diff --git a/src/containers.js b/src/containers.js deleted file mode 100644 index 02869e4..0000000 --- a/src/containers.js +++ /dev/null @@ -1,15 +0,0 @@ -export { default as Bare } from './Bare.js' -export { default as ClipPath } from './ClipPath.js' -export { default as Defs } from './Defs.js' -export { default as Doc } from './Doc.js' -export { default as Gradient } from './Gradient.js' -export { default as G } from './G.js' -export { default as A } from './A.js' -export { default as Marker } from './Marker.js' -export { default as Mask } from './Mask.js' -export { default as Pattern } from './Pattern.js' -export { default as Symbol } from './Symbol.js' - -export { default as Text } from './Text.js' -export { default as Tspan } from './Tspan.js' -export { default as TextPath } from './TextPath.js' diff --git a/src/elements.js b/src/elements.js deleted file mode 100644 index b09d6e8..0000000 --- a/src/elements.js +++ /dev/null @@ -1,25 +0,0 @@ -export { default as Bare } from './Bare.js' -export { default as Circle } from './Circle.js' -export { default as ClipPath } from './ClipPath.js' -export { default as Defs } from './Defs.js' -export { default as Doc } from './Doc.js' -export { default as Ellipse } from './Ellipse.js' -export { default as Gradient } from './Gradient.js' -export { default as G } from './G.js' -export { default as HtmlNode } from './HtmlNode.js' -export { default as A } from './A.js' -export { default as Image } from './Image.js' -export { default as Line } from './Line.js' -export { default as Marker } from './Marker.js' -export { default as Mask } from './Mask.js' -export { default as Path } from './Path.js' -export { default as Pattern } from './Pattern.js' -export { default as Polygon } from './Polygon.js' -export { default as Polyline } from './Polyline.js' -export { default as Rect } from './Rect.js' -export { default as Stop } from './Stop.js' -export { default as Symbol } from './Symbol.js' -export { default as Text } from './Text.js' -export { default as TextPath } from './TextPath.js' -export { default as Tspan } from './Tspan.js' -export { default as Use } from './Use.js' diff --git a/src/event.js b/src/event.js index 8cd4188..d3cf26d 100644 --- a/src/event.js +++ b/src/event.js @@ -27,12 +27,6 @@ export function on (node, events, listener, binding, options) { // events can be an array of events or a string of events events = Array.isArray(events) ? events : events.split(delimiter) - // ensure instance object for nodes which are not adopted - // n.instance = n.instance || {events: {}} - - // pull event handlers from the element - // var bag = n.instance.events - // add id to listener if (!listener._svgjsListenerId) { listener._svgjsListenerId = ++listenerId @@ -59,18 +53,12 @@ export function off (node, events, listener, options) { var bag = getEvents(node) var n = getEventTarget(node) - // we cannot remove an event if its not an svg.js instance - // if (!n.instance) return - // listener can be a function or a number if (typeof listener === 'function') { listener = listener._svgjsListenerId if (!listener) return } - // pull event handlers from the element - // var bag = n.instance.events - // events can be an array of events or a string or undefined events = Array.isArray(events) ? events : (events || '').split(delimiter) diff --git a/src/memory.js b/src/memory.js index 3f81c6f..9c826a2 100644 --- a/src/memory.js +++ b/src/memory.js @@ -1,10 +1,6 @@ import { registerMethods } from './methods.js' -// export const name = 'Memory' -// -// export function setup (node) { -// this._memory = {} -// } +// FIXME: We need a constructor to set this up // Remember arbitrary data export function remember (k, v) { @@ -42,4 +38,3 @@ export function memory () { } registerMethods('Dom', { remember, forget, memory }) -// registerConstructor('Memory', setup) diff --git a/src/methods.js b/src/methods.js index f926598..2373445 100644 --- a/src/methods.js +++ b/src/methods.js @@ -23,11 +23,6 @@ export function getMethodsFor (name) { return methods[name] || {} } -// FIXME: save memory? -// export function cleanMethods () { -// methods = {} -// } - export function registerConstructor (name, setup) { constructors[name] = setup } diff --git a/src/selector.js b/src/selector.js index 6ee1207..7208153 100644 --- a/src/selector.js +++ b/src/selector.js @@ -2,29 +2,6 @@ import { map } from './utils.js' import { adopt } from './adopter.js' import { registerMethods } from './methods.js' -// // Method for getting an element by id -// SVG.get = function (id) { -// var node = document.getElementById(idFromReference(id) || id) -// return SVG.adopt(node) -// } -// -// // Select elements by query string -// SVG.select = function (query, parent) { -// return SVG.utils.map((parent || document).querySelectorAll(query), function (node) { -// return SVG.adopt(node) -// }) -// } -// -// SVG.$$ = function (query, parent) { -// return SVG.utils.map((parent || document).querySelectorAll(query), function (node) { -// return SVG.adopt(node) -// }) -// } -// -// SVG.$ = function (query, parent) { -// return SVG.adopt((parent || document).querySelector(query)) -// } - export default function baseFind (query, parent) { return map((parent || document).querySelectorAll(query), function (node) { return adopt(node) |