Skip to content

Visual diff is not working on mkdocs, double-selects root element #576

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
reteps opened this issue Apr 26, 2025 · 1 comment
Open

Visual diff is not working on mkdocs, double-selects root element #576

reteps opened this issue Apr 26, 2025 · 1 comment
Labels
Accepted Accepted issue on our roadmap Bug A bug

Comments

@reteps
Copy link

reteps commented Apr 26, 2025

Details

Expected Result

When I click visual diff, it diffs correctly. Instead, it currently throws an error.

Image

Actual Result

this.performDiff(this.cachedRemoteResponse.content);
// ...

    const htmlDocument = parser.parseFromString(remoteContent, "text/html");
    const oldBody = htmlDocument.documentElement.querySelector(
      this.rootSelector,
    );

The JS fetches this url: https://prairielearn--11830.org.readthedocs.build/_/api/v3/embed/?url=https%3A%2F%2Fprairielearn.readthedocs.io%2Fen%2Flatest%2Fquestion%2Findex.html&maincontent=main+%3E+div+%3E+div.md-content

The content it fetches is at the root selector:

Image
Image

It then tries to select the root node of the fetched document, and fails, since it has already fetched it!

Image

Fix: don't select content at the root selector once it has been fetched through the embed link.

@reteps
Copy link
Author

reteps commented Apr 26, 2025

This looks like a regression in a6623bf.

@humitos humitos transferred this issue from readthedocs/readthedocs.org Apr 28, 2025
@humitos humitos added Bug A bug Accepted Accepted issue on our roadmap labels Apr 28, 2025
@github-project-automation github-project-automation bot moved this to Planned in 📍Roadmap Apr 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted Accepted issue on our roadmap Bug A bug
Projects
Status: Planned
Development

No branches or pull requests

2 participants