| 9 | 9 | All this to say, `WP_HTML_Processor` does not keep track of element node indices, and it doesn't expose the attributes for the tags in the open stack (e.g. to get the `id`, `role`, or `class`). This would seem to make it more difficult to implement `get_xpath()` than maybe it should be. Ideally computing the XPath wouldn't require subclassing at all, and the information could be obtained from existing public methods. In Optimization Detective, the `WP_HTML_Tag_Processor` class is extended and the `next_token()` method is overridden so it can construct its own breadcrumbs and then also compute the node indices and capture the attributes at a given depth. |