title: element.blur() causing Uncaught TypeError: elem.getAttribute is not a function
body: <p>So I am struggling to understand where a console error is coming from. It doesn't currently break any behavior, but the error is unsettling. The error happens when I trigger a .blur() on a span that is being edited. Jquery then complains "jquery.js:1451 Uncaught TypeError: elem.getAttribute is not a function"</p>
  
  <p>The directive html: </p>
  
  <pre><code>&lt;span ng-if="!time"&gt;{{ value }}&lt;/span&gt;
  &lt;button class="btn btn-primary delink" 
          ng-if="delinkable &amp;&amp; delinkVisable" 
          ng-click="resource.delink()"&gt;Not speaking&lt;/button&gt;
  &lt;span ng-if="time"&gt;{{ value | momentFormat }}&lt;/span&gt;
  &lt;div ng-if="time &amp;&amp; datepicker" class="dropdown" id="datepicker"&gt;
  &lt;ul class="dropdown-menu" role="menu" aria-labelledby="dLabel"&gt;
      &lt;datetimepicker ng-model="resource.MeetingDateTime" 
                      data-on-set-time="updateResource()"
                      data-datetimepicker-config="{ dropdownSelector: '#dropdown2' }"&gt;
      &lt;/datetimepicker&gt;
  &lt;/ul&gt;
  &lt;a class="dropdown-toggle" id="dropdown2" role="button" data-disabled="true"
     data-toggle="dropdown" data-target="#" href&gt;
      &lt;div class="input-group"&gt;
          &lt;span class="input-group-addon"&gt;&lt;i class="fa fa-calendar"&gt;&lt;/i&gt;&lt;/span&gt;
      &lt;/div&gt;
  &lt;/a&gt;
  </code></pre>
  
  <p></p>
  
  <p>The relevant link functions:</p>
  
  <pre><code>function handleChanges () {
      var editSpan = angular.element(element.children()[0]);
      var newValue;
  
      if (scope.time) {
          newValue = dates.makeDateTime(editSpan.text());
          if (newValue) {
              scope.resource[scope.property] = newValue;
              newValue = editSpan.text();
          } else {
              editSpan.text(oldValue);
              newValue = editSpan.text();
              scope.resource[scope.property] = dates.makeDateTime(editSpan.text());
              scope.datepicker = true;
              $('#dropdown2').trigger('click');
              scope.$digest();
          }
      } else {
          scope.resource[scope.property] = editSpan.text();
          newValue = editSpan.text();
      }
  
      if (newValue !== oldValue) {
          scope.updateResource();
          compileElement();
      } else {
          if (scope.time) {
             hideDatepicker();
          }
      }
  }
  
  function bindEvents () {
      var editSpan = angular.element(element.children()[0]);
  
      editSpan.on('blur', function () {
          editSpan.attr('contentEditable', false);
          editSpan.unbind('keydown');
          editSpan.unbind('blur');
          scope.editing = false;
          handleChanges();
      });
      editSpan.on('keydown', function(event){
          if (event.keyCode == 27) {
              event.preventDefault();
              editSpan.text(oldValue);
              editSpan.blur(); //The error seems to happen after this call
          } else if (event.keyCode == 13) {
              editSpan.blur(); //and after this call
          } else if (scope.deleteable &amp;&amp; event.keyCode == 8) {
              if (editSpan.text().length == 0 || event.ctrlKey) {
                  scope.delete();
              }
          }
      });
  }
  </code></pre>