public static ElementLocator FromElement(Element element) { var locator = new ElementLocator { Steps = new List <int>() }; Build(locator, element); return(locator); }
public static void Enqueue(Element element, string?newValue) { if (!element.TryGetQueue(out var document)) { return; } var locator = ElementLocator.FromElement(element); document.Enqueue(new SetIdDelta { Locator = locator, NewId = newValue }); }
private static void Build(ElementLocator locator, Element element) { if (string.IsNullOrEmpty(element.Id)) { var parent = element.ParentElement; if (parent == null) { return; } var index = parent.GetChildElementPosition(element); locator.GetSteps().Add(index); Build(locator, parent); } else { locator.StartingId = element.Id; } }