@@ -234,7 +234,7 @@ export class MmlMo extends AbstractMmlTokenNode {
234234 * with this node as its core
235235 */
236236 public coreParent ( ) : MmlNode {
237- let embellished = this ;
237+ let embellished = null ;
238238 let parent = this as MmlNode ;
239239 const math = this . factory . getNodeClass ( 'math' ) ;
240240 while (
@@ -246,7 +246,7 @@ export class MmlMo extends AbstractMmlTokenNode {
246246 embellished = parent ;
247247 parent = ( parent as MmlNode ) . parent ;
248248 }
249- return embellished ;
249+ return embellished || this ;
250250 }
251251
252252 /**
@@ -385,7 +385,7 @@ export class MmlMo extends AbstractMmlTokenNode {
385385 // Check if node is the last one in its container since the rule
386386 // above only takes effect if there is a node that follows.
387387 //
388- let child : MmlNode = this ;
388+ let child : MmlNode = null ;
389389 let parent = this . parent ;
390390 while (
391391 parent &&
@@ -397,6 +397,7 @@ export class MmlMo extends AbstractMmlTokenNode {
397397 child = parent ;
398398 parent = parent . parent ;
399399 }
400+ child = child || this ;
400401 if ( parent . childNodes [ parent . childNodes . length - 1 ] === child ) {
401402 this . texClass = TEXCLASS . ORD ;
402403 }
@@ -472,14 +473,15 @@ export class MmlMo extends AbstractMmlTokenNode {
472473 * position of the element in its parent.
473474 */
474475 public getForms ( ) : [ string , string , string ] {
475- let core : MmlNode = this ;
476+ let core : MmlNode = null ;
476477 let parent = this . parent ;
477478 let Parent = this . Parent ;
478479 while ( Parent && Parent . isEmbellished ) {
479480 core = parent ;
480481 parent = Parent . parent ;
481482 Parent = Parent . Parent ;
482483 }
484+ core = core || this ;
483485 if (
484486 parent &&
485487 parent . isKind ( 'mrow' ) &&
0 commit comments