foreign-end-tag ( document token -- document )


Vocabulary
html5

Inputs
documentan object
tokenan object


Outputs
documentan object


Definition


:: foreign-end-tag ( document token -- document )
document open-elements>> :> stack stack length 1 -
:> i! f :> done!
[ i 0 > done not and ] [
i stack nth
:> node node name>> ascii-downcase token name>> =
[ node token >>end-tag drop i stack shorten t done! ] [
i 1 - i! i stack nth html-element?
[ document token html-tree-insert drop t done! ]
when
] if
] while document ;