Living Standard — Last Updated 27 November 2024
HTML/HTML5/HTML5_Parser#Inline_SVG_and_MathML_support
Support in all current engines.
The MathML math element falls into the embedded content,
phrasing content, flow content, and palpable content
categories for the purposes of the content models in this specification.
When the MathML annotation-xml element contains elements from the
HTML namespace, such elements must all be flow content.
When the MathML token elements (mi, mo, mn, ms, and mtext) are descendants of HTML elements, they may contain
phrasing content elements from the HTML namespace.
User agents must handle text other than inter-element whitespace found in MathML
elements whose content models do not allow straight text by pretending for the purposes of MathML
content models, layout, and rendering that the text is actually wrapped in a MathML
mtext element. (Such text is not, however, conforming.)
User agents must act as if any MathML element whose contents does not match the element's
content model was replaced, for the purposes of MathML layout and rendering, by a MathML
merror element containing some appropriate error message.
The semantics of MathML elements are defined by MathML and other applicable specifications. [MATHML]
Here is an example of the use of MathML in an HTML document:
<!DOCTYPE html>
<html lang="en">
<head>
<title>The quadratic formula</title>
</head>
<body>
<h1>The quadratic formula</h1>
<p>
<math>
<mi>x</mi>
<mo>=</mo>
<mfrac>
<mrow>
<mo form="prefix">−</mo> <mi>b</mi>
<mo>±</mo>
<msqrt>
<msup> <mi>b</mi> <mn>2</mn> </msup>
<mo>−</mo>
<mn>4</mn> <mo></mo> <mi>a</mi> <mo></mo> <mi>c</mi>
</msqrt>
</mrow>
<mrow>
<mn>2</mn> <mo></mo> <mi>a</mi>
</mrow>
</mfrac>
</math>
</p>
</body>
</html>
HTML/HTML5/HTML5_Parser#Inline_SVG_and_MathML_support
Support in all current engines.
The SVG svg element falls into the embedded content,
phrasing content, flow content, and palpable content
categories for the purposes of the content models in this specification.
When the SVG foreignObject element contains elements from the
HTML namespace, such elements must all be flow content.
The content model for the SVG title element inside HTML
documents is phrasing content. (This further constrains the requirements given
in SVG 2.)
The semantics of SVG elements are defined by SVG 2 and other applicable specifications. [SVG]
doc = iframe.getSVGDocument()doc = embed.getSVGDocument()doc = object.getSVGDocument()Returns the Document object, in the case of iframe,
embed, or object elements being used to embed SVG.
The getSVGDocument() method steps are:
Let document be this's content document.
If document is non-null and was created by the page
load processing model for XML files section because the computed type of the resource in the navigate algorithm was
image/svg+xml, then return document.
Return null.
Author requirements: The width and
height attributes on img, iframe,
embed, object, video, source when the parent
is a picture element and, when their type
attribute is in the Image Button state,
input elements may be specified to give the dimensions of the visual content of the
element (the width and height respectively, relative to the nominal direction of the output
medium), in CSS pixels. The attributes, if specified, must have values
that are valid non-negative integers.
The specified dimensions given may differ from the dimensions specified in the resource itself, since the resource may have a resolution that differs from the CSS pixel resolution. (On screens, CSS pixels have a resolution of 96ppi, but in general the CSS pixel resolution depends on the reading distance.) If both attributes are specified, then one of the following statements must be true:
The target ratio is the ratio of the natural width to the
natural height in the resource. The specified width and specified
height are the values of the width and height attributes respectively.
The two attributes must be omitted if the resource in question does not have both a natural width and a natural height.
If the two attributes are both 0, it indicates that the element is not intended for the user (e.g. it might be a part of a service to count page views).
The dimension attributes are not intended to be used to stretch the image.
User agent requirements: User agents are expected to use these attributes as hints for the rendering.
Support in all current engines.
Support in all current engines.
The width and height IDL attributes on the iframe,
embed, object, source, and video elements must
reflect the respective content attributes of the same name.
For iframe, embed and object the IDL
attributes are DOMString; for video and
source the IDL attributes are unsigned
long.
The corresponding IDL attributes for img and
input elements are defined in those respective elements'
sections, as they are slightly more specific to those elements' other behaviors.