Closed Bug 1333393 Opened 7 years ago Closed 7 years ago

Changing MathML results in formulas being rendered on a different height

Categories

(Firefox :: Untriaged, defect)

50 Branch
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: ulrich.rabenstein, Unassigned)

Details

Attachments

(3 files)

Attached image 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?
(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.
(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
Closed: 7 years 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.

Attachment

General

Created:
Updated:
Size: