MooTools Injection Parameters - Please Explain

MooTools element.inject(otherElement, param) appears to be backward.

Can someone please explain the logic to me? Or is it just back-assward?
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=windows-1250">
  <meta name="generator" content="PSPad editor, www.pspad.com">
  <title>MooTools DOM Manipulation Example</title>
  
  <style type="text/css">
  	#A1 { border:2px solid red; }
  	#A2 { border:2px solid green; }
  	#A3 { border:2px solid blue; }
  </style>
  
  <script type="text/javascript" src="lib/mootools.js"></script>
  <script type="text/javascript">
  function inject_1(){

  	var A1 = $('A1');
  	var A2 = $('A2');
  	var A3 = $('A3');
  	A1.inject(A2, 'after');
  }
  
  </script>
  
  </head>
  <body>
	<h1>MooTools DOM Injection / Manipulation Test</h1>
	<h2>Sample 1: Simple DOM Elements</h2>
	<div id="A1">A1 - First DIV</div>
	<div id="A2">A2 - Second DIV</div>
	<div id="A3">A3 - Third DIV</div>
	<button onclick="inject_1()">Inject A2 before A1</button>
  </body>
</html>

Open in new window

LVL 14
tomaugerdotcomAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
tomaugerdotcomConnect With a Mentor Author Commented:
Ah, got it.

The inject method is called on the object we're injecting, not the object we're injecting INTO.

Noobz-r-us.
0
All Courses

From novice to tech pro — start learning today.