Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
d360e021
Commit
d360e021
authored
Jul 13, 2011
by
Nigel Tao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
html: update section references in comments to the latest HTML5 spec.
R=r CC=golang-dev
https://golang.org/cl/4699048
parent
9415cd1d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
23 deletions
+23
-23
parse.go
src/pkg/html/parse.go
+23
-23
No files found.
src/pkg/html/parse.go
View file @
d360e021
...
...
@@ -45,11 +45,11 @@ type parser struct {
hasSelfClosingToken
bool
// doc is the document root element.
doc
*
Node
// The stack of open elements (section 1
0
.2.3.2).
// The stack of open elements (section 1
1
.2.3.2).
stack
[]
*
Node
// Element pointers (section 1
0
.2.3.4).
// Element pointers (section 1
1
.2.3.4).
head
,
form
*
Node
// Other parsing state flags (section 1
0
.2.3.5).
// Other parsing state flags (section 1
1
.2.3.5).
scripting
,
framesetOK
bool
}
...
...
@@ -76,7 +76,7 @@ func (p *parser) pop() *Node {
return
ret
}
// stopTags for use in popUntil. These come from section 1
0
.2.3.2.
// stopTags for use in popUntil. These come from section 1
1
.2.3.2.
var
(
defaultScopeStopTags
=
[]
string
{
"applet"
,
"caption"
,
"html"
,
"table"
,
"td"
,
"th"
,
"marquee"
,
"object"
}
listItemScopeStopTags
=
[]
string
{
"applet"
,
"caption"
,
"html"
,
"table"
,
"td"
,
"th"
,
"marquee"
,
"object"
,
"ol"
,
"ul"
}
...
...
@@ -148,13 +148,13 @@ func (p *parser) addElement(tag string, attr []Attribute) {
})
}
// Section 1
0
.2.3.3.
// Section 1
1
.2.3.3.
func
(
p
*
parser
)
addFormattingElement
(
tag
string
,
attr
[]
Attribute
)
{
p
.
addElement
(
tag
,
attr
)
// TODO.
}
// Section 1
0
.2.3.3.
// Section 1
1
.2.3.3.
func
(
p
*
parser
)
reconstructActiveFormattingElements
()
{
// TODO.
}
...
...
@@ -180,12 +180,12 @@ func (p *parser) read() os.Error {
return
nil
}
// Section 1
0
.2.4.
// Section 1
1
.2.4.
func
(
p
*
parser
)
acknowledgeSelfClosingTag
()
{
p
.
hasSelfClosingToken
=
false
}
// An insertion mode (section 1
0
.2.3.1) is the state transition function from
// An insertion mode (section 1
1
.2.3.1) is the state transition function from
// a particular state in the HTML5 parser's state machine. It updates the
// parser's fields depending on parser.token (where ErrorToken means EOF). In
// addition to returning the next insertionMode state, it also returns whether
...
...
@@ -194,7 +194,7 @@ type insertionMode func(*parser) (insertionMode, bool)
// useTheRulesFor runs the delegate insertionMode over p, returning the actual
// insertionMode unless the delegate caused a state transition.
// Section 1
0
.2.3.1, "using the rules for".
// Section 1
1
.2.3.1, "using the rules for".
func
useTheRulesFor
(
p
*
parser
,
actual
,
delegate
insertionMode
)
(
insertionMode
,
bool
)
{
im
,
consumed
:=
delegate
(
p
)
if
im
!=
delegate
{
...
...
@@ -203,13 +203,13 @@ func useTheRulesFor(p *parser, actual, delegate insertionMode) (insertionMode, b
return
actual
,
consumed
}
// Section 1
0.2.5.4
.
// Section 1
1.2.5.4.1
.
func
initialIM
(
p
*
parser
)
(
insertionMode
,
bool
)
{
// TODO: check p.tok for DOCTYPE.
return
beforeHTMLIM
,
false
}
// Section 1
0.2.5.5
.
// Section 1
1.2.5.4.2
.
func
beforeHTMLIM
(
p
*
parser
)
(
insertionMode
,
bool
)
{
var
(
add
bool
...
...
@@ -243,7 +243,7 @@ func beforeHTMLIM(p *parser) (insertionMode, bool) {
return
beforeHeadIM
,
!
implied
}
// Section 1
0.2.5.6
.
// Section 1
1.2.5.4.3
.
func
beforeHeadIM
(
p
*
parser
)
(
insertionMode
,
bool
)
{
var
(
add
bool
...
...
@@ -280,7 +280,7 @@ func beforeHeadIM(p *parser) (insertionMode, bool) {
return
inHeadIM
,
!
implied
}
// Section 1
0.2.5.7
.
// Section 1
1.2.5.4.4
.
func
inHeadIM
(
p
*
parser
)
(
insertionMode
,
bool
)
{
var
(
pop
bool
...
...
@@ -314,7 +314,7 @@ func inHeadIM(p *parser) (insertionMode, bool) {
return
inHeadIM
,
!
implied
}
// Section 1
0.2.5.9
.
// Section 1
1.2.5.4.6
.
func
afterHeadIM
(
p
*
parser
)
(
insertionMode
,
bool
)
{
var
(
add
bool
...
...
@@ -354,7 +354,7 @@ func afterHeadIM(p *parser) (insertionMode, bool) {
return
inBodyIM
,
!
implied
}
// Section 1
0.2.5.10
.
// Section 1
1.2.5.4.7
.
func
inBodyIM
(
p
*
parser
)
(
insertionMode
,
bool
)
{
var
endP
bool
switch
p
.
tok
.
Type
{
...
...
@@ -364,7 +364,7 @@ func inBodyIM(p *parser) (insertionMode, bool) {
case
StartTagToken
:
switch
p
.
tok
.
Data
{
case
"address"
,
"article"
,
"aside"
,
"blockquote"
,
"center"
,
"details"
,
"dir"
,
"div"
,
"dl"
,
"fieldset"
,
"figcaption"
,
"figure"
,
"footer"
,
"header"
,
"hgroup"
,
"menu"
,
"nav"
,
"ol"
,
"p"
,
"section"
,
"summary"
,
"ul"
:
// TODO: Do the proper "does the stack of open elements has a p element in button scope" algorithm in section 1
0
.2.3.2.
// TODO: Do the proper "does the stack of open elements has a p element in button scope" algorithm in section 1
1
.2.3.2.
n
:=
p
.
top
()
if
n
.
Type
==
ElementNode
&&
n
.
Data
==
"p"
{
endP
=
true
...
...
@@ -430,7 +430,7 @@ func inBodyIM(p *parser) (insertionMode, bool) {
return
inBodyIM
,
!
endP
}
// Section 1
0.2.5.12
.
// Section 1
1.2.5.4.9
.
func
inTableIM
(
p
*
parser
)
(
insertionMode
,
bool
)
{
var
(
add
bool
...
...
@@ -461,7 +461,7 @@ func inTableIM(p *parser) (insertionMode, bool) {
switch
p
.
tok
.
Data
{
case
"table"
:
if
p
.
popUntil
(
tableScopeStopTags
,
"table"
)
{
// TODO: "reset the insertion mode appropriately" as per 1
0
.2.3.1.
// TODO: "reset the insertion mode appropriately" as per 1
1
.2.3.1.
return
inBodyIM
,
false
}
// Ignore the token.
...
...
@@ -480,7 +480,7 @@ func inTableIM(p *parser) (insertionMode, bool) {
return
inTableIM
,
true
}
// Section 1
0.2.5.16
.
// Section 1
1.2.5.4.13
.
func
inTableBodyIM
(
p
*
parser
)
(
insertionMode
,
bool
)
{
var
(
add
bool
...
...
@@ -528,7 +528,7 @@ func inTableBodyIM(p *parser) (insertionMode, bool) {
return
useTheRulesFor
(
p
,
inTableBodyIM
,
inTableIM
)
}
// Section 1
0.2.5.17
.
// Section 1
1.2.5.4.14
.
func
inRowIM
(
p
*
parser
)
(
insertionMode
,
bool
)
{
switch
p
.
tok
.
Type
{
case
ErrorToken
:
...
...
@@ -567,7 +567,7 @@ func inRowIM(p *parser) (insertionMode, bool) {
return
useTheRulesFor
(
p
,
inRowIM
,
inTableIM
)
}
// Section 1
0.2.5.18
.
// Section 1
1.2.5.4.15
.
func
inCellIM
(
p
*
parser
)
(
insertionMode
,
bool
)
{
var
(
closeTheCellAndReprocess
bool
...
...
@@ -599,7 +599,7 @@ func inCellIM(p *parser) (insertionMode, bool) {
return
useTheRulesFor
(
p
,
inCellIM
,
inBodyIM
)
}
// Section 1
0.2.5.22
.
// Section 1
1.2.5.4.18
.
func
afterBodyIM
(
p
*
parser
)
(
insertionMode
,
bool
)
{
switch
p
.
tok
.
Type
{
case
ErrorToken
:
...
...
@@ -620,7 +620,7 @@ func afterBodyIM(p *parser) (insertionMode, bool) {
return
afterBodyIM
,
true
}
// Section 1
0.2.5.25
.
// Section 1
1.2.5.4.21
.
func
afterAfterBodyIM
(
p
*
parser
)
(
insertionMode
,
bool
)
{
switch
p
.
tok
.
Type
{
case
ErrorToken
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment