Skip to content

Commit 8c2cee3

Browse files
committed
Only push sibling node onto the stack when it exists, and make sure node.document is set for stylesheets, even if no typesetting occurred (i.e., not math was found). Resolves issue #78.
1 parent a928e3e commit 8c2cee3

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

mathjax3-ts/handlers/html/HTMLDomStrings.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ export class HTMLDomStrings {
190190
* Check the class to see if it matches the processClass regex
191191
* If the node has a child and is not marked as created by MathJax (data-MJX)
192192
* and either it is marked as restarting processing or is not a tag to be skipped, then
193-
* Save the current node and whether we are currently ignoring content
193+
* Save the next node (if there is one) and whether we are currently ignoring content
194194
* Move to the first child node
195195
* Update whether we are ignoring content
196196
* Otherwise
@@ -208,7 +208,9 @@ export class HTMLDomStrings {
208208
let process = this.processClass.exec(cname);
209209
if (node.firstChild && !node.getAttribute('data-MJX') &&
210210
(process || !this.skipTags.exec(tname))) {
211-
this.stack.push([node.nextSibling as Element, ignore]);
211+
if (node.nextSibling) {
212+
this.stack.push([node.nextSibling as Element, ignore]);
213+
}
212214
node = node.firstChild as Element;
213215
ignore = (ignore || this.ignoreClass.exec(cname)) && !process;
214216
} else {

mathjax3-ts/output/chtml.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ export class CHTML extends AbstractOutputJax {
152152
* @override
153153
*/
154154
public styleSheet(html: MathDocument) {
155+
this.nodes.document = html.document;
155156
//
156157
// Gather the CSS from the classes
157158
//

0 commit comments

Comments
 (0)