title: .appendchild executing twice in CKeditor
body: <p>I'm using the simpleuploads plugin for CKeditor. Everything's working perfect except for one itsy bitsy problem.</p>
  
  <p>I'm trying wrap an uploaded image object in a div like so</p>
  
  <pre><code>&lt;div class="image-container&gt;
     &lt;img class="addedImg&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>and have added the following at the bottom of /app/assets/javascripts/ckeditor/config.js</p>
  
  <pre><code>CKEDITOR.on('instanceReady', function(e) {
      e.editor.on( 'simpleuploads.finishedUpload' , function(ev)
      {
              var element = ev.data.element;
              if (element.getName() == 'img')
              {
                      var img = element.$,
                      doc = img.ownerDocument,
                      div = doc.createElement('div');
              img.setAttribute('class', 'addedImg');
              img.removeAttribute('width');
              img.removeAttribute('height');
              div.setAttribute('class', 'image-container');
                      img.parentNode.replaceChild(div, img);
              div.appendChild(img);
              }
      });
  });
  </code></pre>
  
  <p>The problem is div is wrapped in another div like so:</p>
  
  <pre><code>&lt;div class="image-container"&gt;
     &lt;div class="image-container"&gt;
         &lt;img class="addedImg"&gt;
     &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>How do I get the script to execute only once?</p>
  
  <p>EDIT:
  Issue caused by my custom assets/javascripts/ckeditor/config.js being loaded, and then the galetahub gem's assets/ckeditor/config.js being loaded again. Not sure where the problem lies. Will post more details if solution is found.</p>