This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 16635 - Setting innerHTML on an SVG element will parse into HTML elements. Since innerHTML is available on Element now, we should check if the context element is an SVG element (or MathML element) other than foreignObject (etc) and use the foreign lands insertion
Summary: Setting innerHTML on an SVG element will parse into HTML elements. Since inne...
Status: RESOLVED FIXED
Alias: None
Product: HTML WG
Classification: Unclassified
Component: HTML5 spec (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: ---
Assignee: Robin Berjon
QA Contact: HTML WG Bugzilla archive list
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-04 10:58 UTC by contributor
Modified: 2013-06-07 22:10 UTC (History)
9 users (show)

See Also:


Attachments

Description contributor 2012-04-04 10:58:52 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html
Multipage: http://www.whatwg.org/C#parsing-html-fragments
Complete: http://www.whatwg.org/c#parsing-html-fragments

Comment:
Setting innerHTML on an SVG element will parse into HTML elements. Since
innerHTML is available on Element now, we should check if the context element
is an SVG element (or MathML element) other than foreignObject (etc) and use
the foreign lands insertion mode.

Posted from: 88.131.66.80 by simonp@opera.com
User agent: Opera/9.80 (Macintosh; Intel Mac OS X 10.7.2; U; en) Presto/2.10.229 Version/11.62
Comment 1 Cameron McCormack 2012-04-04 11:19:56 UTC
That'd be awesome if it could work, yeah.
Comment 2 Simon Pieters 2012-04-05 07:11:43 UTC
Cases to consider:

context element is one of the following

<svg><g/><foreignobject/><desc/><title/></svg>
<math><mrow/><mi/><mo/><mn/><ms/><mtext/><annotation-xml/><annotatoin-xml encoding=text/html /></math>

markup is one of the following

"<b>x"
"<svg>"
"<p>"
"</svg>"
"<mglyph>"
"<malignmark>"
...
Comment 4 Simon Pieters 2012-04-05 12:53:12 UTC
Desired outcome, I think (using html5lib test syntax to indicate namespace):

<math math>.innerHTML = '<b>x';
| <math math>
|   <b>
|     "x"

<math math>.innerHTML = '<foo><b>x';
| <math math>
|   <math foo>
| <b>
|   "x"

i.e. the "break out" step needs to be changed to not pop the current element if that's an html element (fragment case), but should otherwise work like normal.

<math mi>.innerHTML = '<b>x';
| <math mi>
|   <b>
|     "x"

<math mi>.innerHTML = '<foo><b>x';
| <math mi>
|   <foo>
|     <b>
|       "x"

<math mi>.innerHTML = '<mglyph>';
| <math mi>
|   <math mglyph>

<math mi>.innerHTML = '<malignmark>';
| <math mi>
|   <math malignmark>

<math mi>.innerHTML = '<svg>';
| <math mi>
|   <svg svg>

<math annotation-xml>.innerHTML = '<svg>';
| <math annotation-xml>
|   <svg svg>

<math annotation-xml>.innerHTML = '<foo>';
| <math annotation-xml>
|   <math foo>

<math annotation-xml encoding="text/html">.innerHTML = '<foo>';
| <math annotation-xml>
|   encoding="text/html"
|   <foo>
Comment 5 Simon Pieters 2012-04-05 12:53:13 UTC
Desired outcome, I think (using html5lib test syntax to indicate namespace):

<math math>.innerHTML = '<b>x';
| <math math>
|   <b>
|     "x"

<math math>.innerHTML = '<foo><b>x';
| <math math>
|   <math foo>
| <b>
|   "x"

i.e. the "break out" step needs to be changed to not pop the current element if that's an html element (fragment case), but should otherwise work like normal.

<math mi>.innerHTML = '<b>x';
| <math mi>
|   <b>
|     "x"

<math mi>.innerHTML = '<foo><b>x';
| <math mi>
|   <foo>
|     <b>
|       "x"

<math mi>.innerHTML = '<mglyph>';
| <math mi>
|   <math mglyph>

<math mi>.innerHTML = '<malignmark>';
| <math mi>
|   <math malignmark>

<math mi>.innerHTML = '<svg>';
| <math mi>
|   <svg svg>

<math annotation-xml>.innerHTML = '<svg>';
| <math annotation-xml>
|   <svg svg>

<math annotation-xml>.innerHTML = '<foo>';
| <math annotation-xml>
|   <math foo>

<math annotation-xml encoding="text/html">.innerHTML = '<foo>';
| <math annotation-xml>
|   encoding="text/html"
|   <foo>
Comment 6 Simon Pieters 2012-04-05 12:55:59 UTC
(In reply to comment #4)
> <math math>.innerHTML = '<foo><b>x';
> | <math math>
> |   <math foo>
> | <b>
> |   "x"

Oops. I meant this:

<math math>.innerHTML = '<foo><b>x';
| <math math>
|   <math foo>
|   <b>
|     "x"
Comment 7 contributor 2012-07-18 07:18:01 UTC
This bug was cloned to create bug 17924 as part of operation convergence.
Comment 8 Ms2ger 2012-08-15 17:13:21 UTC
Filter on [Idon'tcareaboutHTMLWGbugspam].
Comment 9 Silvia Pfeiffer 2013-04-08 22:43:14 UTC
Added WHATWG patch for this, which addresses part of the bug but breaks a test, see bug 17924.

Applied:
https://github.com/w3c/html/commit/033f3a69ce7b47d0445917869916b1177e4461cd
Comment 10 Travis Leithead [MSFT] 2013-06-07 22:10:24 UTC
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are
satisfied with this response, please change the state of this bug to CLOSED. If
you have additional information and would like the Editor to reconsider, please
reopen this bug. If you would like to escalate the issue to the full HTML
Working Group, please add the TrackerRequest keyword to this bug, and suggest
title and text for the Tracker Issue; or you may create a Tracker Issue
yourself, if you are able to do so. For more details, see this document:


   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Accepted
Change Description: Applied WHATWG Patch that fixes this issue to W3C spec

See: https://github.com/w3c/html/commit/9c5293d8c754cbe69fdcbaccd7bb1e3616f4de1d