|
365 | 365 | // nodes, not nodes that might be nested deeper in the tree (see issue #1447).
|
366 | 366 | //
|
367 | 367 | getNode: function (node,type) {
|
368 |
| - while (node && node.childNodes.length === 1 && node.firstChild.id == null) |
369 |
| - node = node.firstChild; |
370 |
| - if (node) { |
371 |
| - var name = RegExp("\\b"+type+"\\b"); |
| 368 | + var name = RegExp("\\b"+type+"\\b"); |
| 369 | + while (node) { |
372 | 370 | for (var i = 0, m = node.childNodes.length; i < m; i++) {
|
373 | 371 | var child = node.childNodes[i];
|
374 | 372 | if (name.test(child.className)) return child;
|
375 | 373 | }
|
| 374 | + node = (node.firstChild && (node.firstChild.id||"") === "" ? node.firstChild : null); |
376 | 375 | }
|
377 | 376 | return null;
|
378 | 377 | },
|
|
1386 | 1385 | },
|
1387 | 1386 | CHTMLaddChild: function (node,i,options) {
|
1388 | 1387 | var child = this.data[i], cnode;
|
| 1388 | + var type = options.childNodes; |
| 1389 | + if (type instanceof Array) type = type[i]||"span"; |
1389 | 1390 | if (child) {
|
1390 |
| - var type = options.childNodes; |
1391 |
| - if (type) { |
1392 |
| - if (type instanceof Array) type = type[i]||"span"; |
1393 |
| - node = CHTML.addElement(node,type); |
1394 |
| - } |
| 1391 | + if (type) node = CHTML.addElement(node,type); |
1395 | 1392 | cnode = child.toCommonHTML(node,options.childOptions);
|
1396 | 1393 | if (type && child.CHTML.rscale !== 1) {
|
1397 | 1394 | // move scale factor to outer container (which seems to be more accurate)
|
|
1405 | 1402 | if (cbox.skew) bbox.skew = cbox.skew;
|
1406 | 1403 | if (cbox.pwidth) bbox.pwidth = cbox.pwidth;
|
1407 | 1404 | }
|
1408 |
| - } else if (options.forceChild) {cnode = CHTML.addElement(node,"mjx-box")} |
| 1405 | + } else if (options.forceChild) { |
| 1406 | + cnode = CHTML.addElement(node,(type||"mjx-box")); |
| 1407 | + } |
1409 | 1408 | return cnode;
|
1410 | 1409 | },
|
1411 | 1410 |
|
|
1415 | 1414 | return node;
|
1416 | 1415 | },
|
1417 | 1416 | CHTMLcoreNode: function (node) {
|
| 1417 | + if (this.inferRow && this.data[0]) return this.data[0].CHTMLcoreNode(node.firstChild); |
1418 | 1418 | return this.CHTMLchildNode(node,this.CoreIndex());
|
1419 | 1419 | },
|
1420 | 1420 |
|
|
0 commit comments