The MathJax.HTML object provides routines for creating HTML elements and adding them to the page, and int particular, it contains the code that processes MathJax’s HTML snippets and turns them into actual DOM objects. It also implements the methods used to manage the cookies used by MathJax.
The prefix used for names of cookies stored by MathJax.
The expiration time (in days) for cookies created by MathJax.
Creates a DOM element of the given type. If attributes is non-null, it is an object that contains key:value pairs of attributes to set for the newly created element. If contents is non-null, it is an HTML snippet that describes the contents to create for the element. For example
var div = MathJax.HTML.Element(
"div",
{id: "MathDiv", style:{border:"1px solid", padding:"5px"}},
["Here is math: $x+1$",["br"],"and a display $$x+1\\over x-1$$"]
);
Parameters : |
|
---|---|
Returns : | the DOM element created |
Creates a DOM element and appends it to the parent node provided. It is equivalent to
parent.appendChild(MathJax.HTML.Element(type,attributes,content))
Parameters : |
|
---|---|
Returns : | the DOM element created |
Creates a DOM text node with the given text as its content.
Parameters : |
|
---|---|
Returns : | the new text node |
Creates a DOM text node with the given text and appends it to the parent node.
Parameters : |
|
---|---|
Returns : | the new text node |
Sets the contents of the script element to be the given text, properly taking into account the browser limitations and bugs.
Parameters : |
|
---|---|
Returns : | null |
Creates a MathJax cookie using the MathJax.HTML.Cookie.prefix and the name as the cookie name, and the key:value pairs in the data object as the data for the cookie. For example,
MathJax.HTML.Cookie.Set("test",{x:42, y:"It Works!"});
will create a cookie named “mjx.test” that stores the values of x and y provided in the data object. This data can be retrieved using the MathJax.HTML.Cookie.Get() method discussed below.
Parameters : |
|
---|---|
Returns : | null |
Looks up the data for the cookie named name and merges the data into the given obj object, or returns a new object containing the data. For instance, given the cookie stored by the example above,
var data = MathJax.HTML.Cookie.Get("test");
would set data to {x:42, y:"It Works!"}, while
var data = {x:10, z:"Safe"};
MathJax.HTML.Cookie.Get("test",data);
would leave data as {x:42, y:"It Works!", z:"Safe"}.