Skip to content

Conversation

@dpvc
Copy link
Member

@dpvc dpvc commented Nov 25, 2023

It turns out that when a stylesheet has dynamically added rules (like the ones MathJax produced for CHTML output when adaptiveCSS is true), those rules are not returned by innerHTML, outerHTML, or textContent. This makes it hard to obtain the CSS needed for HTML output in that case.

The PR adds a cssText() method to the adaptor class so that these rules will be included in the output. This can be used in place of innerHTML or textContent to get the list of rules when adaptiveCSS is being used.

@dpvc
Copy link
Member Author

dpvc commented Nov 25, 2023

The alternative would be to modify innerHTML, outerHTML, and textContent to include them, but that makes these function less compatible with what the browser actually does, and lead to confusion if these were used on a node containing a style node, like the head node, where the normal HTML behavior would still occur.

@dpvc dpvc requested a review from zorkow November 25, 2023 15:16
@dpvc dpvc added this to the v4.0 milestone Nov 25, 2023
Copy link
Member

@zorkow zorkow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One typo.

Fix typo in comments

Co-authored-by: Volker Sorge <[email protected]>
@dpvc dpvc merged commit ae389de into develop Nov 28, 2023
@dpvc dpvc deleted the adaptor-csstext branch November 28, 2023 13:39
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.

3 participants