E Document Object Model for MathML (Non-Normative)

Mathematical Markup Language (MathML) Version 2.0
D Operator Dictionary (Non-normative)
E Document Object Model for MathML (Non-normative)
E.1 IDL Interfaces
   E.1.1 Miscellaneous Object Definitions
   E.1.2 Generic MathML Elements
   E.1.3 Presentation Elements
   E.1.4 Content Elements
F Glossary (Non-normative)

The following sections describe the interfaces that have been defined in the Document Object Model for MathML. Please refer to chapter 8 [Document Object Model for MathML] for more information.

E.1 IDL Interfaces

E.1.1 Miscellaneous Object Definitions

Interface MathMLCollection

IDL Definition

interface MathMLCollection {
  readonly attribute unsigned long length;
  Node item(in unsigned long index);
  Node namedItem(in DOMString name);
};

This interface is included by analogy with the interface HTMLCollection, and for the same reasons. (Specifically, it allows access to a list of nodes either by index or by name or id attributes. The rationale making this desirable for the HTML DOM applies also to the MathML DOM; particularly the presence of named hyperlink targets.) The documentation below is essentially copied from the definition of HTMLCollection.

Attributes

length

This attribute specifies the length or size of the list.

Methods

item

This method retrieves a Node specified by ordinal index. Nodes are numbered in tree order (depth-first traversal order).

Parameters

index

The index of the Node to be fetched. The index origin is 0.

Return value

The Node at the corresponding position upon success. A value of null is returned if the index is out of range.

This method raises no exceptions.

namedItem

This method retrieves a Node using a name. It first searches for a Node with a matching id attribute. If it doesn't find one, it then searches for a Node with a matching name attribute, but only on those elements that are allowed a name attribute.

Parameters

name

The name of the Node to be fetched.

Return value

The Node with a name or id attribute whose value corresponds to the specified string. Upon failure (e.g. no Node with this name exists), returns null.

This method raises no exceptions.

Interface MathMLDocumentFragment

This interface is provided as a specialization of the DocumentFragment interface. The child Nodes of this MathMLElement must be MathMLElements as well.

IDL Definition

interface MathMLDocumentFragment: MathMLElement {
};

As with the DocumentFragment object, inserting a MathMLDocumentFragment into a MathMLElement which can accept children has the effect of inserting each of the top-level child Nodes of the fragment rather than the fragment itself.

E.1.2 Generic MathML Elements

Interface MathMLElement

All MathML element interfaces derive from this object, which derives from the basic DOM interface Element.

Note:

At some point it is expected that CSS support for mathematics will be available. At that point, the style attribute of an HTML element should be accessed through the ElementCSSInlineStyle interface which is defined in the CSS DOM specification.

IDL Definition

interface MathMLElement: Element {
  attribute DOMString className;
  attribute DOMString style;
  attribute DOMString id;
  attribute DOMString other;
  attribute NamedNodeMap otherAttributes;
};

Attributes

className

The class attribute of the element. See the discussion elsewhere in this document and the HTML definition of the class attribute.

style

A string identifying the element's style attribute.(?)

id

The element's identifier. See the discussion elsewhere in this document and the HTML definition of the id attribute.

other

Direct access to the element's other attribute, as a string.

otherAttributes

This attribute retrieves or sets a NamedNodeList representing the contents of the element's other attribute. This will allow more convenient access to the name-key pairs this attribute is defined to contain.

Interface MathMLmathElement

IDL Definition

interface MathMLmathElement: MathMLElement {
  readonly attribute MathMLCollection declares;
};

This interface represents the top-level MathML math element. It may be useful for interfacing between the Document Object Model objects encoding an encosing document and the MathML DOM elements which are its children. It may also be used for some purposes as a MathML DOM surrogate for a Document object. For instance, MathML-specific factory methods could be placed here, as could

Attributes

declares

Provides access to the declare elements which are children of this math element, in a MathMLCollection.

Interface MathMLSemanticsElement

IDL Definition

interface MathMLSemanticsElement: MathMLElement {
  attribute MathMLElement body;
  MathMLElement getAnnotation(in unsigned long index);
  MathMLElement setAnnotation(in MathMLElement newAnnotation, in unsigned long index);
};

This interface represents the semantics element in MathML.

Attributes

body

This attribute represents the first child of the semantics element, i.e. the child giving the `primary' content represented by the element.

Methods

getAnnotation

This method gives access to the indexth `alternate' content associated with a semantics element.

Parameters

index

The 0-based index of the annotation being retrieved.

Return value

The MathMLAnnotationElement or MathMLXMLAnnotationElement representing the indexth annotation or xml-annotation child of the semantics element. Note that all child elements of a semantics element other than the first are required to be of one of these types.

Exceptions

setAnnotation

This method allows setting or replacement of the indexth `alternate' content associated with a semantics element. If there is already an annotation or xml-annotation element with this index, it is replaced by newAnnotation.

Parameters

newAnnotation

A MathMLAnnotationElement or MathMLXMLAnnotationElement to be inserted as the indexth annotation or xml-annotation child.

index

The 0-based index of the annotation being set.

Return value

The MathMLAnnotationElement or MathMLXMLAnnotationElement being inserted as a child of this MathMLSemanticsElement.

Exceptions

E.1.3 Presentation Elements

Interface MathMLPresentationElement

IDL Definition

interface MathMLPresentationElement: MathMLElement {
};

This interface is provided to serve as a base interface for various MathML Presentation interfaces. It contains no new attributes or methods at this time; however, it is felt that the distinction between Presentation and Content MathML entities should be indicated in the MathMLElement heirarchy. In particular, future versions of the MathML DOM may add functionality on this interface; it may also serve as an aid to implementors.

E.1.3.1 Leaf Presentation Element Interfaces

Interface MathMLCharacterElement

IDL Definition

interface MathMLCharacterElement: MathMLPresentationElement {
  attribute DOMString name;
};

This interface supports the mchar element section 3.2.8 [Refering to non-ASCII characters (mchar)].

Attributes

name

The name of a non-ASCII character, taken from chapter 6 [Entities, Characters and Fonts].

Interface MathMLGlyphElement

IDL Definition

interface MathMLGlyphElement: MathMLPresentationElement {
  attribute DOMString alt;
  attribute DOMString fontfamily;
  attribute unsigned long index;
};

This interface supports the mglyph element section 3.2.9 [Adding new character glyphs to MathML (mglyph)].

Attributes

alt

A string giving an alternate name for the character. Represents the mglyph's alt attribute.

fontfamily

A string representing the font family.

index

An unsigned integer giving the glyph's position within the font.

Interface MathMLSpaceElement

IDL Definition

interface MathMLSpaceElement: MathMLPresentationElement {
  attribute DOMString width;
  attribute DOMString height;
  attribute DOMString depth;
};

This interface extends the MathMLPresentationElement interface for the MathML space element mspace. Note that this is not derived from MathMLPresentationTokenElement, despite the fact that mspace is classified as a token element, since it does not carry the attributes declared for MathMLPresentationTokenElement.

Attributes

width

A string of the form `number h-unit'; represents the width attribute for the mspace element, if specified.

height

A string of the form `number v-unit'; represents the height attribute for the mspace element, if specified.

depth

A string of the form `number v-unit'; represents the depth attribute for the mspace element, if specified.

E.1.3.2 Presentation Token Element Interfaces

Interfaces representing the MathML Presentation token elements which may have content are described here.

Interface MathMLPresentationTokenElement

This interface extends the MathMLElement interface to include access for attributes specific to text presentation. It serves as the base class for all MathML presentation token elements. Access to the body of the element is via the nodeValue attribute inherited from Node. Elements that expose only the core presentation token attributes are directly supported by this object. These elements are:

mi
identifier element
mn
number element
mtext
text element

Issue (methodless-interfaces):

Interfaces with no methods?

Should we provide interfaces with no methods for mi, mn, and mtext? This would provide separate objects for these elements. Since the element name provides complete information, there is no pressing need for such `interfaces'. Of course, extending this argument could lead to no MathML DOM specification at all.

IDL Definition

interface MathMLPresentationTokenElement: MathMLPresentationElement {
  attribute DOMString fontsize;
  attribute DOMString fontweight;
  attribute DOMString fontstyle;
  attribute DOMString fontfamily;
  attribute DOMString color;
  readonly attribute DOMString contents;
};

Attributes

fontsize

The font size attribute for the element, if specified.

fontweight

The font weight attribute for the element, if specified.

fontstyle

The font style attribute for the element, if specified.

fontfamily

The font family attribute for the element, if specified.

color

The color attribute for the element, if specified.

contents

Returns the child Nodes of the element. These should consist only of Text nodes and possibly MathMLGlyphElements or MathMLCharacterElements. Should behave the same as the base class's Node::children attribute; however, it is provided here for clarity.

Interface MathMLOperatorElement

IDL Definition

interface MathMLOperatorElement: MathMLPresentationTokenElement {
  attribute DOMString form;
  attribute DOMString fence;
  attribute DOMString separator;
  attribute DOMString lspace;
  attribute DOMString rspace;
  attribute DOMString stretchy;
  attribute DOMString symmetric;
  attribute DOMString maxsize;
  attribute DOMString minsize;
  attribute DOMString largeop;
  attribute DOMString moveablelimits;
  attribute DOMString accent;
};

This interface extends the MathMLPresentationTokenElement interface for the MathML operator@@ element mo.

Attributes

form

The form attribute (prefix, infix or postfix) for the mo element, if specified.

fence

The fence attribute (true or false) for the mo element, if specified.

separator

The separator attribute (true or false) for the mo element, if specified.

lspace

The lspace attribute (spacing to left) of the mo element, if specified.

rspace

The rspace attribute (spacing to right) of the mo element, if specified.

stretchy

The stretchy attribute (true or false) for the mo element, if specified.

symmetric

The symmetric attribute (true or false) for the mo element, if specified.

maxsize

The maxsize attribute for the mo element, if specified.

minsize

The minsize attribute for the mo element, if specified.

largeop

The largeop attribute for the mo element, if specified.

moveablelimits

The moveablelimits (true or false) attribute for the mo element, if specified.

accent

The accent attribute (true or false) for the mo element, if specified.

Interface MathMLStringLitElement

IDL Definition

interface MathMLStringLitElement: MathMLPresentationTokenElement {
  attribute DOMString lquote;
  attribute DOMString rquote;
};

This interface extends the MathMLPresentationTokenElement interface for the MathML string literal element ms.

Attributes

lquote

A string giving the opening delimiter for the string literal; represents the lquote attribute for the ms element, if specified.

rquote

A string giving the closing delimiter for the string literal; represents the rquote attribute for the ms element, if specified.

E.1.3.3 Presentation Container Interfaces

We include under the heading of Presentation Container Elements interfaces designed to represent MathML Presentation elements which can contain arbitrary numbers of child MathMLElements.

Interface MathMLStyleElement

IDL Definition

interface MathMLStyleElement: MathMLPresentationContainerElement {
  attribute DOMString scriptlevel;
  attribute DOMString displaystyle;
  attribute DOMString scriptsizemultiplier;
  attribute DOMString scriptminsize;
  attribute DOMString color;
  attribute DOMString background;
};

This interface extends the MathMLElement interface for the MathML style element mstyle. While the mstyle element may contain any attributes allowable on any MathML presentation element, only attributes specific to the mstyle element are included in the interface below. Other attributes should be accessed using the methods on the base Element class, particularly the Element::getAttribute and Element::setAttribute methods, or even the Node::attributes attribute to access all of them at once. Not only does this obviate a lengthy list below, but it seems likely that most implementations will find this a considerably more useful interface to a MathMLStyleElement.

Attributes

scriptlevel

A string of the form "+/- unsigned integer"; represents the scriptlevel attribute for the mstyle element, if specified. See also the discussion of this attribute.

displaystyle

Either true or false; a string representing the displaystyle attribute for the mstyle element, if specified. See also the discussion of this attribute.

scriptsizemultiplier

A string of the form `number'; represents the scriptsizemultiplier attribute for the mstyle element, if specified. See also the discussion of this attribute.

scriptminsize

A string of the form `number v-unit'; represents the scriptminsize attribute for the mstyle element, if specified. See also the discussion of this attribute.

color

A string representation of a color; represents the color attribute for the mstyle element, if specified. See also the discussion of this attribute.

background

A string representation of a color or the string transparent; represents the background attribute for the mstyle element, if specified. See also the discussion of this attribute.

Interface MathMLPaddedElement

IDL Definition

interface MathMLPaddedElement: MathMLPresentationContainerElement {
  attribute DOMString width;
  attribute DOMString lspace;
  attribute DOMString height;
  attribute DOMString depth;
};

This interface extends the MathMLElement interface for the MathML spacing adjustment element mpadded.

Attributes

width

A string representing the total width of the mpadded element, if specified. See also the discussion of this attribute.

lspace

A string representing the lspace attribute - the additional space to the left - of the mpadded element, if specified. See also the discussion of this attribute.

height

A string representing the height above the baseline of the mpadded element, if specified. See also the discussion of this attribute.

depth

A string representing the depth beneath the baseline of the mpadded element, if specified. See also the discussion of this attribute.

Interface MathMLFencedElement

IDL Definition

interface MathMLFencedElement: MathMLPresentationContainerElement {
  attribute DOMString open;
  attribute DOMString close;
  attribute DOMString separators;
};

This interface extends the MathMLPresentationContainerElement interface for the MathML fenced content element mfenced.

Attributes

open

A string representing the opening-fence for the mfenced element, if specified; this is the element's open attribute.

close

A string representing the opening-fence for the mfenced element, if specified; this is the element's close attribute.

separators

A string representing any separating characters inside the mfenced element, if specified; this is the element's separators attribute.

Interface MathMLEncloseElement

IDL Definition

interface MathMLEncloseElement: MathMLPresentationContainerElement {
  attribute DOMString notation;
};

This interface supports the menclose element section 3.3.9 [Enclose Content Inside Notation (menclose)].

Attributes

notation

A string giving a name for the notation enclosing the element's contents. Represents the notation attribute of the menclose. Allowed values are longdiv, actuarial, radical.

Interface MathMLActionElement

IDL Definition

interface MathMLActionElement: MathMLPresentationContainerElement {
  attribute DOMString actiontype;
  attribute DOMString selection;
};

This interface extends the MathMLPresentationContainerElement interface for the MathML enlivening expression element maction.

Attributes

actiontype

A string specifying the action. Possible values include toggle, statusline, tooltip, highlight, and menu.

selection

A string specifying an integer that selects the current subject of the action.

E.1.3.4 Presentation Schemata Interfaces

Interface MathMLFractionElement

IDL Definition

interface MathMLFractionElement: MathMLPresentationElement {
  attribute DOMString linethickness;
  attribute MathMLElement numerator;
  attribute MathMLElement denominator;
};

This interface extends the MathMLPresentationElement interface for the MathML fraction element mfrac.

Attributes

linethickness

A string representing the linethickness attribute of the mfrac, if specified.

numerator

The first child MathMLElement of the MathMLFractionElement; represents the numerator of the represented fraction.

denominator

The second child MathMLElement of the MathMLFractionElement; represents the denominator of the represented fraction.

Interface MathMLRadicalElement

IDL Definition

interface MathMLRadicalElement: MathMLPresentationElement {
  attribute MathMLElement radicand;
  attribute MathMLElement index;
};

This interface extends the MathMLPresentationElement interface for the MathML radical and square root elements mroot and msqrt.

Attributes

radicand

The first child MathMLElement of the MathMLRadicalElement; represents the base of the represented radical.

index

The second child MathMLElement of the MathMLRadicalElement; represents the index of the represented radical. This must be null for msqrt elements.

Interface MathMLScriptElement

IDL Definition

interface MathMLScriptElement: MathMLPresentationElement {
  attribute DOMString subscriptshift;
  attribute DOMString superscriptshift;
  attribute MathMLElement base;
  attribute MathMLElement subscript;
  attribute MathMLElement superscript;
};

This interface extends the MathMLPresentationElement interface for the MathML subscript, superscript and subscript-superscript pair elements msub, msup, and msubsup.

Attributes

subscriptshift

A string representing the minimum amount to shift the baseline of the subscript down, if specified; this is the element's subscriptshift attribute. This must return null for an msup.

superscriptshift

A string representing the minimum amount to shift the baseline of the superscript up, if specified; this is the element's superscriptshift attribute. This must return null for a msub.

base

A MathMLElement representing the base of the script. This is the first child of the element.

subscript

A MathMLElement representing the subscript of the script. This is the second child of a msub or msubsup; retrieval must return null for an msup. Exceptions on setting: the DOMException NOT_FOUND_ERR is raised when the element is a msup.

superscript

A MathMLElement representing the superscript of the script. This is the second child of a msup or the third child of a msubsup; retrieval must return null for an msub. Exceptions on setting: the DOMException NOT_FOUND_ERR is raised when the element is a msub.

Interface MathMLUnderOverElement

IDL Definition

interface MathMLUnderOverElement: MathMLPresentationElement {
  attribute DOMString accentunder;
  attribute DOMString accent;
  attribute MathMLElement base;
  attribute MathMLElement underscript;
  attribute MathMLElement overscript;
};

This interface extends the MathMLPresentationElement interface for the MathML underscript, overscript and overscript-underscript pair elements munder, mover and munderover.

Attributes

accentunder

Either true or false if present; a string controlling whether underscript is drawn as an `accent' or as a `limit', if specified; this is the element's accentunder attribute. This must return null for an mover.

accent

Either true or false if present; a string controlling whether overscript is drawn as an `accent' or as a `limit', if specified; this is the element's accent attribute. This must return null for an munder.

base

A MathMLElement representing the base of the script. This is the first child of the element.

underscript

A MathMLElement representing the underscript of the script. This is the second child of a munder or munderover; retrieval must return null for an mover. Exceptions on setting: the DOMException NOT_FOUND_ERR is raised when the element is a mover.

overscript

A MathMLElement representing the overscript of the script. This is the second child of a mover or the third child of a munderover; retrieval must return null for an munder. Exceptions on setting: the DOMException NOT_FOUND_ERR is raised when the element is a munder.

Interface MathMLMultiScriptsElement

IDL Definition

interface MathMLMultiScriptsElement: MathMLPresentationElement {
  attribute DOMString subscriptshift;
  attribute DOMString superscriptshift;
  attribute MathMLElement base;
  attribute NodeList prescripts;
  attribute NodeList scripts;
  readonly attribute unsigned long numprescriptcolumns;
  readonly attribute unsigned long numscriptcolumns;
  MathMLElement getPreSubScript(in unsigned long colIndex);
  MathMLElement getSubScript(in unsigned long colIndex);
  MathMLElement getPreSuperScript(in unsigned long colIndex);
  MathMLElement getSuperScript(in unsigned long colIndex);
  MathMLElement insertPreSubScriptAt(in unsigned long colIndex, in MathMLElement newElement);
  MathMLElement insertSubScriptAt(in unsigned long colIndex, in MathMLElement newElement);
  MathMLElement insertPreSuperScriptAt(in unsigned long colIndex, in MathMLElement newElement);
  MathMLElement insertSuperScriptAt(in unsigned long colIndex, inout MathMLElement newElement);
};

This interface extends the MathMLPresentationElement interface for the MathML multiscripts (including prescripts or tensors) element mmultiscripts.

Attributes

subscriptshift

A string representing the minimum amount to shift the baseline of the subscripts down, if specified; this is the element's subscriptshift attribute.

superscriptshift

A string representing the minimum amount to shift the baseline of the superscripts up, if specified; this is the element's superscriptshift attribute.

base

A MathMLElement representing the base of the script. This is the first child of the element.

prescripts

A NodeList representing the prescripts of the script, which appear in the order described by the expression (prescript presuperscript)*. This is the same as traversing the contents of the NodeList returned by Node::childNodes() from the Node following the <mprescripts/> (if present) to the end of the list.

scripts

A NodeList representing the scripts of the script, which appear in the order described by the expression (script superscript)*. This is the same as traversing the contents of the NodeList returned by Node::childNodes() from the first Node up to and including the Node preceding the <mprescripts/> (if present).

numprescriptcolumns

The number of script/subscript columns preceding (to the left of) the base. Should always be half of getprescripts().length()

numscriptcolumns

The number of script/subscript columns following (to the right of) the base. Should always be half of getcripts().length()

Methods

getPreSubScript

A convenience method to retrieve pre-subscript children of the element, referenced by column index .

Parameters

colIndex

Column index of prescript (where 0 represents the leftmost prescript column).

Return value

Returns the MathMLElement representing the colIndex-th presubscript (to the left of the base, counting from 0 at the far left). Note that this may be the MathMLElement corresponding to the special element <none/> in the case of a `missing' presubscript (see the discussion of mmultiscripts), or it may be null if colIndex is out of range for the element.

This method raises no exceptions.

getSubScript

A convenience method to retrieve subscript children of the element, referenced by column index.

Parameters

colIndex

Column index of script (where 0 represents the leftmost script column, the first to the right of the base).

Return value

Returns the MathMLElement representing the colIndex-th subscript to the right of the base. Note that this may be the MathMLElement corresponding to the special element <none/> in the case of a `missing' subscript (see the discussion of mmultiscripts), or it may be null if colIndex is out of range for the element.

This method raises no exceptions.

getPreSuperScript

A convenience method to retrieve pre-superscript children of the element, referenced by column index .

Parameters

colIndex

Column index of pre-superscript (where 0 represents the leftmost prescript column).

Return value

Returns the MathMLElement representing the colIndex-th presuperscript (to the left of the base, counting from 0 at the far left). Note that this may be the MathMLElement corresponding to the special element <none/> in the case of a `missing' presuperscript (see the discussion of mmultiscripts), or it may be null if colIndex is out of range for the element.

This method raises no exceptions.

getSuperScript

A convenience method to retrieve superscript children of the element, referenced by column index .

Parameters

colIndex

Column index of script (where 0 represents the leftmost script column, the first to the right of the base)

Return value

Returns the MathMLElement representing the colIndex-th superscript to the right of the base. Note that this may be the MathMLElement corresponding to the special element <none/> in the case of a `missing' superscript (see the discussion of mmultiscripts), or it may be null if colIndex is out of range for the element.

This method raises no exceptions.

insertPreSubScriptAt

A convenience method to insert a pre-subscript child at the position referenced by column index. If there is currently a pre-subscript at this position, it is replaced by newElement.

Parameters

colIndex

Column index of pre-subscript (where 0 represents the leftmost prescript column).

newElement

MathMLElement to be inserted.

Return value

The MathMLElement being inserted.

This method raises no exceptions.

insertSubScriptAt

A convenience method to insert a subscript child at the position referenced by column index. If there is currently a subscript at this position, it is replaced by newElement.

Parameters

colIndex

Column index of subscript (where 0 represents the leftmost script column, the first to the right of the base).

newElement

MathMLElement to be inserted.

Return value

The MathMLElement being inserted.

This method raises no exceptions.

insertPreSuperScriptAt

A convenience method to insert a pre-superscript child at the position referenced by column index. If there is currently a pre-superscript at this position, it is replaced by newElement.

Parameters

colIndex

Column index of pre-superscript (where 0 represents the leftmost prescript column).

newElement

MathMLElement to be inserted.

Return value

The MathMLElement being inserted.

This method raises no exceptions.

insertSuperScriptAt

A convenience method to insert a superscript child at the position referenced by column index. If there is currently a superscript at this position, it is replaced by newElement.

Parameters

colIndex

Column index of superscript (where 0 represents the leftmost script column, the first to the right of the base).

newElement

MathMLElement to be inserted.

Return value

The MathMLElement being inserted.

This method raises no exceptions.

Interface MathMLTableElement

IDL Definition

interface MathMLTableElement: MathMLPresentationElement {
  attribute DOMString align;
  attribute DOMString rowalign;
  attribute DOMString columnalign;
  attribute DOMString groupalign;
  attribute DOMString alignmentscope;
  attribute DOMString rowspacing;
  attribute DOMString columnspacing;
  attribute DOMString rowlines;
  attribute DOMString columnlines;
  attribute DOMString frame;
  attribute DOMString framespacing;
  attribute DOMString equalrows;
  attribute DOMString equalcolumns;
  attribute DOMString displaystyle;
  attribute DOMString side;
  attribute DOMString minlabelspacing;
  readonly attribute MathMLCollection rows;
  MathMLTableRowElement insertRow(in unsigned long index);
  void deleteRow(in unsigned long index);
};

This interface extends the MathMLPresentationElement interface for the MathML table or matrix element mtable.

Attributes

align

A string representing the vertical alignment of the table with the adjacent text. Allowed values are (top | bottom | center | baseline | axis)[rownumber], where rownumber is between 1 and n (for a table with n rows) or -1 and -n.

rowalign

A string representing the alignment of entries in each row, consisting of a space-separated sequence of alignment specifiers, each of which can have the following values: top, bottom, center, baseline, or axis.

columnalign

A string representing the alignment of entries in each column, consisting of a space-separated sequence of alignment specifiers, each of which can have the following values: left, center, or right.

groupalign

A string specifying how the alignment groups within the cells of each row are to be aligned with the corresponding items above or below them in the same column. The string consists of a sequence of braced group alignment lists. Each group alignment list is a space-separated sequence, each of which can have the following values: left, right, center, or decimalpoint.

alignmentscope

A string consisting of the values true or false indicating, for each column, whether it can be used as an alignment scope.

rowspacing

A string consisting of a space-separated sequence of specifiers of the form number v-unit representing the space to be added between rows.

columnspacing

A string consisting of a space-separated sequence of specifiers of the form number h-unit representing the space to be added between columns.

rowlines

A string specifying whether and what kind of lines should be added between each row. The string consists of a space-separated sequence of specifiers, each of which can have the following values: none, solid, or dashed.

columnlines

A string specifying whether and what kind of lines should be added between each column. The string consists of a space-separated sequence of specifiers, each of which can have the following values: none, solid, or dashed.

frame

A string specifying a frame around the table. Allowed values are (none | solid | dashed).

framespacing

A string of the form number h-unit number v-unit specifying the spacing between table and its frame.

equalrows

A string with the values true or false.

equalcolumns

A string with the values true or false.

displaystyle

A string with the values true or false.

side

A string with the values left, right, leftoverlap, or rightoverlap.

minlabelspacing

A string of the form number h-unit, specifying the minimum space between a label and the adjacent entry in the labeled row.

rows

A MathMLCollection consisting of the rows of the table.

Methods

insertRow

A convenience method to insert a new (empty) row in the table at the specified index.

Parameters

index

Index at which to insert row.

Return value

Returns the MathMLTableRowElement representing the mtr element being inserted.

This method raises no exceptions.

deleteRow

A convenience method to delete the row of the table at the specified index.

Parameters

index

Index of row to be deleted.

Return value

None.

This method raises no exceptions.

Interface MathMLTableRowElement

IDL Definition

interface MathMLTableRowElement: MathMLPresentationElement {
  attribute DOMString rowalign;
  attribute DOMString columnalign;
  attribute DOMString groupalign;
  readonly attribute MathMLCollection cells;
  MathMLTableCellElement insertCell(in unsigned long index);
  void deleteCell(in unsigned long index);
};

This interface extends the MathMLPresentationElement interface for the MathML table or matrix row element mtr.

Attributes

rowalign

A string representing an override of the row alignment specified in the containing mtable. Allowed values are top, bottom, center, baseline, and axis.

columnalign

A string representing an override of the column alignment specified in the containing mtable. Allowed values are left, center, and right.

groupalign

[To be changed?]

cells

A MathMLCollection consisting of the cells of the row. Note that this collection does not include the label if this is a MathMLLabeledRowElement!

Methods

insertCell

A convenience method to insert a new (empty) cell in the row.

Parameters

index

Index at which to insert cell. Note that the count will differ from the indexth child node if this is a MathMLLabeledRowElement!

Return value

Returns the MathMLTableCellElement representing the mtd element being inserted.

This method raises no exceptions.

deleteCell

A convenience method to delete a cell in the row.

Parameters

index

Index of cell to be deleted. Note that the count will differ from the indexth child node if this is a MathMLLabeledRowElement!

Return value

None.

This method raises no exceptions.

Interface MathMLLabeledRowElement

IDL Definition

interface MathMLLabeledRowElement: MathMLTableRowElement {
  attribute MathMLElement label;
};

This interface extends the MathMLTableRowElement interface to represent the mlabeledtr element section 3.5.3 [Labeled Row in Table or Matrix (mlabeledtr)]. Note that the presence of a label causes the indexth child node to differ from the indexth cell!

Attributes

label

A MathMLElement representing the label of this row. Note that retrieving this should have the same effect as a call to Node::getfirstChild(), while setting it should have the same effect as Node::replaceChild(Node::getfirstChild()).

Exceptions on Setting

NO_MODIFICATION_ALLOWED_ERR

Raised if this MathMLElement or the new MathMLElement is read-only.

Interface MathMLTableCellElement

IDL Definition

interface MathMLTableCellElement: MathMLPresentationContainerElement {
  attribute DOMString rowspan;
  attribute DOMString columnspan;
  attribute DOMString rowalign;
  attribute DOMString columnalign;
  attribute DOMString groupalign;
  readonly attribute boolean hasaligngroups;
  readonly attribute DOMString cellindex;
};

This interface extends the MathMLPresentationContainerElement interface for the MathML table or matrix cell element mtd.

Attributes

rowspan

A string representing a positive integer that specifies the number of rows spanned by this cell. The default is 1.

columnspan

A string representing a positive integer that specifies the number of columns spanned by this cell. The default is 1.

rowalign

A string specifying an override of the inherited vertical alignment of this cell within the table row. Allowed values are top, bottom, center, baseline, and axis.

columnalign

A string specifying an override of the inherited horizontal alignment of this cell within the table column. Allowed values are left, center, and right.

groupalign

A string specifying how the alignment groups within the cell are to be aligned with those in cells above or below this cell. The string consists of a space-separated sequence of specifiers, each of which can have the following values: left, right, center, or decimalpoint.

hasaligngroups

A string with the values true or false indicating whether the cell contains align groups.

cellindex

A string representing the integer index (1-based?) of the cell in its containing row. [What about spanning cells? How do these affect this value?]

Interface MathMLAlignGroupElement

IDL Definition

interface MathMLAlignGroupElement: MathMLPresentationElement {
  attribute DOMString groupalign;
};

This interface extends the MathMLPresentationElement interface for the MathML group -alignment element <maligngroup/>.

Attributes

groupalign

A string specifying how the alignment group is to be aligned with other alignment groups above or below it. Allowed values are left, right, center, or decimalpoint.

Interface MathMLAlignMarkElement

IDL Definition

interface MathMLAlignMarkElement: MathMLPresentationElement {
  attribute DOMString edge;
};

This interface extends the MathMLPresentationElement interface for the MathML alignment mark element <malignmark/>.

Attributes

edge

A string specifying alignment on the right edge of the preceding element or the left edge of the following element. Allowed values are left and right.

E.1.4 Content Elements

Issue (content-names):

We have named all of the content element interfaces MathMLnameElement where name is the MathML element.

Interface MathMLContentElement

IDL Definition

interface MathMLContentElement: MathMLElement {
};

This interface is provided to serve as a base interface for various MathML Content interfaces. It contains no new attributes or methods at this time; however, it is felt that the distinction between Presentation and Content MathML entities should be indicated in the MathMLElement heirarchy. In particular, future versions of the MathML DOM may add functionality on this interface; it may also serve as an aid to implementors.

E.1.4.1 Content Token Interfaces

Interface MathMLcnElement

IDL Definition

interface MathMLcnElement: MathMLContainerTokenElement {
  attribute DOMString type;
  attribute DOMString base;
  readonly attribute unsigned long nargs;
  attribute DOMString definitionURL;
};

The cn element is used to specify actual numeric constants.

Attributes

type

Values include, but are not restricted to, center, real, integer, rational, complex-cartesian, complex-polar, and constant.

base

A string representing an integer between 2 and 36; the base of the numerical representation.

nargs

The number of sep-separated arguments.

definitionURL

A URL pointing to an alternative definition

Interface MathMLciElement

IDL Definition

interface MathMLciElement: MathMLContentTokenElement {
  attribute DOMString type;
};

The ci element is used to specify a symbolic name.

Attributes

type

Values include integer, rational, real, float, complex, complex-polar, complex-cartesian, constant, any of the MathML content container types (vector, matrix, set, list etc.) or their types.

E.1.4.2 Content Container Interfaces

We have added interfaces for content elements that are containers, i.e. elements that may contain child elements corresponding to arguments, bound variables, conditions, or lower or upper limits.

Interface MathMLapplyElement

IDL Definition

interface MathMLapplyElement: MathMLContentContainerElement {
  attribute MathMLElement operator;
  readonly attribute unsigned long nargs;
};

The apply element allows a function or operator to be applied to its arguments.

Attributes

operator

The MathML element representing the function or operator that is applied to the list of arguments.

nargs

An integer representing the number of arguments. This does not include the function or operator itself; note that this causes the return value to be less than the return from Node::childNodes().length().

Interface MathMLfnElement

IDL Definition

interface MathMLfnElement: MathMLContentContainerElement {
  attribute DOMString definitionURL;
  attribute DOMString encoding;
};

The fn element makes explicit the fact that a more general MathML object is intended to be used in the same manner as if it were a pre-defined function such as sin or plus.

Attributes

definitionURL

A URL pointing to a definition for this function-type element. Note that there is no stipulation about the form this definition may take!

encoding

A string describing the syntax in which the definition located at definitionURL is given.

Issue (condition-reln):

The specification of MathML 1.01 says that a condition contains a single reln element or a single apply element. Since reln is being deprecated in version 2.0, we have typed the body as MathMLapplyElement. Is this OK? It may be dangerous if there are documents that use reln in this context.

Interface MathMLlambdaElement

IDL Definition

interface MathMLlambdaElement: MathMLContentContainerElement {
  attribute MathMLElement expression;
  readonly attribute unsigned long nvars;
};

The lambda element is used to construct a user-defined function from an expression and one or more free variables.

Attributes

expression

The MathMLElement representing the expression.

nvars

An integer representing the number of variables in the expression.

Issue (sets):

The following interface seems unsatisfactory. The first problem is that set is really two things - a condition set or an explicit list set. Another problem is that it's not easy to express the union of two sets as a set (although it's possible - the problem is that the union of a condition set and a list set is only awkwardly expressed as a condition set).

The dual nature of the object makes the interface awkward.

Access to the elements of an explicit list set seems problematic. What if another process deletes an element between the time you determine its position and when you delete it? Perhaps the delete function should take only a MathMLElement argument as returned by getElement - this would be the element in the DOM, so there would be no problem of a changing index.

Interface MathMLsetElement

IDL Definition

interface MathMLsetElement: MathMLContentContainerElement {
  readonly attribute boolean isConditionSet;
  readonly attribute unsigned long nelements;
  MathMLElement getElement(in unsigned long index);
  MathMLElement addElement(in MathMLelement element);
   deleteElement(in unsigned long index);
};

The set element is the container element that represents a set of elements. The elements of a set can be defined either by explicitly listing the elements, or by using the bvar and condition elements.

Attributes

isConditionSet

This is true if the set is specified using a condition and false if the set is an explicit list.

nelements

The number of elements if the set is an explicit list. Should this raise an exception if this is a condition set? Even if the conditions really amount to an explicit list?

Methods

getElement

A convenience method to retrieve an element. There is no default ordering of the elements. Inserting or deleting an element is not guaranteed to leave the element in the i-th place unchanged even if the action takes place at a larger index.

Parameters

index

Position of the element in the list of elements. The first element is numbered 1.

Return value

The MathMLElement element at position index.

This method raises no exceptions.

addElement

A convenience method to insert an element. The insertion may change the indices of any of the other elements. Since element equivalence is not easy to determine, it seems hard to specify that inserting the same element twice is an error.

Parameters

element

The MathMLElement to be added to the set.

Return value

The MathMLElement being added. This is the element within the DOM.

This method raises no exceptions.

deleteElement

A convenience method to delete an element. The deletion may change the indices of any of the other elements.

Parameters

index

Position of the element in the set

Return value

None

This method raises no exceptions.

Issue (lists):

The following interface seems unsatisfactory. The first problem is that list is really two things - a condition list or an explicit list. Another problem is that it's not easy to express the union of two lists as a list (although it's possible - the problem is that the union of a condition list and an explicit list set is only awkwardly expressed as a condition list).

The dual nature of the object makes the interface awkward. Should an exception be raised if an attempt is made to insert an element into a specified position in a list that is given by a condition? A priori, probably not; but allowing this would certainly seem to give rise to implementation problems!

Access to the elements of an explicit list seems problematic. What if another process deletes an element between the time you determine its position and when you delete it? Perhaps the delete function should take only a MathMLElement argument as returned by getElement - this would be the element in the DOM, so there would be no problem of a changing index.

Interface MathMLlistElement

IDL Definition

interface MathMLlistElement: MathMLContentContainerElement {
  readonly attribute boolean isConditionList;
  attribute MathMLconditionElement condition;
  readonly attribute unsigned long nelements;
  MathMLElement getElement(in unsigned long index);
  MathMLElement addElement(in unsigned long index, in MathMLelement element);
   deleteElement(in unsigned long index);
};

The list element is the container element which represents a list of elements. Elements can be defined either by explicitly listing the elements, or by using the bvar and condition elements.

Attributes

isConditionList

This is true if the list is specified using a condition and false if the list is an explicit list.

condition

A MathMLconditionElement that determines the list. Setting this causes isConditionList to be true. Getting this if the list is an explicit list (if isConditionList is false) should raise an exception?

nelements

The number of elements if the list is an explicit list. Should this raise an exception if this is a condition list? Even if the conditions really amount to an explicit list?

Methods

getElement

A convenience method to retrieve an element.

Parameters

index

Position of the element in the list of elements. The first element is numbered 1.

Return value

The MathMLElement element at position index in the list.

This method raises no exceptions.

addElement

A convenience method to insert an element.

Parameters

index

The position in the list at which element is to be added.

element

The MathMLElement to be added to the list.

Return value

The MathMLElement being added. This is the new element within the DOM.

This method raises no exceptions.

deleteElement

A convenience method to delete an element. The deletion may change the indices of elements occurring after index in the list.

Parameters

index

Position of the element in the list.

Return value

None

This method raises no exceptions.

E.1.4.3 Content Leaf Element Interfaces

Issue (builtin-interface):

I propose that all built-in operator, relation, and function interfaces either derive from or be directly supported through the MathMLbuiltIn interface. Note that the name does not end with `Element' because this interface does not correspond to a MathML element. The alternative is to provide an interface for every one of these elements individually.

Again, this interface supports all empty elements that have only the additional definitionURL attribute. This includes elements that take qualifiers.

I don't particularly like the name `builtin'. Any better suggestions?

QUESTION: Should we treat these as objects that own their arguments and provide methods for accessing those arguments? Similarly for operators taking qualifiers - we could provide access to the qualifiers. No, I suppose not. It's the apply that owns the arguments.

Unless apply does the work of validating the arguments (ensuring the correct number, type, and checking any other conditions), there's no easy way to introduce this.

Wouldn't it be easier to list the elements that are not supported by this interface?

Interface MathMLbuiltIn

IDL Definition

interface MathMLbuiltIn: MathMLContentElement {
  attribute DOMString definitionURL;
  attribute DOMString arity;
  attribute DOMString symbolName;
};

This interface supports all of the empty built-in operator, relation, and function elements that have the definitionURL attribute in addition to the standard set of attributes. The elements supported in order of their appearance in section 4.4 [The Content Markup Elements] are: inverse, compose, ident, quotient, exp, factorial, divide, max, min, minus, plus, power, rem, times, root, gcd, and, or, xor, not, implies, forall, exists, abs, conjugate, eq, neq, gt, lt, geq, leq, ln, log, int, diff, partialdiff, union, intersect, in, notin, subset, prsubset, notsubset, notprsubset, setdiff, sum, product, limit, tendsto, sin, cos, tan, sec, csc, cot, sinh, cosh, tanh, sech, csch, coth, arcsin, arccos, arctan, mean, sdev, variance, median, mode, moment, determinant, and transpose.

Attributes

definitionURL

A string that provides an override to the default semantics, or provides a more specific definition

arity

A string representing the number of arguments. Values include 0, 1, ... and variable.

symbolName

A string that provides an override to the default semantics, or provides a more specific definition

E.1.4.4 Other Content Element Interfaces

Interface MathMLintervalElement

IDL Definition

interface MathMLintervalElement: MathMLContentElement {
  attribute DOMString closure;
  readonly attribute boolean isCondition;
  attribute MathMLconditionElement condition;
  attribute MathMLcnElement start;
  attribute MathMLcnElement end;
};

The interval element is used to represent simple mathematical intervals on the real number line. It contains either two child elements that evaluate to real numbers or one child element that is a condition for defining membership in the interval.

Attributes

closure

A string with value open, closed, open-closed or closed-open. The default value is closed.

isCondition

true if this interval is defined by a condition rather than by two real number endpoints.

condition

A MathML condition element in the case that the interval is defined using a condition. Setting this attribute has the side effect of setting isCondition to true. Getting this attribute raises an exception if isCondition is false.

start

A MathMLcnElement representing the real number defining the start of the interval. Setting this attribute has the side effect of setting isCondition to false. If end has not already been set, it becomes the same as start until set otherwise. Getting this attribute raises an exception if isCondition is true.

end

A MathMLcnElement representing the real number defining the end of the interval. Setting this attribute has the side effect of setting isCondition to false. If start has not already been set, it becomes the same as end until set otherwise. Getting this attribute raises an exception if isCondition is true.

Interface MathMLconditionElement

IDL Definition

interface MathMLconditionElement: MathMLContentElement {
  attribute MathMLapplyElement condition;
};

The condition element is used to place a condition on one or more free variables or identifiers.

Attributes

condition

A MathMLapplyElement that represents the condition.

Interface MathMLdeclareElement

IDL Definition

interface MathMLdeclareElement: MathMLContentElement {
  attribute DOMString type;
  attribute DOMString scope;
  attribute unsigned long nargs;
  attribute DOMString occurrence;
  attribute DOMString definitionURL;
  attribute MathMLciElement identifier;
  attribute MathMLElement constructor;
};

The declare construct has two primary roles. The first is to change or set the default attribute values for a specific mathematical object. The second is to establish an association between a `name' and an object.

Attributes

type

A string indicating the type of the identifier. It must be compatible with the type of the constructor, if a constructor is present. The type is inferred from the constructor if present, otherwise it must be specified.

scope

A string with values local or global.

nargs

If the identifier is a function, this attribute specifies the number of arguments the function takes.

occurrence

A string with the values prefix, infix or function-model. [What about postfix?]

definitionURL

A URL specifying an alternative definition. [Is `alternative' correct here?]

identifier

A MathMLciElement representing the name being declared.

constructor

An optional MathMLElement providing an initialial value for the object being declared.

Interface MathMLvectorElement

IDL Definition

interface MathMLvectorElement: MathMLContentElement {
  readonly attribute unsigned long ncomponents;
  MathMLElement getComponent(in unsigned long index);
  MathMLElement insertComponent(in MathMLelement component);
   deleteComponent(in unsigned long index);
};

vector is the container element for a vector.

Attributes

ncomponents

The number of components in the vector.

Methods

getComponent

A convenience method to retrieve a component.

Parameters

index

Position of the component in the list of components. The first element is numbered 1.

Return value

The MathMLElement component at the position specified by index.

This method raises no exceptions.

insertComponent

A convenience method to insert a component. If there is already a component at the position specified by index, it is replaced.

Parameters

component

The MathMLElement that is to be the index-th component of the vector.

Return value

The MathMLElement that is added. This is the new element within the DOM.

This method raises no exceptions.

deleteComponent

A convenience method to delete an element. The deletion changes the indexes of the following components.

Parameters

index

Position of the component in the vector. The position of the first component is 1

Return value

None

This method raises no exceptions.

Interface MathMLmatrixElement

IDL Definition

interface MathMLmatrixElement: MathMLContentElement {
  readonly attribute unsigned long nrows;
  MathMLmatrixrowElement getRow(in unsigned long index);
  MathMLmatrixrowElement insertRow(in MathMLrowElement row, in unsigned long index);
   deleteRow(in unsigned long index);
};

The matrix element is the container element for matrixrow elements.

Attributes

nrows

The number of rows in the represented matrix.

Methods

getRow

A convenience method to retrieve a specified row.

Parameters

index

Position of the row in the list of rows. The first row is numbered 1.

Return value

The MathMLmatrixrowElement representing the index-th row.

This method raises no exceptions.

insertRow

A convenience method to insert a row. If there is already a row at the specified index, it is replaced.

Parameters

row

MathMLmatrixrowElement to be inserted into the matrix.

index

Unsigned integer giving the row position at which the row is to be inserted.

Return value

The MathMLmatrixrowElement added. This is the new element within the DOM.

This method raises no exceptions.

deleteRow

A convenience method to delete a row. The deletion changes the indices of the following rows.

Parameters

index

Position of the row to be deleted in the list of rows

Return value

None

This method raises no exceptions.

Issue (matrix-vector):

matrix, matrixrow, and vector

How to we convert between these elements? The specification states that vectors are equivalent to single column or single row matrices in appropriate contexts. What about matrixrow's? It would help tremendously to have some form of compatibility.

Is there any requirement that the number of elements be the same for each row of a matrix? If so, do we need exceptions to handle the cases where there is an attempt to add incompatible rows to a matrix?

Interface MathMLmatrixrowElement

IDL Definition

interface MathMLmatrixrowElement: MathMLContentElement {
  readonly attribute unsigned long nelements;
  MathMLElement getElement(in unsigned long index);
  MathMLElement insertElement(in MathMLElement element, in unsigned long index);
   deleteElement(in unsigned long index);
};

The matrixrow element is the container element for the elements of a matrix.

Attributes

nelements

The number of elements in the row.

Methods

getElement

A convenience method to retrieve an element by index.

Parameters

index

Position of the element in the row. The first element is numbered 1.

Return value

The MathMLElement element at index index in the row.

This method raises no exceptions.

insertElement

A convenience method to insert an element. If there is already an element at the specified index, it is replaced by the new element.

Parameters

element

The MathMLElement to be inserted in the row.

index

The index at which element is to be inserted in the row.

Return value

The MathMLElement created by the insertion. This is the new element within the DOM.

This method raises no exceptions.

deleteElement

A convenience method to delete an element. The deletion changes the indices of the following elements.

Parameters

index

Position of the element to be deleted in the row.

Return value

None

This method raises no exceptions.