Commit 2e7f24ac authored by namusyaka's avatar namusyaka Committed by Nigel Tao

html: update section numbers

Updates golang/go#23071

See https://html.spec.whatwg.org/multipage/

Change-Id: I1bde6e07ae9270ba7b320474b9bec8ec09a79f16
Reviewed-on: https://go-review.googlesource.com/94355Reviewed-by: 's avatarNigel Tao <nigeltao@golang.org>
parent dc948dff
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
package html package html
// Section 12.2.3.2 of the HTML5 specification says "The following elements // Section 12.2.4.2 of the HTML5 specification says "The following elements
// have varying levels of special parsing rules". // have varying levels of special parsing rules".
// https://html.spec.whatwg.org/multipage/syntax.html#the-stack-of-open-elements // https://html.spec.whatwg.org/multipage/syntax.html#the-stack-of-open-elements
var isSpecialElementMap = map[string]bool{ var isSpecialElementMap = map[string]bool{
......
...@@ -67,7 +67,7 @@ func mathMLTextIntegrationPoint(n *Node) bool { ...@@ -67,7 +67,7 @@ func mathMLTextIntegrationPoint(n *Node) bool {
return false return false
} }
// Section 12.2.5.5. // Section 12.2.6.5.
var breakout = map[string]bool{ var breakout = map[string]bool{
"b": true, "b": true,
"big": true, "big": true,
...@@ -115,7 +115,7 @@ var breakout = map[string]bool{ ...@@ -115,7 +115,7 @@ var breakout = map[string]bool{
"var": true, "var": true,
} }
// Section 12.2.5.5. // Section 12.2.6.5.
var svgTagNameAdjustments = map[string]string{ var svgTagNameAdjustments = map[string]string{
"altglyph": "altGlyph", "altglyph": "altGlyph",
"altglyphdef": "altGlyphDef", "altglyphdef": "altGlyphDef",
...@@ -155,7 +155,7 @@ var svgTagNameAdjustments = map[string]string{ ...@@ -155,7 +155,7 @@ var svgTagNameAdjustments = map[string]string{
"textpath": "textPath", "textpath": "textPath",
} }
// Section 12.2.5.1 // Section 12.2.6.1
var mathMLAttributeAdjustments = map[string]string{ var mathMLAttributeAdjustments = map[string]string{
"definitionurl": "definitionURL", "definitionurl": "definitionURL",
} }
......
...@@ -21,7 +21,8 @@ const ( ...@@ -21,7 +21,8 @@ const (
scopeMarkerNode scopeMarkerNode
) )
// Section 12.2.3.3 says "scope markers are inserted when entering applet // TODO(namusyaka): These elements should be updated.
// Section 12.2.4.3 says "The markers are inserted when entering applet
// elements, buttons, object elements, marquees, table cells, and table // elements, buttons, object elements, marquees, table cells, and table
// captions, and are used to prevent formatting from 'leaking'". // captions, and are used to prevent formatting from 'leaking'".
var scopeMarker = Node{Type: scopeMarkerNode} var scopeMarker = Node{Type: scopeMarkerNode}
......
...@@ -25,12 +25,12 @@ type parser struct { ...@@ -25,12 +25,12 @@ type parser struct {
hasSelfClosingToken bool hasSelfClosingToken bool
// doc is the document root element. // doc is the document root element.
doc *Node doc *Node
// The stack of open elements (section 12.2.3.2) and active formatting // The stack of open elements (section 12.2.4.2) and active formatting
// elements (section 12.2.3.3). // elements (section 12.2.4.3).
oe, afe nodeStack oe, afe nodeStack
// Element pointers (section 12.2.3.4). // Element pointers (section 12.2.4.4).
head, form *Node head, form *Node
// Other parsing state flags (section 12.2.3.5). // Other parsing state flags (section 12.2.4.5).
scripting, framesetOK bool scripting, framesetOK bool
// im is the current insertion mode. // im is the current insertion mode.
im insertionMode im insertionMode
...@@ -38,7 +38,7 @@ type parser struct { ...@@ -38,7 +38,7 @@ type parser struct {
// or inTableText insertion mode. // or inTableText insertion mode.
originalIM insertionMode originalIM insertionMode
// fosterParenting is whether new elements should be inserted according to // fosterParenting is whether new elements should be inserted according to
// the foster parenting rules (section 12.2.5.3). // the foster parenting rules (section 12.2.6.1).
fosterParenting bool fosterParenting bool
// quirks is whether the parser is operating in "quirks mode." // quirks is whether the parser is operating in "quirks mode."
quirks bool quirks bool
...@@ -56,7 +56,7 @@ func (p *parser) top() *Node { ...@@ -56,7 +56,7 @@ func (p *parser) top() *Node {
return p.doc return p.doc
} }
// Stop tags for use in popUntil. These come from section 12.2.3.2. // Stop tags for use in popUntil. These come from section 12.2.4.2.
var ( var (
defaultScopeStopTags = map[string][]a.Atom{ defaultScopeStopTags = map[string][]a.Atom{
"": {a.Applet, a.Caption, a.Html, a.Table, a.Td, a.Th, a.Marquee, a.Object, a.Template}, "": {a.Applet, a.Caption, a.Html, a.Table, a.Td, a.Th, a.Marquee, a.Object, a.Template},
...@@ -79,7 +79,7 @@ const ( ...@@ -79,7 +79,7 @@ const (
// popUntil pops the stack of open elements at the highest element whose tag // popUntil pops the stack of open elements at the highest element whose tag
// is in matchTags, provided there is no higher element in the scope's stop // is in matchTags, provided there is no higher element in the scope's stop
// tags (as defined in section 12.2.3.2). It returns whether or not there was // tags (as defined in section 12.2.4.2). It returns whether or not there was
// such an element. If there was not, popUntil leaves the stack unchanged. // such an element. If there was not, popUntil leaves the stack unchanged.
// //
// For example, the set of stop tags for table scope is: "html", "table". If // For example, the set of stop tags for table scope is: "html", "table". If
...@@ -234,7 +234,7 @@ func (p *parser) shouldFosterParent() bool { ...@@ -234,7 +234,7 @@ func (p *parser) shouldFosterParent() bool {
} }
// fosterParent adds a child node according to the foster parenting rules. // fosterParent adds a child node according to the foster parenting rules.
// Section 12.2.5.3, "foster parenting". // Section 12.2.6.1, "foster parenting".
func (p *parser) fosterParent(n *Node) { func (p *parser) fosterParent(n *Node) {
var table, parent, prev *Node var table, parent, prev *Node
var i int var i int
...@@ -304,7 +304,7 @@ func (p *parser) addElement() { ...@@ -304,7 +304,7 @@ func (p *parser) addElement() {
}) })
} }
// Section 12.2.3.3. // Section 12.2.4.3.
func (p *parser) addFormattingElement() { func (p *parser) addFormattingElement() {
tagAtom, attr := p.tok.DataAtom, p.tok.Attr tagAtom, attr := p.tok.DataAtom, p.tok.Attr
p.addElement() p.addElement()
...@@ -351,7 +351,7 @@ findIdenticalElements: ...@@ -351,7 +351,7 @@ findIdenticalElements:
p.afe = append(p.afe, p.top()) p.afe = append(p.afe, p.top())
} }
// Section 12.2.3.3. // Section 12.2.4.3.
func (p *parser) clearActiveFormattingElements() { func (p *parser) clearActiveFormattingElements() {
for { for {
n := p.afe.pop() n := p.afe.pop()
...@@ -361,7 +361,7 @@ func (p *parser) clearActiveFormattingElements() { ...@@ -361,7 +361,7 @@ func (p *parser) clearActiveFormattingElements() {
} }
} }
// Section 12.2.3.3. // Section 12.2.4.3.
func (p *parser) reconstructActiveFormattingElements() { func (p *parser) reconstructActiveFormattingElements() {
n := p.afe.top() n := p.afe.top()
if n == nil { if n == nil {
...@@ -390,12 +390,12 @@ func (p *parser) reconstructActiveFormattingElements() { ...@@ -390,12 +390,12 @@ func (p *parser) reconstructActiveFormattingElements() {
} }
} }
// Section 12.2.4. // Section 12.2.5.
func (p *parser) acknowledgeSelfClosingTag() { func (p *parser) acknowledgeSelfClosingTag() {
p.hasSelfClosingToken = false p.hasSelfClosingToken = false
} }
// An insertion mode (section 12.2.3.1) is the state transition function from // An insertion mode (section 12.2.4.1) is the state transition function from
// a particular state in the HTML5 parser's state machine. It updates the // a particular state in the HTML5 parser's state machine. It updates the
// parser's fields depending on parser.tok (where ErrorToken means EOF). // parser's fields depending on parser.tok (where ErrorToken means EOF).
// It returns whether the token was consumed. // It returns whether the token was consumed.
...@@ -403,7 +403,7 @@ type insertionMode func(*parser) bool ...@@ -403,7 +403,7 @@ type insertionMode func(*parser) bool
// setOriginalIM sets the insertion mode to return to after completing a text or // setOriginalIM sets the insertion mode to return to after completing a text or
// inTableText insertion mode. // inTableText insertion mode.
// Section 12.2.3.1, "using the rules for". // Section 12.2.4.1, "using the rules for".
func (p *parser) setOriginalIM() { func (p *parser) setOriginalIM() {
if p.originalIM != nil { if p.originalIM != nil {
panic("html: bad parser state: originalIM was set twice") panic("html: bad parser state: originalIM was set twice")
...@@ -411,7 +411,7 @@ func (p *parser) setOriginalIM() { ...@@ -411,7 +411,7 @@ func (p *parser) setOriginalIM() {
p.originalIM = p.im p.originalIM = p.im
} }
// Section 12.2.3.1, "reset the insertion mode". // Section 12.2.4.1, "reset the insertion mode".
func (p *parser) resetInsertionMode() { func (p *parser) resetInsertionMode() {
for i := len(p.oe) - 1; i >= 0; i-- { for i := len(p.oe) - 1; i >= 0; i-- {
n := p.oe[i] n := p.oe[i]
...@@ -452,7 +452,7 @@ func (p *parser) resetInsertionMode() { ...@@ -452,7 +452,7 @@ func (p *parser) resetInsertionMode() {
const whitespace = " \t\r\n\f" const whitespace = " \t\r\n\f"
// Section 12.2.5.4.1. // Section 12.2.6.4.1.
func initialIM(p *parser) bool { func initialIM(p *parser) bool {
switch p.tok.Type { switch p.tok.Type {
case TextToken: case TextToken:
...@@ -479,7 +479,7 @@ func initialIM(p *parser) bool { ...@@ -479,7 +479,7 @@ func initialIM(p *parser) bool {
return false return false
} }
// Section 12.2.5.4.2. // Section 12.2.6.4.2.
func beforeHTMLIM(p *parser) bool { func beforeHTMLIM(p *parser) bool {
switch p.tok.Type { switch p.tok.Type {
case DoctypeToken: case DoctypeToken:
...@@ -517,7 +517,7 @@ func beforeHTMLIM(p *parser) bool { ...@@ -517,7 +517,7 @@ func beforeHTMLIM(p *parser) bool {
return false return false
} }
// Section 12.2.5.4.3. // Section 12.2.6.4.3.
func beforeHeadIM(p *parser) bool { func beforeHeadIM(p *parser) bool {
switch p.tok.Type { switch p.tok.Type {
case TextToken: case TextToken:
...@@ -560,7 +560,7 @@ func beforeHeadIM(p *parser) bool { ...@@ -560,7 +560,7 @@ func beforeHeadIM(p *parser) bool {
return false return false
} }
// Section 12.2.5.4.4. // Section 12.2.6.4.4.
func inHeadIM(p *parser) bool { func inHeadIM(p *parser) bool {
switch p.tok.Type { switch p.tok.Type {
case TextToken: case TextToken:
...@@ -622,7 +622,7 @@ func inHeadIM(p *parser) bool { ...@@ -622,7 +622,7 @@ func inHeadIM(p *parser) bool {
return false return false
} }
// Section 12.2.5.4.6. // Section 12.2.6.4.6.
func afterHeadIM(p *parser) bool { func afterHeadIM(p *parser) bool {
switch p.tok.Type { switch p.tok.Type {
case TextToken: case TextToken:
...@@ -697,7 +697,7 @@ func copyAttributes(dst *Node, src Token) { ...@@ -697,7 +697,7 @@ func copyAttributes(dst *Node, src Token) {
} }
} }
// Section 12.2.5.4.7. // Section 12.2.6.4.7.
func inBodyIM(p *parser) bool { func inBodyIM(p *parser) bool {
switch p.tok.Type { switch p.tok.Type {
case TextToken: case TextToken:
...@@ -1160,7 +1160,7 @@ func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom) { ...@@ -1160,7 +1160,7 @@ func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom) {
} }
// inBodyEndTagOther performs the "any other end tag" algorithm for inBodyIM. // inBodyEndTagOther performs the "any other end tag" algorithm for inBodyIM.
// "Any other end tag" handling from 12.2.5.5 The rules for parsing tokens in foreign content // "Any other end tag" handling from 12.2.6.5 The rules for parsing tokens in foreign content
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inforeign // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inforeign
func (p *parser) inBodyEndTagOther(tagAtom a.Atom) { func (p *parser) inBodyEndTagOther(tagAtom a.Atom) {
for i := len(p.oe) - 1; i >= 0; i-- { for i := len(p.oe) - 1; i >= 0; i-- {
...@@ -1174,7 +1174,7 @@ func (p *parser) inBodyEndTagOther(tagAtom a.Atom) { ...@@ -1174,7 +1174,7 @@ func (p *parser) inBodyEndTagOther(tagAtom a.Atom) {
} }
} }
// Section 12.2.5.4.8. // Section 12.2.6.4.8.
func textIM(p *parser) bool { func textIM(p *parser) bool {
switch p.tok.Type { switch p.tok.Type {
case ErrorToken: case ErrorToken:
...@@ -1203,7 +1203,7 @@ func textIM(p *parser) bool { ...@@ -1203,7 +1203,7 @@ func textIM(p *parser) bool {
return p.tok.Type == EndTagToken return p.tok.Type == EndTagToken
} }
// Section 12.2.5.4.9. // Section 12.2.6.4.9.
func inTableIM(p *parser) bool { func inTableIM(p *parser) bool {
switch p.tok.Type { switch p.tok.Type {
case ErrorToken: case ErrorToken:
...@@ -1309,7 +1309,7 @@ func inTableIM(p *parser) bool { ...@@ -1309,7 +1309,7 @@ func inTableIM(p *parser) bool {
return inBodyIM(p) return inBodyIM(p)
} }
// Section 12.2.5.4.11. // Section 12.2.6.4.11.
func inCaptionIM(p *parser) bool { func inCaptionIM(p *parser) bool {
switch p.tok.Type { switch p.tok.Type {
case StartTagToken: case StartTagToken:
...@@ -1355,7 +1355,7 @@ func inCaptionIM(p *parser) bool { ...@@ -1355,7 +1355,7 @@ func inCaptionIM(p *parser) bool {
return inBodyIM(p) return inBodyIM(p)
} }
// Section 12.2.5.4.12. // Section 12.2.6.4.12.
func inColumnGroupIM(p *parser) bool { func inColumnGroupIM(p *parser) bool {
switch p.tok.Type { switch p.tok.Type {
case TextToken: case TextToken:
...@@ -1408,7 +1408,7 @@ func inColumnGroupIM(p *parser) bool { ...@@ -1408,7 +1408,7 @@ func inColumnGroupIM(p *parser) bool {
return true return true
} }
// Section 12.2.5.4.13. // Section 12.2.6.4.13.
func inTableBodyIM(p *parser) bool { func inTableBodyIM(p *parser) bool {
switch p.tok.Type { switch p.tok.Type {
case StartTagToken: case StartTagToken:
...@@ -1460,7 +1460,7 @@ func inTableBodyIM(p *parser) bool { ...@@ -1460,7 +1460,7 @@ func inTableBodyIM(p *parser) bool {
return inTableIM(p) return inTableIM(p)
} }
// Section 12.2.5.4.14. // Section 12.2.6.4.14.
func inRowIM(p *parser) bool { func inRowIM(p *parser) bool {
switch p.tok.Type { switch p.tok.Type {
case StartTagToken: case StartTagToken:
...@@ -1511,7 +1511,7 @@ func inRowIM(p *parser) bool { ...@@ -1511,7 +1511,7 @@ func inRowIM(p *parser) bool {
return inTableIM(p) return inTableIM(p)
} }
// Section 12.2.5.4.15. // Section 12.2.6.4.15.
func inCellIM(p *parser) bool { func inCellIM(p *parser) bool {
switch p.tok.Type { switch p.tok.Type {
case StartTagToken: case StartTagToken:
...@@ -1560,7 +1560,7 @@ func inCellIM(p *parser) bool { ...@@ -1560,7 +1560,7 @@ func inCellIM(p *parser) bool {
return inBodyIM(p) return inBodyIM(p)
} }
// Section 12.2.5.4.16. // Section 12.2.6.4.16.
func inSelectIM(p *parser) bool { func inSelectIM(p *parser) bool {
switch p.tok.Type { switch p.tok.Type {
case ErrorToken: case ErrorToken:
...@@ -1632,7 +1632,7 @@ func inSelectIM(p *parser) bool { ...@@ -1632,7 +1632,7 @@ func inSelectIM(p *parser) bool {
return true return true
} }
// Section 12.2.5.4.17. // Section 12.2.6.4.17.
func inSelectInTableIM(p *parser) bool { func inSelectInTableIM(p *parser) bool {
switch p.tok.Type { switch p.tok.Type {
case StartTagToken, EndTagToken: case StartTagToken, EndTagToken:
...@@ -1650,7 +1650,7 @@ func inSelectInTableIM(p *parser) bool { ...@@ -1650,7 +1650,7 @@ func inSelectInTableIM(p *parser) bool {
return inSelectIM(p) return inSelectIM(p)
} }
// Section 12.2.5.4.18. // Section 12.2.6.4.19.
func afterBodyIM(p *parser) bool { func afterBodyIM(p *parser) bool {
switch p.tok.Type { switch p.tok.Type {
case ErrorToken: case ErrorToken:
...@@ -1688,7 +1688,7 @@ func afterBodyIM(p *parser) bool { ...@@ -1688,7 +1688,7 @@ func afterBodyIM(p *parser) bool {
return false return false
} }
// Section 12.2.5.4.19. // Section 12.2.6.4.20.
func inFramesetIM(p *parser) bool { func inFramesetIM(p *parser) bool {
switch p.tok.Type { switch p.tok.Type {
case CommentToken: case CommentToken:
...@@ -1738,7 +1738,7 @@ func inFramesetIM(p *parser) bool { ...@@ -1738,7 +1738,7 @@ func inFramesetIM(p *parser) bool {
return true return true
} }
// Section 12.2.5.4.20. // Section 12.2.6.4.21.
func afterFramesetIM(p *parser) bool { func afterFramesetIM(p *parser) bool {
switch p.tok.Type { switch p.tok.Type {
case CommentToken: case CommentToken:
...@@ -1777,7 +1777,7 @@ func afterFramesetIM(p *parser) bool { ...@@ -1777,7 +1777,7 @@ func afterFramesetIM(p *parser) bool {
return true return true
} }
// Section 12.2.5.4.21. // Section 12.2.6.4.22.
func afterAfterBodyIM(p *parser) bool { func afterAfterBodyIM(p *parser) bool {
switch p.tok.Type { switch p.tok.Type {
case ErrorToken: case ErrorToken:
...@@ -1806,7 +1806,7 @@ func afterAfterBodyIM(p *parser) bool { ...@@ -1806,7 +1806,7 @@ func afterAfterBodyIM(p *parser) bool {
return false return false
} }
// Section 12.2.5.4.22. // Section 12.2.6.4.23.
func afterAfterFramesetIM(p *parser) bool { func afterAfterFramesetIM(p *parser) bool {
switch p.tok.Type { switch p.tok.Type {
case CommentToken: case CommentToken:
...@@ -1844,7 +1844,7 @@ func afterAfterFramesetIM(p *parser) bool { ...@@ -1844,7 +1844,7 @@ func afterAfterFramesetIM(p *parser) bool {
const whitespaceOrNUL = whitespace + "\x00" const whitespaceOrNUL = whitespace + "\x00"
// Section 12.2.5.5. // Section 12.2.6.5
func parseForeignContent(p *parser) bool { func parseForeignContent(p *parser) bool {
switch p.tok.Type { switch p.tok.Type {
case TextToken: case TextToken:
...@@ -1924,7 +1924,7 @@ func parseForeignContent(p *parser) bool { ...@@ -1924,7 +1924,7 @@ func parseForeignContent(p *parser) bool {
return true return true
} }
// Section 12.2.5. // Section 12.2.6.
func (p *parser) inForeignContent() bool { func (p *parser) inForeignContent() bool {
if len(p.oe) == 0 { if len(p.oe) == 0 {
return false return false
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment