Click here to get back home

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

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
What can be used to update a MathML page in Mozilla browsers? DKM 05-15-2005
Get Chitika Premium
Posted by DKM on May 15, 2005, 8:34 pm
Please log in for more thread options


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


Posted by DKM on May 16, 2005, 5:35 am
Please log in for more thread options



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


Posted by Henri Sivonen on May 16, 2005, 10:45 am
Please log in for more thread options



> 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
hsivonen@iki.fi
http://hsivonen.iki.fi/
Mozilla Web Author FAQ: http://mozilla.org/docs/web-developer/faq.html

Posted by D. K. Mishra on May 16, 2005, 5:45 am
Please log in for more thread options



Henri Sivonen 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
> hsivonen@iki.fi
> http://hsivonen.iki.fi/
> Mozilla Web Author FAQ:
http://mozilla.org/docs/web-developer/faq.html


Posted by D. K. Mishra on May 16, 2005, 2:23 pm
Please log in for more thread options



Henri Sivonen 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
> hsivonen@iki.fi
> http://hsivonen.iki.fi/
> Mozilla Web Author FAQ:
http://mozilla.org/docs/web-developer/faq.html


known to work on any non-Mozilla browsers
Similar ThreadsPosted
Update a web page with contents from another web page. January 8, 2005, 1:59 pm
Is
October 15, 2004, 11:56 pm
Online documentation for Geko/Mozilla browsers??? November 12, 2004, 5:13 pm
MathML July 4, 2005, 5:57 am
Why is my page displayed differently on Mac vs. PC browsers? February 24, 2006, 9:50 pm
Update help and advice please September 12, 2007, 5:37 am
BGCOLOR only in Opera, not other browsers (valid page) May 4, 2008, 1:38 am
Follow-up to "Update help and Advice" September 27, 2007, 10:16 am
Is this group the right group to discuss MathML? May 15, 2005, 12:49 pm
CSS in IE6 vs Mozilla November 14, 2005, 10:53 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap