Sha256: 72c3bcecdededb9e3301d85b875e2d9c4ab5998534f6ff33e8b36040fc91ef9c

Contents?: true

Size: 759 Bytes

Versions: 3

Compression:

Stored size: 759 Bytes

Contents

/*
---
 
script: Clone.js
 
description: Clones an element and inserts it back to parent again
 
license: Public domain (http://unlicense.org).

authors: Yaroslaff Fedin
 
requires:
  - LSD.Action
 
provides:
  - LSD.Action.Clone
 
...
*/


LSD.Action.Clone = LSD.Action.build({
  enable: function(target, where) {
    var widget = LSD.Module.DOM.find(target);
    if (widget == target) var element = widget.element, parent = widget.parentNode;
    else var element = target, parent = widget;
    var clone = widget.layout.render(element, parent, {clone: true});
    switch(where) {
      case "before": case "after": case "top": case "bottom":
        break;
      default:
        where = 'after'
    };
    document.id(clone).inject(target, where);
  }
});

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lsd_rails-0.1.2 Packages/lsd/Source/Action/Clone.js
lsd_rails-0.1.1 Packages/lsd/Source/Action/Clone.js
lsd_rails-0.1 Packages/lsd/Source/Action/Clone.js