Changing MathML results in formulas being rendered on a different height

RESOLVED INVALID

Status

()

Firefox
Untriaged
RESOLVED INVALID
a year ago
a year ago

People

(Reporter: Ulrich Rabenstein, Unassigned)

Tracking

50 Branch
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(3 attachments)

(Reporter)

Description

a year ago
Created attachment 8829835 [details]
MathML height.png

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0
Build ID: 20161209095719

Steps to reproduce:

I'm using javascript to interactively change the content of MathML nodes.
- Created a new element using document.createElement("mrow")
- Append children to it (using appendChild), which are also newly created using document.createElement (these involve msup nodes)
- Replaced an old part of a math node by the new element just created using parent.replaceChild(new, old) 


Actual results:

The new MathML code is rendered correctly but it is on a different height than the regular text and the old math formula. Compare the attached image. Before changing anything, the old part looked was rendered like the "45 Degree" formula in the same sentence. 
Sometimes modified formulas are also placed on the normal height. I couldn't spot any system behind that. 


Expected results:

It should have been integrated into the text on normal height as the MathML code before was as well.
Can you please attach a HTML testcase to demonstrate the bug?
(Reporter)

Comment 2

a year ago
Created attachment 8829851 [details]
Example demonstrating the bug
(Reporter)

Comment 3

a year ago
Created attachment 8829852 [details]
libs.js Nececssary for the bug demonstration
(Reporter)

Comment 4

a year ago
(In reply to Frédéric Wang (:fredw) from comment #1)
> Can you please attach a HTML testcase to demonstrate the bug?
Done. 
I've made on mistake in my initial description, namely the MathML code does not need to involve msup.
Sorry, can you please produce a *reduced* testcase?

I'd suggest you use textContent instead of innerHTML and createElementNS with the MathML namespace instead of createElement.
(Reporter)

Comment 6

a year ago
(In reply to Frédéric Wang (:fredw) from comment #5)
> Sorry, can you please produce a *reduced* testcase?
Sorry, I thought that was already short enough.

> I'd suggest you use textContent instead of innerHTML and createElementNS
> with the MathML namespace instead of createElement.
That solved the problem. Thank you very much!
Status: UNCONFIRMED → RESOLVED
Last Resolved: a year ago
Resolution: --- → INVALID
(In reply to Ulrich Rabenstein from comment #6)
> (In reply to Frédéric Wang (:fredw) from comment #5)
> > Sorry, can you please produce a *reduced* testcase?
> Sorry, I thought that was already short enough.

No problem, next time try doing a HTML page with the minimal markup and js as otherwise it's hard to debug / understand. See e.g. the testcase of bug 1324072 for a recent one.

> 
> > I'd suggest you use textContent instead of innerHTML and createElementNS
> > with the MathML namespace instead of createElement.
> That solved the problem. Thank you very much!

Glad to hear that.
You need to log in before you can comment on or make changes to this bug.