Skip to content
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

Investigate innerHTML Reproducibility #1

Closed
deckar01 opened this issue Oct 27, 2016 · 2 comments
Closed

Investigate innerHTML Reproducibility #1

deckar01 opened this issue Oct 27, 2016 · 2 comments

Comments

@deckar01
Copy link
Owner

I suspect that document.documentElement.innerHTML may not produce a deterministic value across browsers and versions for all HTML content.

Consider:

  • Normalizing the HTML string
  • Using the original HTTP response body before DOM processing
@deckar01 deckar01 added this to the v0.3.0 milestone Oct 27, 2016
@deckar01
Copy link
Owner Author

HTML file → DOM → innerHTML

There are 2 operations that could differ across browsers. The complex parsing operation from an HTML file to DOM elements, and the serialization of innerHTML from DOM elements to a string.

Neither of these operations are guaranteed to behave the same across browsers and should not be relied on when generating the info hash. The info hash should describe the original HTML file contents without any transformation.

The client's scripting environment does not have direct access to this content as a string, but it can be fetched as an AJAX request. Assuming the HTML content is served with the proper cache headers, an AJAX request for the original HTML file should return the original file content as a string from the browser's cache without fetching it over HTTP again.

HTML file → Browser cache → AJAX request

@deckar01 deckar01 added bug and removed question labels Oct 28, 2016
@deckar01
Copy link
Owner Author

Fixed in 95ff4d9.

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

No branches or pull requests

1 participant