Skip to content

Visual diff: check the rootSelector exists before making the EmbedAPI request #521

Open
@humitos

Description

We perform visual diff over the rootSelector (default or defined by the user) at;

addons/src/docdiff.js

Lines 169 to 172 in 5b70166

const oldBody = htmlDocument.documentElement.querySelector(
this.rootSelector,
);
const newBody = document.querySelector(this.rootSelector);

If the rootSelector is not found in the current page, visual diff won't work. We can take advantage of this and do not perform the EmbedAPI request if we already know it's not gonna work 😄

We will need to check this at

addons/src/docdiff.js

Lines 142 to 147 in 5b70166

promiseData = fetch(url).then((response) => {
if (!response.ok) {
throw new Error("Error downloading requested base URL.");
}
return response.json();
});

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    ImprovementMinor improvement to code

    Type

    No type

    Projects

    • Status

      Planned

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions