foster-node ( document node fallback -- )


Vocabulary
html5

Inputs
documentan object
nodean object
fallbackan object


Outputs
None

Definition


:: foster-node ( document node fallback -- )
document open-elements>> :> stack stack
[ "table" html-element-named? ] find-last drop
:> table-index stack
[ "template" html-element-named? ] find-last drop
:> template-index {
{
[
template-index [
table-index
[ template-index table-index > ] [ t ] if
] [ f ] if
]
[ node template-index stack nth attach-node ]
}
{
[ table-index ]
[
table-index stack nth :> table table parent>>
[ node table insert-before-node ]
[ node stack first attach-node ] if
]
}
[ node fallback attach-node ]
} cond ;