/// <summary> /// Expands a range to the safest outter tags that can be contained without encompassing /// text that is not currently in this range. /// </summary> /// <param name="range"></param> private void SelectOuter(MarkupRange range) { IHTMLElement parent = range.ParentElement(); MarkupRange editableRange = MarkupHelpers.GetEditableRange(parent, MarkupServices); if (editableRange == null) { return; } while (parent != null && range.MoveOutwardIfNoContent()) { parent = range.Start.CurrentScope; } if (range.Start.IsLeftOf(editableRange.Start)) { range.Start.MoveToPointer(editableRange.Start); } if (range.End.IsRightOf(editableRange.End)) { range.End.MoveToPointer(editableRange.End); } return; }