From 09e7d0b595da5a2e86e375ea4bd9bd7aba02c588 Mon Sep 17 00:00:00 2001 From: Ulrich-Matthias Schäfer Date: Thu, 8 Nov 2018 19:49:49 +0100 Subject: added possibility to pass in additional attribues to element creators (#796) e.g. - `canvas.rect({x:100})` or - `canvas.rect(100, 100, {x:100})` --- src/elements/Path.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/elements/Path.js') diff --git a/src/elements/Path.js b/src/elements/Path.js index c8a4de4..dc27320 100644 --- a/src/elements/Path.js +++ b/src/elements/Path.js @@ -1,4 +1,4 @@ -import { nodeOrNew, register } from '../utils/adopter.js' +import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js' import { proportionalSize } from '../utils/utils.js' import { registerMethods } from '../utils/methods.js' import PathArray from '../types/PathArray.js' @@ -71,10 +71,10 @@ Path.prototype.MorphArray = PathArray registerMethods({ Container: { // Create a wrapped path element - path (d) { + path: wrapWithAttrCheck(function (d) { // make sure plot is called as a setter return this.put(new Path()).plot(d || new PathArray()) - } + }) } }) -- cgit v1.2.3