468,556 Members | 2,117 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,556 developers. It's quick & easy.

What can be used to update a MathML page in Mozilla browsers?

DKM
I need an equivalent for the following:

document.getElementById('equation').update(); from Mathplayer

to use it in Mozilla based browser.

When I change any text node, the page updates just fine in FireFox.
However, if I change an entire math element, as in the following:

eqElement = document.getElementById("equation");
a2Element = document.createElement("msup");
baseElement = document.createElement("mi");
powerElement = document.createElement("mo");
baseElementText = document.createTextNode("a");
powerElementText = document.createTextNode("2");
baseElement.appendChild(baseElementText);
powerElement.appendChild(powerElementText);
a2Element.appendChild(baseElement);
a2Element.appendChild(powerElement);
eqElement.appendChild(a2Element);
it does not update the page.

It does not update in Internet Explorer running Mathplayer either.
However, if I follow up the above code with the following:

document.getElementById('equation').update();

it works just fine.

The file is a XML file with the following declaration:

<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
"http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd"
[<!ENTITY mathml "http://www.w3.org/1998/Math/MathML">
]>
<html xmlns="http://www.w3.org/1999/xhtml">

I will appreciate it if someone can she some light on this.

Thanks in advance.

D. K. Mishra

Jul 24 '05 #1
7 1694
In article <11*********************@o13g2000cwo.googlegroups. com>,
"DKM" <de**************@hotmail.com> wrote:
However, if I change an entire math element, as in the following: it does not update the page.


Then there's a bug. You could try making the entire block that encloses
the equation display: none; and then restoring it to display: block;.

--
Henri Sivonen
hs******@iki.fi
http://hsivonen.iki.fi/
Mozilla Web Author FAQ: http://mozilla.org/docs/web-developer/faq.html
Jul 24 '05 #2
In article <11*********************@o13g2000cwo.googlegroups. com>,
"DKM" <de**************@hotmail.com> wrote:
However, if I change an entire math element, as in the following: it does not update the page.


Then there's a bug. You could try making the entire block that encloses
the equation display: none; and then restoring it to display: block;.

--
Henri Sivonen
hs******@iki.fi
http://hsivonen.iki.fi/
Mozilla Web Author FAQ: http://mozilla.org/docs/web-developer/faq.html
Jul 24 '05 #3
In article <11*********************@o13g2000cwo.googlegroups. com>,
"DKM" <de**************@hotmail.com> wrote:
However, if I change an entire math element, as in the following: it does not update the page.


Then there's a bug. You could try making the entire block that encloses
the equation display: none; and then restoring it to display: block;.

--
Henri Sivonen
hs******@iki.fi
http://hsivonen.iki.fi/
Mozilla Web Author FAQ: http://mozilla.org/docs/web-developer/faq.html
Jul 24 '05 #4
In article <11*********************@o13g2000cwo.googlegroups. com>,
"DKM" <de**************@hotmail.com> wrote:
However, if I change an entire math element, as in the following: it does not update the page.


Then there's a bug. You could try making the entire block that encloses
the equation display: none; and then restoring it to display: block;.

--
Henri Sivonen
hs******@iki.fi
http://hsivonen.iki.fi/
Mozilla Web Author FAQ: http://mozilla.org/docs/web-developer/faq.html
Jul 24 '05 #5
DKM

DKM wrote:
I need an equivalent for the following:

document.getElementById('equation').update(); from Mathplayer

to use it in Mozilla based browser.

When I change any text node, the page updates just fine in FireFox.
However, if I change an entire math element, as in the following:

eqElement = document.getElementById("equation");
a2Element = document.createElement("msup");
baseElement = document.createElement("mi");
powerElement = document.createElement("mo");
baseElementText = document.createTextNode("a");
powerElementText = document.createTextNode("2");
baseElement.appendChild(baseElementText);
powerElement.appendChild(powerElementText);
a2Element.appendChild(baseElement);
a2Element.appendChild(powerElement);
eqElement.appendChild(a2Element);
it does not update the page.
A little correction here. It updates the math element. But, it does not
display it mathematically.

Starting from

<math id="eq1" xmlns="http://www.w3.org/1998/Math/MathML">
</math>

I get the following:

<math id="eq1" xmlns="http://www.w3.org/1998/Math/MathML">
<msup>
<mi>a</mi>
<mn>2</mn>
</msup>
</math>

Which is what I wanted. But, the browser does not display the math.

D.K. Mishra

It does not update in Internet Explorer running Mathplayer either.
However, if I follow up the above code with the following:

document.getElementById('equation').update();

it works just fine.

The file is a XML file with the following declaration:

<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
"http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd"
[<!ENTITY mathml "http://www.w3.org/1998/Math/MathML"> ]>
<html xmlns="http://www.w3.org/1999/xhtml">

I will appreciate it if someone can she some light on this.

Thanks in advance.

D. K. Mishra


Jul 24 '05 #6

Henri Sivonen wrote:
In article <11*********************@o13g2000cwo.googlegroups. com>,
"DKM" <de**************@hotmail.com> wrote:
However, if I change an entire math element, as in the following:
it does not update the page.


Then there's a bug. You could try making the entire block that

encloses the equation display: none; and then restoring it to display: block;.
It did not work. Funny thing is when I view the source code, I see the
mathml code as it should be like as follows:

<math id="eq1" xmlns="http://www.w3.org/1998/Math/MathML">
<msup>
<mi>a</mi>
<mn>2</mn>
</msup>
</math>

Yet, the browser is displaying "a2" instead of the true math
presentation of square.

For a change, I strated with a non-empty <math> tag as follows:

<math id="eq1" xmlns="http://www.w3.org/1998/Math/MathML">
<msup>
<mi>b</mi>
<mn>2</mn>
</msup>
</math>

and applied the scriptcode and it changed to

<math id="eq1" xmlns="http://www.w3.org/1998/Math/MathML">
<msup>
<mi>b</mi>
<mn>2</mn>
</msup>
<msup>
<mi>a</mi>
<mn>2</mn>
</msup>
</math>

But, it is displaying it as bsquared followed by a2 not a squared. In
otherwords, the browser is not displaying the updated math even after
changing display attribute as you suggested.

Thanks for your input. Maybe its abug, may be not. I don't know. I want
to know if there is a work around.

Interestingly, the browser updates just fine when I add simple html
tags using script code. Also, it updates just fine if I change a text
node inside mathml code.
Again, thanks.

D.K. Mishra

--
Henri Sivonen
hs******@iki.fi
http://hsivonen.iki.fi/
Mozilla Web Author FAQ:

http://mozilla.org/docs/web-developer/faq.html

Jul 24 '05 #7

Henri Sivonen wrote:
In article <11*********************@o13g2000cwo.googlegroups. com>,
"DKM" <de**************@hotmail.com> wrote:
However, if I change an entire math element, as in the following:
it does not update the page.


Then there's a bug. You could try making the entire block that

encloses the equation display: none; and then restoring it to display: block;.

Its working now. I was not including the name space when calling
createElement to creat an element. In another newsgroup, a gentleman
pointed that out and suggested that I call createElementNS that allows
you to include any namespace. Unfortuantely, Microsoft has not
implemented createElementNS, but I can't complain for its innerHTMl
makes it all easy.

Thank you for your help.

D.K. Mishra

--
Henri Sivonen
hs******@iki.fi
http://hsivonen.iki.fi/
Mozilla Web Author FAQ:

http://mozilla.org/docs/web-developer/faq.html

Jul 24 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Florian Huber | last post: by
reply views Thread by Bart Van Loon | last post: by
4 posts views Thread by Jon Thackray | last post: by
3 posts views Thread by wende598 | last post: by
1 post views Thread by michael_quinlivan | last post: by
3 posts views Thread by BakedBean | last post: by
reply views Thread by C.W.Holeman II | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.