Skip to content

XPaths in Optimization Detective are invalid due to being zero-based instead of one-based #1124

@westonruter

Description

@westonruter

This is an example XPath generated in Optimization Detective:

/*[0][self::HTML]/*[1][self::BODY]

This is actually invalid because it is zero-based when XPath is one-based. It should rather be:

/*[1][self::HTML]/*[2][self::BODY]

In the end it doesn't impact the behavior in any way since it is exclusively using the XPath as a unique key to identify an element. It isn't actually using the XPath for any querying (although it could if the HTML API supported that). But I chose XPath since it is a standard way to identify the path to an element in a document. And this should be fixed to be valid XPath, which can have some debugging value since Chrome DevTools for example supports XPath in the elements panel.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Good First IssueIssue particularly suitable to be worked on by new contributors[Plugin] Optimization DetectiveIssues for the Optimization Detective plugin[Type] BugAn existing feature is broken

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions