Commit 95ebe5a2 by Tomas Alabes

Allows Element.data() to be called with 0 params to get all associated data. By @AdamTReineke

parent 5423c26b
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -3053,6 +3053,8 @@
= (object) @Element
* or, if value is not specified:
= (any) value
* or, if key and value are not specified:
= (object) Key/value pairs for all the data associated with the element.
> Usage
| for (var i = 0, i < 5, i++) {
| paper.circle(10 + 15 * i, 10, 10)
......@@ -3065,6 +3067,9 @@
\*/
elproto.data = function (key, value) {
var data = eldata[this.id] = eldata[this.id] || {};
if (arguments.length == 0) {
return data;
}
if (arguments.length == 1) {
if (R.is(key, "object")) {
for (var i in key) if (key[has](i)) {
......
......@@ -3432,6 +3432,8 @@
= (object) @Element
* or, if value is not specified:
= (any) value
* or, if key and value are not specified:
= (object) Key/value pairs for all the data associated with the element.
> Usage
| for (var i = 0, i < 5, i++) {
| paper.circle(10 + 15 * i, 10, 10)
......@@ -3444,6 +3446,9 @@
\*/
elproto.data = function (key, value) {
var data = eldata[this.id] = eldata[this.id] || {};
if (arguments.length == 0) {
return data;
}
if (arguments.length == 1) {
if (R.is(key, "object")) {
for (var i in key) if (key[has](i)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment