function onRemove(scope, element, options) {
      if (scope.toast && scope.toast.actionKey) {
        removeActionKeyListener();
      }
      element.off(SWIPE_EVENTS, options.onSwipe);
      if (options.parent) options.parent.addClass('md-toast-animating');
      if (options.openClass) options.parent.removeClass(options.openClass);

      // Don't run the leave animation if the element has already been destroyed.
      return ((options.$destroy === true) ? $q.when(element.remove()) : $animate.leave(element))
        .then(function () {
          if (options.parent) options.parent.removeClass('md-toast-animating');
          if ($mdUtil.hasComputedStyle(options.parent, 'position', 'static')) {
            options.parent.css('position', '');
          }
        });
    }
@param {Object} scope the toast's scope
@param {JQLite} element the toast to be removed
@param {Object} options
@return {Promise<*>} a Promise to remove the element immediately or to animate it out.