A world-class math input for the web
at main 22 lines 561 B view raw
1import { CaretNode, h, VNode } from "@caret-js/core"; 2import { MathExpressionTag } from "../tags/mathExpression"; 3 4export class DivideNode extends CaretNode { 5 constructor(public dividend: CaretNode, public divisor: CaretNode) { 6 super(); 7 this.addTag(new MathExpressionTag()); 8 } 9 10 static from(dividend: CaretNode, divisor: CaretNode): DivideNode { 11 return new DivideNode(dividend, divisor); 12 } 13 14 toDebugMathML(): VNode { 15 return h( 16 "mfrac", 17 {}, 18 this.dividend.toDebugMathML(), 19 this.divisor.toDebugMathML() 20 ); 21 } 22}