Handbook
Glossary
tree-insert* ( document obj insertion-mode -- document )
Vocabulary
html5
Inputs
document
an
object
obj
an
object
insertion-mode
an
object
Outputs
document
an
object
Definition
IN:
html5
GENERIC:
tree-insert*
( document obj insertion-mode -- document )
Methods
USING:
accessors
combinators
combinators.short-circuit
html5
kernel
sequences
;
M:
after-after-body-mode
tree-insert*
drop
{
{
[
dup
comment?
]
[
over
tree>>
push
]
}
{
[
dup
doctype?
]
[
unimplemented*
]
}
{
[
dup
"\t\n\f\r "
member?
]
[
unimplemented*
]
}
{
[
dup
{
[
tag?
]
[
name>>
"html"
=
]
}
1&&
]
[
unimplemented*
]
}
{
[
dup
f
=
]
[
drop
]
}
[
[
in-body-mode
>>insertion-mode
]
dip
tree-insert
]
}
cond
;
USING:
html5
kernel
;
M:
after-after-frameset-mode
tree-insert*
drop
unimplemented*
;
USING:
accessors
combinators
combinators.short-circuit
html5
kernel
sequences
;
M:
after-body-mode
tree-insert*
drop
{
{
[
dup
"\t\n\f\r "
member?
]
[
over
tree>>
push
]
}
{
[
dup
comment?
]
[
over
tree>>
push
]
}
{
[
dup
doctype?
]
[
drop
]
}
{
[
dup
{
[
tag?
]
[
name>>
"html"
=
]
}
1&&
]
[
unimplemented*
]
}
{
[
dup
{
[
end-tag?
]
[
name>>
"html"
=
]
}
1&&
]
[
"html"
pick
tree>>
find-matching-tag
unclip
swap
>>children
swap
>>end-tag
over
tree>>
push
after-after-body-mode
>>insertion-mode
]
}
[
unimplemented*
]
}
cond
;
USING:
html5
kernel
;
M:
after-frameset-mode
tree-insert*
drop
unimplemented*
;
USING:
accessors
combinators
combinators.short-circuit
html5
kernel
sequences
tools.continuations
;
M:
after-head-mode
tree-insert*
drop
{
{
[
dup
"\t\n\f\r "
member?
]
[
over
tree>>
push
]
}
{
[
dup
comment?
]
[
over
tree>>
push
]
}
{
[
dup
doctype?
]
[
drop
]
}
{
[
dup
{
[
tag?
]
[
name>>
"html"
=
]
}
1&&
]
[
"handle html in-body-mode here"
throw
unimplemented*
]
}
{
[
dup
{
[
tag?
]
[
name>>
"html"
=
]
}
1&&
]
[
unimplemented*
]
}
{
[
dup
{
[
tag?
]
[
name>>
"body"
=
]
}
1&&
]
[
over
tree>>
push
f
>>frameset-ok?
in-body-mode
>>insertion-mode
]
}
{
[
dup
{
[
tag?
]
[
name>>
"frameset"
=
]
}
1&&
]
[
unimplemented*
]
}
{
[
dup
{
[
tag?
]
[
name>>
~array~
member?
]
}
1&&
]
[
unimplemented*
]
}
{
[
dup
{
[
end-tag?
]
[
name>>
"template"
=
]
}
1&&
]
[
unimplemented*
]
}
{
[
dup
{
[
~array~
1&&
]
[
~array~
1&&
]
}
1||
]
[
"omg revisit this"
throw
unimplemented*
]
}
[
break
<tag>
"body"
>>name
pick
tree>>
push
in-body-mode
>>insertion-mode
tree-insert
]
}
cond
;
USING:
accessors
combinators
combinators.short-circuit
html5
kernel
sequences
;
M:
before-head-mode
tree-insert*
drop
{
{
[
dup
"\t\n\f\r "
member?
]
[
drop
]
}
{
[
dup
comment?
]
[
over
tree>>
push
]
}
{
[
dup
doctype?
]
[
drop
]
}
{
[
dup
{
[
tag?
]
[
name>>
"html"
=
]
}
1&&
]
[
"handle html in-body-mode here"
throw
]
}
{
[
dup
{
[
tag?
]
[
name>>
"head"
=
]
}
1&&
]
[
[
swap
tree>>
push
]
[
>>head-element-pointer
drop
]
[
drop
in-head-mode
>>insertion-mode
]
2tri
]
}
{
[
dup
{
[
end-tag?
]
[
name>>
~array~
member?
not
]
}
1&&
]
[
drop
]
}
{
[
dup
tag?
]
[
drop
]
}
[
<tag>
[
"head"
>>name
pick
tree>>
push
]
[
>>head-element-pointer
]
bi
in-head-mode
>>insertion-mode
tree-insert
]
}
cond
;
USING:
accessors
combinators
combinators.short-circuit
html5
kernel
sequences
;
M:
before-html-mode
tree-insert*
drop
{
{
[
dup
doctype?
]
[
drop
]
}
{
[
dup
comment?
]
[
over
tree>>
push
]
}
{
[
dup
"\t\n\f\r "
member?
]
[
drop
]
}
{
[
dup
{
[
tag?
]
[
name>>
"html"
=
]
}
1&&
]
[
over
tree>>
push
before-head-mode
>>insertion-mode
]
}
{
[
dup
{
[
end-tag?
]
[
name>>
~array~
member?
not
]
}
1&&
]
[
drop
]
}
[
<tag>
"html"
>>name
pick
tree>>
push
before-head-mode
>>insertion-mode
tree-insert
]
}
cond
;
USING:
accessors
combinators
combinators.short-circuit
html5
kernel
sequences
;
M:
in-body-mode
tree-insert*
drop
{
{
[
dup
0
=
]
[
drop
]
}
{
[
dup
"\t\n\f\r "
member?
]
[
over
tree>>
push
]
}
{
[
dup
comment?
]
[
over
tree>>
push
]
}
{
[
dup
doctype?
]
[
drop
]
}
{
[
dup
{
[
tag?
]
[
name>>
"html"
=
]
}
1&&
]
[
drop
]
}
{
[
dup
{
[
~array~
1&&
]
[
~array~
1&&
]
}
1||
]
[
unimplemented*
]
}
{
[
dup
{
[
tag?
]
[
name>>
"body"
=
]
}
1&&
]
[
drop
unimplemented*
]
}
{
[
dup
{
[
tag?
]
[
name>>
"frameset"
=
]
}
1&&
]
[
drop
unimplemented*
]
}
{
[
dup
{
[
end-tag?
]
[
name>>
"body"
=
]
}
1&&
]
[
"body"
pick
tree>>
find-matching-tag
unclip
swap
>>children
swap
>>end-tag
over
tree>>
push
after-body-mode
>>insertion-mode
]
}
{
[
dup
{
[
end-tag?
]
[
name>>
"html"
=
]
}
1&&
]
[
drop
unimplemented*
]
}
[
unimplemented*
]
}
cond
;
USING:
html5
kernel
;
M:
in-caption-mode
tree-insert*
drop
unimplemented*
;
USING:
html5
kernel
;
M:
in-cell-mode
tree-insert*
drop
unimplemented*
;
USING:
html5
kernel
;
M:
in-column-group-mode
tree-insert*
drop
unimplemented*
;
USING:
html5
kernel
;
M:
in-frameset-mode
tree-insert*
drop
unimplemented*
;
USING:
accessors
combinators
combinators.short-circuit
html5
kernel
sequences
;
M:
in-head-mode
tree-insert*
drop
{
{
[
dup
"\t\n\f\r "
member?
]
[
over
tree>>
push
]
}
{
[
dup
comment?
]
[
over
tree>>
push
]
}
{
[
dup
doctype?
]
[
drop
]
}
{
[
dup
{
[
tag?
]
[
name>>
"html"
=
]
}
1&&
]
[
"handle html in-body-mode here"
throw
unimplemented*
]
}
{
[
dup
{
[
tag?
]
[
name>>
~array~
member?
]
}
1&&
]
[
unimplemented*
]
}
{
[
dup
{
[
tag?
]
[
name>>
"meta"
=
]
}
1&&
]
[
unimplemented*
]
}
{
[
dup
{
[
tag?
]
[
name>>
"title"
=
]
}
1&&
]
[
"insert title node"
throw
unimplemented*
]
}
{
[
dup
{
[
~array~
1&&
]
[
~array~
1&&
]
}
1||
]
[
unimplemented*
]
}
{
[
dup
{
[
tag?
]
[
name>>
"noscript"
=
]
[
scripting?>>
not
]
}
1&&
]
[
unimplemented*
over
tree>>
push
in-head-noscript-mode
>>insertion-mode
]
}
{
[
dup
{
[
tag?
]
[
name>>
"script"
=
]
}
1&&
]
[
unimplemented*
text-mode
>>insertion-mode
]
}
{
[
dup
{
[
end-tag?
]
[
name>>
"head"
=
]
}
1&&
]
[
over
tree>>
last
end-tag<<
after-head-mode
>>insertion-mode
]
}
{
[
dup
{
[
end-tag?
]
[
name>>
~array~
member?
]
}
1&&
]
[
unimplemented*
]
}
{
[
dup
{
[
tag?
]
[
name>>
"template"
=
]
}
1&&
]
[
unimplemented*
in-template-mode
>>insertion-mode
]
}
{
[
dup
{
[
end-tag?
]
[
name>>
"template"
=
]
}
1&&
]
[
unimplemented*
]
}
{
[
dup
{
[
~array~
1&&
]
[
end-tag?
]
}
1||
]
[
drop
"ignore here"
throw
]
}
[
over
tree>>
pop
swap
>>end-tag
after-head-mode
>>insertion-mode
"omg"
throw
]
}
cond
;
USING:
html5
kernel
;
M:
in-head-noscript-mode
tree-insert*
drop
unimplemented*
;
USING:
html5
kernel
;
M:
in-row-mode
tree-insert*
drop
unimplemented*
;
USING:
html5
kernel
;
M:
in-select-in-table-mode
tree-insert*
drop
unimplemented*
;
USING:
html5
kernel
;
M:
in-select-mode
tree-insert*
drop
unimplemented*
;
USING:
html5
kernel
;
M:
in-table-body-mode
tree-insert*
drop
unimplemented*
;
USING:
html5
kernel
;
M:
in-table-mode
tree-insert*
drop
unimplemented*
;
USING:
html5
kernel
;
M:
in-table-text-mode
tree-insert*
drop
unimplemented*
;
USING:
html5
kernel
;
M:
in-template-mode
tree-insert*
drop
unimplemented*
;
USING:
accessors
combinators
html5
kernel
sequences
;
M:
initial-mode
tree-insert*
drop
{
{
[
dup
"\t\n\f\r "
member?
]
[
drop
]
}
{
[
dup
doctype?
]
[
>>tree-doctype
before-html-mode
>>insertion-mode
]
}
{
[
dup
comment?
]
[
over
tree>>
push
]
}
{
[
dup
tag?
]
[
over
tree>>
push
]
}
{
[
dup
end-tag?
]
[
dup
name>>
pick
tree>>
find-matching-tag
unclip
swap
>>children
swap
>>end-tag
over
tree>>
push
]
}
[
over
iframe-srcdoc?>>
[
over
parser-cannot-change-mode-flag>>
[
[
t
>>quirks-mode?
]
dip
]
unless
]
[
"must be iframe-srcdoc here"
throw
]
if
before-html-mode
>>insertion-mode
tree-insert
]
}
cond
;
USING:
html5
kernel
;
M:
text-mode
tree-insert*
drop
unimplemented*
;