Discussion:
mathbackground problem
(too old to reply)
Aleksey
2005-07-29 16:08:50 UTC
Permalink
I set mathbackground attribute of mstyle element but nothing happens on
my display:

Here is the content of color.xhtml
----------------------------------------------------------------
<?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">
<head>
<title>Mathbackground Testbed</title>
<script language="JavaScript" type="text/javascript">

function handleClick()
{
var i = document.getElementById("inner");

var attrName = "mathbackground";
var attr = document.createAttribute(attrName);

attr.nodeValue = "green";
i.setAttributeNode(attr);
}
</script>
</head>

<body>
<h2>Scripting</h2>
<div>
<math xmlns="&mathml;">
<mstyle mathsize="24pt">
<mrow>
<mo>(</mo>
<mstyle id="inner">
<mrow>
<mi>a</mi>
<mo>+</mo>
<mi>b</mi>
</mrow>
</mstyle>
<mo>)</mo>
</mrow>
</mstyle>
</math>
</div>
<p><form>
<input type="button" value="Highlight" onclick="handleClick();" />
</form></p>
</body>
</html>
----------------------------------------------------------------

What do I wrong?
I use Firefox 1.0.4

Thanks in advance.

Best regards,
Aleksey
Roger B. Sidje
2005-07-30 02:11:32 UTC
Permalink
This was an oversight specific to <mstyle>. I have attached a patch on
bug 302722: https://bugzilla.mozilla.org/show_bug.cgi?id=302722

In the meantime, just get rid of the excessive <mstyle> and use <mrow
id='inner'> directly. With that, mathbackground changes as expected with
your JavaScript.

Hopefully, the patch will get into Firefox 1.5. Brace yourself for this
major release, BTW. It will come with SVG built-in by default...

I am not sure if your JavaScript is intentionally elaborate, but you can
achieve the same thing with the simpler and more readable one-liner:

i.setAttribute("mathbackground", "green");

---
RBS
Post by Aleksey
I set mathbackground attribute of mstyle element but nothing happens on
Here is the content of color.xhtml
----------------------------------------------------------------
<?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">
<head>
<title>Mathbackground Testbed</title>
<script language="JavaScript" type="text/javascript">
function handleClick()
{
var i = document.getElementById("inner");
var attrName = "mathbackground";
var attr = document.createAttribute(attrName);
attr.nodeValue = "green";
i.setAttributeNode(attr);
}
</script>
</head>
<body>
<h2>Scripting</h2>
<div>
<math xmlns="&mathml;">
<mstyle mathsize="24pt">
<mrow>
<mo>(</mo>
<mstyle id="inner">
<mrow>
<mi>a</mi>
<mo>+</mo>
<mi>b</mi>
</mrow>
</mstyle>
<mo>)</mo>
</mrow>
</mstyle>
</math>
</div>
<p><form>
<input type="button" value="Highlight" onclick="handleClick();" />
</form></p>
</body>
</html>
----------------------------------------------------------------
What do I wrong?
I use Firefox 1.0.4
Thanks in advance.
Best regards,
Aleksey
_______________________________________________
Mozilla-mathml mailing list
http://mail.mozilla.org/listinfo/mozilla-mathml
Loading...