| 303 |
sub ROW_IMS () { 0b10000000 } |
sub ROW_IMS () { 0b10000000 } |
| 304 |
sub BODY_AFTER_IMS () { 0b100000000 } |
sub BODY_AFTER_IMS () { 0b100000000 } |
| 305 |
sub FRAME_IMS () { 0b1000000000 } |
sub FRAME_IMS () { 0b1000000000 } |
| 306 |
|
sub SELECT_IMS () { 0b10000000000 } |
| 307 |
|
|
| 308 |
## NOTE: "initial" and "before html" insertion modes have no constants. |
## NOTE: "initial" and "before html" insertion modes have no constants. |
| 309 |
|
|
| 326 |
sub AFTER_BODY_IM () { BODY_AFTER_IMS } |
sub AFTER_BODY_IM () { BODY_AFTER_IMS } |
| 327 |
sub IN_FRAMESET_IM () { FRAME_IMS | 0b01 } |
sub IN_FRAMESET_IM () { FRAME_IMS | 0b01 } |
| 328 |
sub AFTER_FRAMESET_IM () { FRAME_IMS | 0b10 } |
sub AFTER_FRAMESET_IM () { FRAME_IMS | 0b10 } |
| 329 |
sub IN_SELECT_IM () { 0b01 } |
sub IN_SELECT_IM () { SELECT_IMS | 0b01 } |
| 330 |
|
sub IN_SELECT_IN_TABLE_IM () { SELECT_IMS | 0b10 } |
| 331 |
sub IN_COLUMN_GROUP_IM () { 0b10 } |
sub IN_COLUMN_GROUP_IM () { 0b10 } |
| 332 |
|
|
| 333 |
## Implementations MUST act as if state machine in the spec |
## Implementations MUST act as if state machine in the spec |
| 4904 |
## reprocess |
## reprocess |
| 4905 |
redo B; |
redo B; |
| 4906 |
} |
} |
| 4907 |
} elsif ($self->{insertion_mode} == IN_SELECT_IM) { |
} elsif ($self->{insertion_mode} & SELECT_IMS) { |
| 4908 |
if ($token->{type} == CHARACTER_TOKEN) { |
if ($token->{type} == CHARACTER_TOKEN) { |
| 4909 |
!!!cp ('t271'); |
!!!cp ('t271'); |
| 4910 |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data}); |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data}); |
| 4943 |
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
| 4944 |
!!!next-token; |
!!!next-token; |
| 4945 |
redo B; |
redo B; |
| 4946 |
} elsif ($token->{tag_name} eq 'select') { |
} elsif ($token->{tag_name} eq 'select' or |
| 4947 |
## TODO: The type below is not good - <select> is replaced by </select> |
$token->{tag_name} eq 'input' or |
| 4948 |
!!!parse-error (type => 'not closed:select'); |
($self->{insertion_mode} == IN_SELECT_IN_TABLE_IM and |
| 4949 |
## As if </select> instead |
{ |
| 4950 |
|
caption => 1, table => 1, |
| 4951 |
|
tbody => 1, tfoot => 1, thead => 1, |
| 4952 |
|
tr => 1, td => 1, th => 1, |
| 4953 |
|
}->{$token->{tag_name}})) { |
| 4954 |
|
## TODO: The type below is not good - <select> is replaced by </select> |
| 4955 |
|
!!!parse-error (type => 'not closed:select'); |
| 4956 |
|
## NOTE: As if the token were </select> (<select> case) or |
| 4957 |
|
## as if there were </select> (otherwise). |
| 4958 |
## have an element in table scope |
## have an element in table scope |
| 4959 |
my $i; |
my $i; |
| 4960 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
| 4961 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
| 4962 |
if ($node->[1] eq $token->{tag_name}) { |
if ($node->[1] eq 'select') { |
| 4963 |
!!!cp ('t278'); |
!!!cp ('t278'); |
| 4964 |
$i = $_; |
$i = $_; |
| 4965 |
last INSCOPE; |
last INSCOPE; |
| 4983 |
|
|
| 4984 |
$self->_reset_insertion_mode; |
$self->_reset_insertion_mode; |
| 4985 |
|
|
| 4986 |
!!!next-token; |
if ($token->{tag_name} eq 'select') { |
| 4987 |
redo B; |
!!!cp ('t281.2'); |
| 4988 |
|
!!!next-token; |
| 4989 |
|
redo B; |
| 4990 |
|
} else { |
| 4991 |
|
!!!cp ('t281.1'); |
| 4992 |
|
## Reprocess the token. |
| 4993 |
|
redo B; |
| 4994 |
|
} |
| 4995 |
} else { |
} else { |
| 4996 |
!!!cp ('t282'); |
!!!cp ('t282'); |
| 4997 |
!!!parse-error (type => 'in select:'.$token->{tag_name}); |
!!!parse-error (type => 'in select:'.$token->{tag_name}); |
| 5058 |
|
|
| 5059 |
!!!next-token; |
!!!next-token; |
| 5060 |
redo B; |
redo B; |
| 5061 |
} elsif ({ |
} elsif ($self->{insertion_mode} == IN_SELECT_IN_TABLE_IM and |
| 5062 |
caption => 1, table => 1, tbody => 1, |
{ |
| 5063 |
tfoot => 1, thead => 1, tr => 1, td => 1, th => 1, |
caption => 1, table => 1, tbody => 1, |
| 5064 |
}->{$token->{tag_name}}) { |
tfoot => 1, thead => 1, tr => 1, td => 1, th => 1, |
| 5065 |
|
}->{$token->{tag_name}}) { |
| 5066 |
## TODO: The following is wrong? |
## TODO: The following is wrong? |
| 5067 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
| 5068 |
|
|
| 5963 |
|
|
| 5964 |
## TODO: associate with $self->{form_element} if defined |
## TODO: associate with $self->{form_element} if defined |
| 5965 |
|
|
| 5966 |
$self->{insertion_mode} = IN_SELECT_IM; |
if ($self->{insertion_mode} & TABLE_IMS or |
| 5967 |
|
$self->{insertion_mode} & BODY_TABLE_IMS or |
| 5968 |
|
$self->{insertion_mode} == IN_COLUMN_GROUP_IM) { |
| 5969 |
|
!!!cp ('t400.1'); |
| 5970 |
|
$self->{insertion_mode} = IN_SELECT_IN_TABLE_IM; |
| 5971 |
|
} else { |
| 5972 |
|
!!!cp ('t400.2'); |
| 5973 |
|
$self->{insertion_mode} = IN_SELECT_IM; |
| 5974 |
|
} |
| 5975 |
!!!next-token; |
!!!next-token; |
| 5976 |
redo B; |
redo B; |
| 5977 |
} elsif ({ |
} elsif ({ |