function findFirstParentElementWithAttribute(attributeName, childObj) {
    //Undefined if the mouse leaves the browser window
    if (childObj === undefined) {
      return null;
    }
    var testObj = childObj.parentNode,
    count = 1,
    //Check for setAttribute due to exception thrown by Firefox when a node is dragged outside the browser window
    res = (typeof testObj.setAttribute === 'function' && testObj.hasAttribute(attributeName)) ? testObj : null;
    while (testObj && typeof testObj.setAttribute === 'function' && !testObj.hasAttribute(attributeName)) {
      testObj = testObj.parentNode;
      res = testObj;
      //Stop once we reach top of page.
      if (testObj === document.documentElement) {
        res = null;
        break;
      }
      count++;
    }
    return res;
  }
@ngdoc method
@name ui.tree#positionStarted
@methodOf ui.tree.service:UiTreeHelper

@description
Get the start position of the target element according to the provided event properties.

@param {Object} e Event
@param {Object} target Target element
@returns {Object} Object with properties offsetX, offsetY, startX, startY, nowX and dirX.