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

Use data-s9e-livepreview-hash to skip DOM diffing #39

Open
wants to merge 1 commit into
base: v1.0.0
Choose a base branch
from

Conversation

JoshyPHP
Copy link

@JoshyPHP JoshyPHP commented Oct 7, 2022

When data-s9e-livepreview-hash is set, the live preview algorithm will use it as a hint to determine whether to skip that entire branch of the DOM. Extensions like MathRen replace plain text with markup, so every time any part of the message is refreshed the fancy KaTeX markup reverts to text, then the live preview algorithm reruns the data-s9e-livepreview-onupdate code to change it back to KaTeX then does DOM diffing to see if the live DOM needs to be updated. If you set data-s9e-livepreview-hash, it will make a hash of the element's markup before the update event is run so it will only run it if the content actually changes. IOW, it won't run katex.render() on every keystroke.

https://s9etextformatter.readthedocs.io/JavaScript/Live_preview_attributes/#data-s9e-livepreview-hash

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

Successfully merging this pull request may close these issues.

1 participant