Sha256: 1c0c9f853cc66804bb222e58f93ec3932f25cbdcdd83da6d2402431920294162

Contents?: true

Size: 1.47 KB

Versions: 7

Compression:

Stored size: 1.47 KB

Contents

if ('outerHTML' in document.documentElement) {
  Element.HtmlToDom = function(element,content){
    var div = new Element('div');
    div.set("html",content);
    return $A(div.childNodes);    
  };
} else {
  Element.HtmlToDom = function(element,content) {
    var range = element.ownerDocument.createRange();
    range.selectNode(element);
    return $A([range.createContextualFragment(content.stripScripts())]);
  };  
};

Element.implement({
	replace: function(content) {
	  var scripts = "";
	  var nc = content.stripScripts(function(s){ scripts = s; });
	  
    if ('outerHTML' in document.documentElement) {	  
      this.outerHTML = nc;
  	} else {
  		var el = Element.HtmlToDom(this,nc)[0];
  		this.parentNode.replaceChild(el, this);	  
  	}
  	$exec(scripts);
	},
	
	replaceHTML: function(content) {		
		this.set('html', content);
		content.stripScripts(true);
	},	
	
	append: function(position, content) {
	  var scripts = "";
	  var nc = content.stripScripts(function(s){ scripts = s; });
    var els = Element.HtmlToDom(this,nc);
    if (position == 'top' || position == 'after'){ els.reverse(); };
    els.each(function(el){
      Element.inject(el,this,position);
    }.bind(this));
    $exec(scripts);
	},
	
	appendTop: function(content) { this.append('top', content); },
	
	appendBottom: function(content) { this.append('bottom', content); },
	
	appendAfter: function(content) { this.append('after', content); },
	
	appendBefore: function(content) { this.append('before', content); }	
});	

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
skylinecms-3.3.0 public/skyline/javascripts/src/mootools_on_rails.js
skylinecms-3.2.0 public/skyline/javascripts/src/mootools_on_rails.js
skylinecms-3.1.0 public/skyline/javascripts/src/mootools_on_rails.js
westarete-skylinecms-3.0.8.20100329 public/skyline/javascripts/src/mootools_on_rails.js
westarete-skylinecms-3.0.8.20100330 public/skyline/javascripts/src/mootools_on_rails.js
skylinecms-3.0.8 public/skyline/javascripts/src/mootools_on_rails.js
skylinecms-3.0.7 public/skyline/javascripts/src/mootools_on_rails.js