-
-
Notifications
You must be signed in to change notification settings - Fork 389
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
Highlight.js and <details> #4695
Comments
@AlexDawsonUK I cannot reproduce the error with Please check there's no |
Thanks @AlexDawsonUK. I'll check in Chrome too. Could possibly be a ReSpec issue. Edit: Confirmed happening in Chrome |
Doesn't happen with |
Yes, I noted that odd quirk of behavior, and I even tried writing some JavaScript to close all the details components once everything had finished loading (hoping that it would give Highlight enough time todo its thing and then close them until required). But alas, whatever is causing the bug wouldn't have any of it. 🤷🏻♂️ I've expanded the testing and can confirm that all chromium browsers are affected (I tested in Chrome / Edge / Brave). |
Agrees on blaming Blink behavior, as Safari and Firefox work fine. The actual issue is Blink returns empty string with cc @marcoscaceres Any idea why did we use |
Spec for reference: https://html.spec.whatwg.org/multipage/dom.html#get-the-text-steps |
Update: I've created a potential workaround patch that allows functioning rendering engines to continue to enjoy syntax highlighting while chromium functions with it disabled. It requires the use of the nohighlight class on all affected code.
It requires highlighting to be enabled on functional browsers rather than disabling it on non-functional ones due to the issue of the loss of content being displayed from the rendering tree as mentioned previously regarding innerText. |
I can't recall, but probably because |
You probably want:
|
Description of problem
When using progressive disclosure using the details element in a ReSpec document, Highlight.js ceases to function and erases the content from the rendering tree.
URL to affected spec or repo:
https://w3c.github.io/sustyweb/drafts/ (Note as a temporary fix we're using nohighlight as a workaround.)
What happened (e.g., it crashed)?:
The code inside the pre element is erased and an empty tag is rendered instead of syntax being highlighted.
Expected behavior (e.g., it shouldn't crash):
The syntax should be highlighted, as it is for any code that would exist outside of the details element.
Optional, steps to reproduce:
Show / Hide content.
Note: I have verified that this issue does not occur in a normal HTML document using highlight.js therefore it possibly is due to ReSpec or its implementation of highlight?
The text was updated successfully, but these errors were encountered: