Sha256: 0723705f4310ef23ab0d3a4387032a5fe6ecbabe4cfa582f638d99aa88237cac

Contents?: true

Size: 918 Bytes

Versions: 7

Compression:

Stored size: 918 Bytes

Contents

/*
---
 
script: ART.Element.js
 
description: Smarter injection methods
 
license: Public domain (http://unlicense.org).

authors: Yaroslaff Fedin

extends: ART/ART.Element

provides: ART.Element.inserters
 
...
*/

!function() {
  
var inserters = {

  before: function(context, element){
    var parent = element.parentNode;
    if (parent) parent.insertBefore(context, element);
  },

  after: function(context, element){
    var parent = element.parentNode;
    if (parent) parent.insertBefore(context, element.nextSibling);
  },

  bottom: function(context, element){
    element.appendChild(context);
  },

  top: function(context, element){
    element.insertBefore(context, element.firstChild);
  }

};

ART.Element.implement({
  inject: function(element, where){
    if (element.element) element = element.element;
    inserters[where || 'bottom'](this.element, element, true);
    return this;
  }
});

}();

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
lsd_rails-0.1.6 Packages/lsd/Source/ART/ART.Element.js
lsd_rails-0.1.5 Packages/lsd/Source/ART/ART.Element.js
lsd_rails-0.1.4 Packages/lsd/Source/ART/ART.Element.js
lsd_rails-0.1.3 Packages/lsd/Source/ART/ART.Element.js
lsd_rails-0.1.2 Packages/lsd/Source/ART/ART.Element.js
lsd_rails-0.1.1 Packages/lsd/Source/ART/ART.Element.js
lsd_rails-0.1 Packages/lsd/Source/ART/ART.Element.js