diff --git a/dist/reference.html b/dist/reference.html index 705386e..a64b81a 100644 --- a/dist/reference.html +++ b/dist/reference.html @@ -31,10 +31,10 @@

Element

-

Element.add()

+

Element.add()

Element.after(el)

+

Element.after(el)

Inserts given element after the current one.

Parameters

  1. el @@ -42,7 +42,7 @@ element to insert

Returns: Element parent

-

Element.animate(attrs, ms, [easing], [callback])

+

Element.animate(attrs, ms, [easing], [callback])

Animate given attributes of the element.

Parameters

  1. attrs @@ -61,7 +61,7 @@  

Returns: Element the element

-

Element.append(el)

+

Element.append(el)

Appends given element to current one.

Parameters

  1. el @@ -69,7 +69,7 @@ element to append

Returns: Element parent

-

Element.asPX(attr, [value])

+

Element.asPX(attr, [value])

Return given attribute of the element as a px value. (Not %, em, etc)

Parameters

  1. attr @@ -106,7 +106,7 @@ }); console.log(el.attr("fill")); // “#fc0”
-

Element.before(el)

+

Element.before(el)

Inserts given element before the current one.

Parameters

  1. el @@ -122,11 +122,11 @@ console.log(el.attr("fill")); // “#fc0” handler for the event

Returns: object Element

-

Element.clone()

+

Element.clone()

Creates clone of the element and inserts it after the element.

Returns: Element the clone

-

Element.data(key, [value])

+

Element.data(key, [value])

Adds or retrieves given value asociated with given key. See also Element.removeData

@@ -207,7 +207,7 @@ See also Element.removeData
  1. eventobjectDOM event object

Returns: object Element

-

Element.getBBox()

+

Element.getBBox()

Returns bounding box descriptor for the given element.

Returns: object bounding box descriptor:

@@ -273,7 +273,7 @@ See also Element.removeData context for hover out handler

Returns: object Element

-

Element.inAnim()

+

Element.inAnim()

Returns an array of animations element currently in

Returns: object in format

@@ -282,7 +282,7 @@ See also Element.removeData
  • statusfunctiongets or sets the status of the animation,
  • stopfunctionstops the animation
  • }
  • -

    Element.insertAfter(el)

    +

    Element.insertAfter(el)

    Inserts the element after the given one.

    Parameters

    1. el @@ -290,7 +290,7 @@ See also Element.removeData element next to whom insert to

    Returns: Element parent

    -

    Element.insertBefore(el)

    +

    Element.insertBefore(el)

    Inserts the element after the given one.

    Parameters

    1. el @@ -298,7 +298,7 @@ See also Element.removeData element next to whom insert to

    Returns: Element parent

    -

    Element.marker(x, y, width, height, refX, refY)

    +

    Element.marker(x, y, width, height, refX, refY)

    Creates <marker> element from the current element. To create a marker you have to specify the bounding rect and reference point:

    @@ -371,11 +371,11 @@ To create a marker you have to specify the bounding rect and reference point: function handler for event, first argument would be the element you are dragging over
    -

    Element.parent()

    +

    Element.parent()

    Returns parent of the element

    Returns: Element parent

    -

    Element.pattern(x, y, width, height)

    +

    Element.pattern(x, y, width, height)

    Creates <pattern> element from the current element. To create a pattern you have to specify the pattern rect:

    @@ -405,7 +405,7 @@ c.attr({ fill: p });
    -

    Element.prepend(el)

    +

    Element.prepend(el)

    Prepends given element to current one.

    Parameters

    1. el @@ -413,10 +413,11 @@ c.attr({ element to prepend

    Returns: Element parent

    -

    Element.remove()

    +

    Element.remove()

    Removes element from the DOM

    -

    Element.removeData([key])

    +

    Returns: Element removed element

    +

    Element.removeData([key])

    Removes value associated with an element by given key. If key is not provided, removes all the data of the element.

    @@ -426,7 +427,7 @@ If key is not provided, removes all the data of the element. key

    Returns: object Element

    -

    Element.select(query)

    +

    Element.select(query)

    Applies CSS selector with the element as a parent and returns the result as an Element.

    Parameters

    1. query @@ -434,7 +435,7 @@ If key is not provided, removes all the data of the element. CSS selector

    Returns: Element result of query selection

    -

    Element.selectAll(query)

    +

    Element.selectAll(query)

    Applies CSS selector with the element as a parent and returns the result as a set or array of elements.

    Parameters

    1. query @@ -442,7 +443,7 @@ If key is not provided, removes all the data of the element. CSS selector

    Returns: Set array result of query selection

    -

    Element.stop()

    +

    Element.stop()

    Stops all the animations of the current element.

    Returns: Element the element

    @@ -478,7 +479,7 @@ If key is not provided, removes all the data of the element. handler for the event

    Returns: object Element

    -

    Element.transform(tstr)

    +

    Element.transform(tstr)

    Gets or sets transformation of the element

    Parameters

    1. tstr @@ -599,15 +600,15 @@ If key is not provided, removes all the data of the element. handler for the event

    Returns: object Element

    -

    Element.use()

    +

    Element.use()

    Creates <use> element linked to the current element.

    Returns: Element <use> element

    Fragment

    -

    Fragment.select()

    +

    Fragment.select()

    Fragment.selectAll()

    +

    Fragment.selectAll()

    Matrix

    @@ -725,7 +726,7 @@ If key is not provided, removes all the data of the element.

    Returns: number y

    Paper

    -

    Paper.circle(x, y, r)

    +

    Paper.circle(x, y, r)

    Draws a circle.

    Parameters

    1. x @@ -741,7 +742,7 @@ If key is not provided, removes all the data of the element.

      Returns: object Element object with type “circle”

      Usage

      var c = paper.circle(50, 50, 40);
       
      -

    Paper.el(name, attr)

    +

    Paper.el(name, attr)

    Creates element on paper with a given name and no attributes.

    Parameters

    1. name @@ -759,7 +760,7 @@ var c = paper.el("circle").attr({ r: 10 });
    -

    Paper.ellipse(x, y, rx, ry)

    +

    Paper.ellipse(x, y, rx, ry)

    Draws an ellipse.

    Parameters

    1. x @@ -833,7 +834,7 @@ var c = paper.el("circle").attr({ filter: f });
    -

    Paper.g([varargs])

    +

    Paper.g([varargs])

    Makes a group element.

    Parameters

    1. varargs @@ -853,7 +854,7 @@ var c = paper.el("circle").attr({ g = paper.g(); g.add(c2, c1);
    -

    Paper.gradient(gradient)

    +

    Paper.gradient(gradient)

    Creates a gradient element.

    Parameters

    1. gradient @@ -891,10 +892,10 @@ through red at 25% to white. });

    Returns: object Element object with type “gradient”

    -

    Paper.group()

    +

    Paper.group()

    See Paper.g

    -

    Paper.image(src, x, y, width, height)

    +

    Paper.image(src, x, y, width, height)

    Embeds an image into the surface.

    Parameters

    1. src @@ -937,7 +938,7 @@ through red at 25% to white.

      Returns: object Element object with type “image”

      Usage

      var c = paper.image("apple.png", 10, 10, 80, 80);
       
      -

    Paper.line(x1, y1, x2, y2)

    +

    Paper.line(x1, y1, x2, y2)

    Draws a line.

    Parameters

    1. x1 @@ -956,7 +957,7 @@ through red at 25% to white.

      Returns: object Element object with type “line”

      Usage

      var t1 = paper.line(50, 50, 100, 100);
       
      -

    Paper.path([pathString])

    +

    Paper.path([pathString])

    Creates a path element by given path data string.

    Parameters

    1. pathString @@ -991,10 +992,10 @@ Note: there is a special case when path consist of just three commands: “M10,1 // draw a diagonal line: // move to 10,10, line to 90,90
    -

    Paper.polygon()

    +

    Paper.polygon()

    Draws a polygon. See Paper.polyline

    -

    Paper.polyline(…)

    +

    Paper.polyline(…)

    Draws a polyline.

    Parameters

    1. points @@ -1011,7 +1012,7 @@ Note: there is a special case when path consist of just three commands: “M10,1

      Usage

      var p1 = paper.polyline([10, 10, 100, 100]);
       var p2 = paper.polyline(10, 10, 100, 100);
       
      -

    Paper.rect(x, y, width, height, [rx], [ry])

    +

    Paper.rect(x, y, width, height, [rx], [ry])

    Draws a rectangle.

    @@ -1042,7 +1043,7 @@ var c = paper.rect(10, 10, 50, 50); // rectangle with rounded corners var c = paper.rect(40, 40, 50, 50, 10);
    -

    Paper.text(x, y, text)

    +

    Paper.text(x, y, text)

    Draws a text string.

    Parameters

    1. x @@ -1059,7 +1060,7 @@ var c = paper.rect(40, 40, 50, 50, 10);

      Usage

      var t1 = paper.text(50, 50, "Savage");
       var t2 = paper.text(50, 50, ["S","a","v","a","g","e"]);
       
      -

    Paper.toString()

    +

    Paper.toString()

    Returns SVG code of the Paper.

    Returns: string SVG code of the Paper.

    @@ -1094,7 +1095,7 @@ Returns matrix based on given parameters.  

    Returns: object Matrix

    -

    Savage.ajax(…)

    +

    Savage.ajax(…)

    Simple implementation of Ajax.

    Parameters

    1. url @@ -1125,7 +1126,7 @@ Returns matrix based on given parameters. scope of callback

    Returns: XMLHttpRequest XMLHttpRequest (just in case)

    -

    Savage.animate(from, to, setter, ms, [easing], [callback])

    +

    Savage.animate(from, to, setter, ms, [easing], [callback])

    Runs generic animation of one number into another with a caring function.

    Parameters

    1. from @@ -1157,7 +1158,7 @@ Returns matrix based on given parameters.
    2. statusfunctiongets or sets the status of the animation,
    3. stopfunctionstops the animation
  • }
  • -

    Savage.animation(attr, ms, [easing], [callback])

    +

    Savage.animation(attr, ms, [easing], [callback])

    Creates animation object.

    Parameters

    1. attr @@ -1269,7 +1270,7 @@ paper.path(Savage.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width } }));
    -

    Savage.fragment(varargs)

    +

    Savage.fragment(varargs)

    Creates DOM fragment from given list of elements or strings

    Parameters

    1. varargs @@ -1379,7 +1380,7 @@ paper.path(Savage.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width name of the type, i.e. “string”, “function”, “number”, etc.

    Returns: boolean is given value is of given type

    -

    Savage.load(url, callback, [scope])

    +

    Savage.load(url, callback, [scope])

    Loads external SVG file as a Fragment. For more advanced AJAX see Savage.ajax.

    Parameters

    1. url @@ -1393,7 +1394,7 @@ paper.path(Savage.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width object scope of callback
    -

    Savage.parse(svg)

    +

    Savage.parse(svg)

    Parses SVG fragment and converts it into Fragment.

    Parameters

    1. svg diff --git a/src/svg.js b/src/svg.js index 53e4fc4..3815253 100644 --- a/src/svg.js +++ b/src/svg.js @@ -1648,11 +1648,13 @@ function arrayFirstValue(arr) { [ method ] ** * Removes element from the DOM + = (Element) removed element \*/ elproto.remove = function () { this.node.parentNode.removeChild(this.node); delete this.paper; this.removed = true; + return this; }; /*\ * Element.select