A user account is required in order to edit this wiki, but we've had to disable public user registrations due to spam.

To request an account, ask an autoconfirmed user on Chat (such as one of these permanent autoconfirmed members).

New Vocabularies Solution: Difference between revisions

From WHATWG Wiki
Jump to navigation Jump to search
No edit summary
(+spec)
 
(26 intermediate revisions by 2 users not shown)
Line 1: Line 1:
'''this doesn't handle these cases well:'''
{{obsolete|spec=[http://www.whatwg.org/specs/web-apps/current-work/multipage/tree-construction.html#tree-construction HTML Standard: Tree construction] and [http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#tokenization HTML Standard: Tokenization]}}
<pre>
<table><math></html><!-- x --> (</html> should be ignored)
<table><td><math></html><!-- x --> (ditto)
<table><caption><math></html><!-- x --> (ditto)
<table><caption><math><mtext><caption>x (<caption> should start new caption)
<em><button><math></em>x (</em> should be ignored)
</pre>
'''to fix these we'll need a secondary insertion mode which is set whenever the insertion mode is set to "in math/svg", including in the reset algorithm (just jump down to the secondary steps and continue the walk up until you hit either the root, or a caption, td/th, or table)'''
 
'''what about:'''
<pre>
<table><caption><math><mrow><mtext><svg><circle></mrow>
<table><caption><math><mrow><mtext><svg><circle><foreignObject></mrow>
<table><caption><math><mrow><mtext><svg><circle></svg>
<table><caption><math><mtext><svg><circle><caption>
</pre>
'''check that those are handled right. maybe we need a stack for the insertion mode which is "{svg|math}*, {cell|caption|table|body}"'''
 
resetting appropriately:
* if current node is in the mathml namespace and is one of <mi>, <mo>, <mn>, <ms>, <mtext>, "in namespace content"
* if current node is in a namespace other than html, "in namespace"


tokeniser:
tokeniser:
* tokeniser changes so that when insertion mode is "in namespace", support CDATA blocks.
* move the insertion mode flag to before the tokeniser ✓‬
* tokeniser changes so that when insertion mode is "in namespace", support CDATA blocks. ✓‬
** add a paragraph to the "Markup declaration open state" saying that if the next seven characters match "[CDATA[", and the insertion mode is "in namespace", and the current node is not html nor either <mi>, <mo>, <mn>, <ms>, <mtext> in mathml, nor <foreignObject>, <desc>, <title> in svg, then you switch to a state that emits character tokens until it hits "]]>". ✓‬
* tokeniser keeps track of /> endings.
* tokeniser keeps track of /> endings.
** add a new tokeniser state which you go to when hitting a / instead of going to the "before attribute name state". This new state has just two exits -- one for ">", which sets a flag saying that the tag is self-closing, and one for anything else, which has a parse error and reconsumes in the "before attribute name state". ✓‬
** make it a parse error for end tags to have this slash ✓
** change the definition of "permitted slash" paragraph to instead say "if a start tag is emitted with the self-closing flag set, and the token is processed by the tree construction stage without that flag being acknowledged, then there is a parse error". ✓
** change the handling of the void elements "in body" and "in head" (anywhere else?) to acknowledge the self-closing flag. ✓‬
* we add all the MathML entities to the entity list.
* we add all the MathML entities to the entity list.
* &phi; works differently when in "in math" or "in math content".
 
resetting appropriately:
* if node is in a namespace other than html, "in namespace" ✓‬


'''"in body":'''
'''"in body":'''
* "math" element:
* "math" element:
*# insert math element in mathml namespace
*# insert math element in mathml namespace✓‬
*# switch to "in namespace", with secondary mode set to whatever insertion mode used to be
*# switch to "in namespace", with secondary mode set to whatever insertion mode used to be✓‬
*# if the tag had a closing slash, imply a closing tag with the same tag name
*# if the tag had a closing slash, imply a closing tag with the same tag name✓‬
* "svg" element
* "svg" element
*# insert svg element in svg namespace
*# insert svg element in svg namespace✓‬
*# switch to "in namespace", with secondary mode set to whatever insertion mode used to be
*# switch to "in namespace", with secondary mode set to whatever insertion mode used to be✓‬
*# if the tag had a closing slash, imply a closing tag with the same tag name
*# if the tag had a closing slash, imply a closing tag with the same tag name✓‬


'''"in namespace":'''
'''"in namespace":'''
Line 49: Line 36:
*# parse error
*# parse error


* if current node namespace is mathml and token is start tag for: <mi>, <mo>, <mn>, <ms>, <mtext>
* start tag if current node is <mi>, <mo>, <mn>, <ms>, <mtext> in mathml
* if current node namespace is svg and token is start tag for: <foreignobject>, <desc>, <title>
* start tag if current node is <foreignObject>, <desc>, <title> in svg
*# if namespace is svg, apply case fixups
* start tag if current node is in the html namespace
*# insert element for token
* start tag with tag name "svg" if current node is <annotation-xml> in mathml
*# switch to "in namespace content"
* end tag
*# if the tag had a closing slash, imply a closing tag with the same tag name
*# treat as in the secondary mode
*# if the insertion mode is still "in namespace", but there is no namespaced element in scope, switch to the secondary mode


* start tag for one of: (html elements)
* start tag for one of: (html elements)
* end tag for one of: </p>, </br>
*# parse error
*# parse error
*# pop nodes until the current node is in the html namespace
*# pop nodes until the current node is in the html namespace
Line 66: Line 53:
*# if namespace is svg, apply case fixups
*# if namespace is svg, apply case fixups
*# insert element for token, in same namespace as current node
*# insert element for token, in same namespace as current node
*# if the tag had a closing slash, imply a closing tag with the same tag name
*# if the tag had a closing slash, imply a closing tag with the same tag name and acknowledge the self-closing flag
 
* end tag
*# treat as in secondary mode
*# if the insertion mode is still "in namespace", but the current node is no longer a namespaced element (then there is no namespaced element in scope), switch to the secondary mode
 
'''"in namespace content":'''
 
* if currentnode is mathml and start tag for one of: mglyph malignmark
*# insert element for token, treat as void
 
* other start tag
*# treat as in the secondary mode


* end tag
syntax:
*# treat as in secondary mode
* add a kind of element for those elements not in the HTML namespace ✓‬
*# if the insertion mode is still "in namespace content", but there is no namespaced element in scope, switch to the secondary mode
* add a definition for how tags work for those elements to the Tags paragraph, including mentioning that start tags can be marked as self-closing, in which case there must not be a matching end tag ✓‬
*# if the insertion mode is still "in namespace content", but the current node is a non-html node that is not one of the following, switch to 'in namespace':
* define what these elements can contain in the subsequent paragraphs, including cdata; nothing if the start tag is marked self-closing ✓‬
*#* namespace is mathml and element is <mi>, <mo>, <mn>, <ms>, <mtext>
* add the definition of the /> syntax to the start tag bit, "self-closing" start tag ✓‬
*#* namespace is svg and element is <foreignObject>, <desc>, <title>
* define cdata blocks ✓‬


content models:
* define MathML's <math> element as phrasing ✓‬
* define SVG's <svg> as embedded ✓‬





Latest revision as of 16:11, 10 November 2012

This document is obsolete.

For the current specification, see: HTML Standard: Tree construction and HTML Standard: Tokenization


tokeniser:

  • move the insertion mode flag to before the tokeniser ✓‬
  • tokeniser changes so that when insertion mode is "in namespace", support CDATA blocks. ✓‬
    • add a paragraph to the "Markup declaration open state" saying that if the next seven characters match "[CDATA[", and the insertion mode is "in namespace", and the current node is not html nor either <mi>, <mo>, <mn>, <ms>, <mtext> in mathml, nor <foreignObject>, <desc>, <title> in svg, then you switch to a state that emits character tokens until it hits "]]>". ✓‬
  • tokeniser keeps track of /> endings.
    • add a new tokeniser state which you go to when hitting a / instead of going to the "before attribute name state". This new state has just two exits -- one for ">", which sets a flag saying that the tag is self-closing, and one for anything else, which has a parse error and reconsumes in the "before attribute name state". ✓‬
    • make it a parse error for end tags to have this slash ✓
    • change the definition of "permitted slash" paragraph to instead say "if a start tag is emitted with the self-closing flag set, and the token is processed by the tree construction stage without that flag being acknowledged, then there is a parse error". ✓
    • change the handling of the void elements "in body" and "in head" (anywhere else?) to acknowledge the self-closing flag. ✓‬
  • we add all the MathML entities to the entity list.

resetting appropriately:

  • if node is in a namespace other than html, "in namespace" ✓‬

"in body":

  • "math" element:
    1. insert math element in mathml namespace✓‬
    2. switch to "in namespace", with secondary mode set to whatever insertion mode used to be✓‬
    3. if the tag had a closing slash, imply a closing tag with the same tag name✓‬
  • "svg" element
    1. insert svg element in svg namespace✓‬
    2. switch to "in namespace", with secondary mode set to whatever insertion mode used to be✓‬
    3. if the tag had a closing slash, imply a closing tag with the same tag name✓‬

"in namespace":

  • comment
    1. insert comment
  • text:
    1. insert text
  • doctype
    1. parse error
  • start tag if current node is <mi>, <mo>, <mn>, <ms>, <mtext> in mathml
  • start tag if current node is <foreignObject>, <desc>, <title> in svg
  • start tag if current node is in the html namespace
  • start tag with tag name "svg" if current node is <annotation-xml> in mathml
  • end tag
    1. treat as in the secondary mode
    2. if the insertion mode is still "in namespace", but there is no namespaced element in scope, switch to the secondary mode
  • start tag for one of: (html elements)
    1. parse error
    2. pop nodes until the current node is in the html namespace
    3. switch to the secondary mode
    4. reprocess token
  • other start tag
    1. if namespace is svg, apply case fixups
    2. insert element for token, in same namespace as current node
    3. if the tag had a closing slash, imply a closing tag with the same tag name and acknowledge the self-closing flag

syntax:

  • add a kind of element for those elements not in the HTML namespace ✓‬
  • add a definition for how tags work for those elements to the Tags paragraph, including mentioning that start tags can be marked as self-closing, in which case there must not be a matching end tag ✓‬
  • define what these elements can contain in the subsequent paragraphs, including cdata; nothing if the start tag is marked self-closing ✓‬
  • add the definition of the /> syntax to the start tag bit, "self-closing" start tag ✓‬
  • define cdata blocks ✓‬

content models:

  • define MathML's <math> element as phrasing ✓‬
  • define SVG's <svg> as embedded ✓‬


MathML error handling in text/html

Require the following behaviour, since MathML requires the host language to define error handling:

  • An element with the wrong number or type of children must render as an error indicator. (list cases)
  • a sequence of one or more text nodes containing non-inter-element-whitespace must be treated as <mtext>

Interaction of MathML and CSS ('display')

...