150 |
return $self; |
return $self; |
151 |
} # new |
} # new |
152 |
|
|
153 |
|
sub CM_ENTITY () { 0b001 } # & markup in data |
154 |
|
sub CM_LIMITED_MARKUP () { 0b010 } # < markup in data (limited) |
155 |
|
sub CM_FULL_MARKUP () { 0b100 } # < markup in data (any) |
156 |
|
|
157 |
|
sub PLAINTEXT_CONTENT_MODEL () { 0 } |
158 |
|
sub CDATA_CONTENT_MODEL () { CM_LIMITED_MARKUP } |
159 |
|
sub RCDATA_CONTENT_MODEL () { CM_ENTITY | CM_LIMITED_MARKUP } |
160 |
|
sub PCDATA_CONTENT_MODEL () { CM_ENTITY | CM_FULL_MARKUP } |
161 |
|
|
162 |
## Implementations MUST act as if state machine in the spec |
## Implementations MUST act as if state machine in the spec |
163 |
|
|
164 |
sub _initialize_tokenizer ($) { |
sub _initialize_tokenizer ($) { |
165 |
my $self = shift; |
my $self = shift; |
166 |
$self->{state} = 'data'; # MUST |
$self->{state} = 'data'; # MUST |
167 |
$self->{content_model_flag} = 'PCDATA'; # be |
$self->{content_model} = PCDATA_CONTENT_MODEL; # be |
168 |
undef $self->{current_token}; # start tag, end tag, comment, or DOCTYPE |
undef $self->{current_token}; # start tag, end tag, comment, or DOCTYPE |
169 |
undef $self->{current_attribute}; |
undef $self->{current_attribute}; |
170 |
undef $self->{last_emitted_start_tag_name}; |
undef $self->{last_emitted_start_tag_name}; |
203 |
A: { |
A: { |
204 |
if ($self->{state} eq 'data') { |
if ($self->{state} eq 'data') { |
205 |
if ($self->{next_input_character} == 0x0026) { # & |
if ($self->{next_input_character} == 0x0026) { # & |
206 |
if ($self->{content_model_flag} eq 'PCDATA' or |
if ($self->{content_model} & CM_ENTITY) { # PCDATA | RCDATA |
|
$self->{content_model_flag} eq 'RCDATA') { |
|
207 |
$self->{state} = 'entity data'; |
$self->{state} = 'entity data'; |
208 |
!!!next-input-character; |
!!!next-input-character; |
209 |
redo A; |
redo A; |
211 |
# |
# |
212 |
} |
} |
213 |
} elsif ($self->{next_input_character} == 0x002D) { # - |
} elsif ($self->{next_input_character} == 0x002D) { # - |
214 |
if ($self->{content_model_flag} eq 'RCDATA' or |
if ($self->{content_model} & CM_LIMITED_MARKUP) { # RCDATA | CDATA |
|
$self->{content_model_flag} eq 'CDATA') { |
|
215 |
unless ($self->{escape}) { |
unless ($self->{escape}) { |
216 |
if ($self->{prev_input_character}->[0] == 0x002D and # - |
if ($self->{prev_input_character}->[0] == 0x002D and # - |
217 |
$self->{prev_input_character}->[1] == 0x0021 and # ! |
$self->{prev_input_character}->[1] == 0x0021 and # ! |
223 |
|
|
224 |
# |
# |
225 |
} elsif ($self->{next_input_character} == 0x003C) { # < |
} elsif ($self->{next_input_character} == 0x003C) { # < |
226 |
if ($self->{content_model_flag} eq 'PCDATA' or |
if ($self->{content_model} & CM_FULL_MARKUP or # PCDATA |
227 |
(($self->{content_model_flag} eq 'CDATA' or |
(($self->{content_model} & CM_LIMITED_MARKUP) and # CDATA | RCDATA |
|
$self->{content_model_flag} eq 'RCDATA') and |
|
228 |
not $self->{escape})) { |
not $self->{escape})) { |
229 |
$self->{state} = 'tag open'; |
$self->{state} = 'tag open'; |
230 |
!!!next-input-character; |
!!!next-input-character; |
234 |
} |
} |
235 |
} elsif ($self->{next_input_character} == 0x003E) { # > |
} elsif ($self->{next_input_character} == 0x003E) { # > |
236 |
if ($self->{escape} and |
if ($self->{escape} and |
237 |
($self->{content_model_flag} eq 'RCDATA' or |
($self->{content_model} & CM_LIMITED_MARKUP)) { # RCDATA | CDATA |
|
$self->{content_model_flag} eq 'CDATA')) { |
|
238 |
if ($self->{prev_input_character}->[0] == 0x002D and # - |
if ($self->{prev_input_character}->[0] == 0x002D and # - |
239 |
$self->{prev_input_character}->[1] == 0x002D) { # - |
$self->{prev_input_character}->[1] == 0x002D) { # - |
240 |
delete $self->{escape}; |
delete $self->{escape}; |
271 |
|
|
272 |
redo A; |
redo A; |
273 |
} elsif ($self->{state} eq 'tag open') { |
} elsif ($self->{state} eq 'tag open') { |
274 |
if ($self->{content_model_flag} eq 'RCDATA' or |
if ($self->{content_model} & CM_LIMITED_MARKUP) { # RCDATA | CDATA |
|
$self->{content_model_flag} eq 'CDATA') { |
|
275 |
if ($self->{next_input_character} == 0x002F) { # / |
if ($self->{next_input_character} == 0x002F) { # / |
276 |
!!!next-input-character; |
!!!next-input-character; |
277 |
$self->{state} = 'close tag open'; |
$self->{state} = 'close tag open'; |
284 |
|
|
285 |
redo A; |
redo A; |
286 |
} |
} |
287 |
} elsif ($self->{content_model_flag} eq 'PCDATA') { |
} elsif ($self->{content_model} & CM_FULL_MARKUP) { # PCDATA |
288 |
if ($self->{next_input_character} == 0x0021) { # ! |
if ($self->{next_input_character} == 0x0021) { # ! |
289 |
$self->{state} = 'markup declaration open'; |
$self->{state} = 'markup declaration open'; |
290 |
!!!next-input-character; |
!!!next-input-character; |
331 |
redo A; |
redo A; |
332 |
} |
} |
333 |
} else { |
} else { |
334 |
die "$0: $self->{content_model_flag}: Unknown content model flag"; |
die "$0: $self->{content_model} in tag open"; |
335 |
} |
} |
336 |
} elsif ($self->{state} eq 'close tag open') { |
} elsif ($self->{state} eq 'close tag open') { |
337 |
if ($self->{content_model_flag} eq 'RCDATA' or |
if ($self->{content_model} & CM_LIMITED_MARKUP) { # RCDATA | CDATA |
|
$self->{content_model_flag} eq 'CDATA') { |
|
338 |
if (defined $self->{last_emitted_start_tag_name}) { |
if (defined $self->{last_emitted_start_tag_name}) { |
339 |
## NOTE: <http://krijnhoetmer.nl/irc-logs/whatwg/20070626#l-564> |
## NOTE: <http://krijnhoetmer.nl/irc-logs/whatwg/20070626#l-564> |
340 |
my @next_char; |
my @next_char; |
432 |
= not defined $self->{last_emitted_start_tag_name}; |
= not defined $self->{last_emitted_start_tag_name}; |
433 |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
434 |
} elsif ($self->{current_token}->{type} eq 'end tag') { |
} elsif ($self->{current_token}->{type} eq 'end tag') { |
435 |
$self->{content_model_flag} = 'PCDATA'; # MUST |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
436 |
if ($self->{current_token}->{attributes}) { |
if ($self->{current_token}->{attributes}) { |
437 |
!!!parse-error (type => 'end tag attribute'); |
!!!parse-error (type => 'end tag attribute'); |
438 |
} |
} |
459 |
= not defined $self->{last_emitted_start_tag_name}; |
= not defined $self->{last_emitted_start_tag_name}; |
460 |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
461 |
} elsif ($self->{current_token}->{type} eq 'end tag') { |
} elsif ($self->{current_token}->{type} eq 'end tag') { |
462 |
$self->{content_model_flag} = 'PCDATA'; # MUST |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
463 |
if ($self->{current_token}->{attributes}) { |
if ($self->{current_token}->{attributes}) { |
464 |
!!!parse-error (type => 'end tag attribute'); |
!!!parse-error (type => 'end tag attribute'); |
465 |
} |
} |
507 |
= not defined $self->{last_emitted_start_tag_name}; |
= not defined $self->{last_emitted_start_tag_name}; |
508 |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
509 |
} elsif ($self->{current_token}->{type} eq 'end tag') { |
} elsif ($self->{current_token}->{type} eq 'end tag') { |
510 |
$self->{content_model_flag} = 'PCDATA'; # MUST |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
511 |
if ($self->{current_token}->{attributes}) { |
if ($self->{current_token}->{attributes}) { |
512 |
!!!parse-error (type => 'end tag attribute'); |
!!!parse-error (type => 'end tag attribute'); |
513 |
} |
} |
547 |
= not defined $self->{last_emitted_start_tag_name}; |
= not defined $self->{last_emitted_start_tag_name}; |
548 |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
549 |
} elsif ($self->{current_token}->{type} eq 'end tag') { |
} elsif ($self->{current_token}->{type} eq 'end tag') { |
550 |
$self->{content_model_flag} = 'PCDATA'; # MUST |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
551 |
if ($self->{current_token}->{attributes}) { |
if ($self->{current_token}->{attributes}) { |
552 |
!!!parse-error (type => 'end tag attribute'); |
!!!parse-error (type => 'end tag attribute'); |
553 |
} |
} |
600 |
= not defined $self->{last_emitted_start_tag_name}; |
= not defined $self->{last_emitted_start_tag_name}; |
601 |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
602 |
} elsif ($self->{current_token}->{type} eq 'end tag') { |
} elsif ($self->{current_token}->{type} eq 'end tag') { |
603 |
$self->{content_model_flag} = 'PCDATA'; # MUST |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
604 |
if ($self->{current_token}->{attributes}) { |
if ($self->{current_token}->{attributes}) { |
605 |
!!!parse-error (type => 'end tag attribute'); |
!!!parse-error (type => 'end tag attribute'); |
606 |
} |
} |
641 |
= not defined $self->{last_emitted_start_tag_name}; |
= not defined $self->{last_emitted_start_tag_name}; |
642 |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
643 |
} elsif ($self->{current_token}->{type} eq 'end tag') { |
} elsif ($self->{current_token}->{type} eq 'end tag') { |
644 |
$self->{content_model_flag} = 'PCDATA'; # MUST |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
645 |
if ($self->{current_token}->{attributes}) { |
if ($self->{current_token}->{attributes}) { |
646 |
!!!parse-error (type => 'end tag attribute'); |
!!!parse-error (type => 'end tag attribute'); |
647 |
} |
} |
679 |
= not defined $self->{last_emitted_start_tag_name}; |
= not defined $self->{last_emitted_start_tag_name}; |
680 |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
681 |
} elsif ($self->{current_token}->{type} eq 'end tag') { |
} elsif ($self->{current_token}->{type} eq 'end tag') { |
682 |
$self->{content_model_flag} = 'PCDATA'; # MUST |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
683 |
if ($self->{current_token}->{attributes}) { |
if ($self->{current_token}->{attributes}) { |
684 |
!!!parse-error (type => 'end tag attribute'); |
!!!parse-error (type => 'end tag attribute'); |
685 |
} |
} |
720 |
= not defined $self->{last_emitted_start_tag_name}; |
= not defined $self->{last_emitted_start_tag_name}; |
721 |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
722 |
} elsif ($self->{current_token}->{type} eq 'end tag') { |
} elsif ($self->{current_token}->{type} eq 'end tag') { |
723 |
$self->{content_model_flag} = 'PCDATA'; # MUST |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
724 |
if ($self->{current_token}->{attributes}) { |
if ($self->{current_token}->{attributes}) { |
725 |
!!!parse-error (type => 'end tag attribute'); |
!!!parse-error (type => 'end tag attribute'); |
726 |
} |
} |
767 |
= not defined $self->{last_emitted_start_tag_name}; |
= not defined $self->{last_emitted_start_tag_name}; |
768 |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
769 |
} elsif ($self->{current_token}->{type} eq 'end tag') { |
} elsif ($self->{current_token}->{type} eq 'end tag') { |
770 |
$self->{content_model_flag} = 'PCDATA'; # MUST |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
771 |
if ($self->{current_token}->{attributes}) { |
if ($self->{current_token}->{attributes}) { |
772 |
!!!parse-error (type => 'end tag attribute'); |
!!!parse-error (type => 'end tag attribute'); |
773 |
} |
} |
787 |
= not defined $self->{last_emitted_start_tag_name}; |
= not defined $self->{last_emitted_start_tag_name}; |
788 |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
789 |
} elsif ($self->{current_token}->{type} eq 'end tag') { |
} elsif ($self->{current_token}->{type} eq 'end tag') { |
790 |
$self->{content_model_flag} = 'PCDATA'; # MUST |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
791 |
if ($self->{current_token}->{attributes}) { |
if ($self->{current_token}->{attributes}) { |
792 |
!!!parse-error (type => 'end tag attribute'); |
!!!parse-error (type => 'end tag attribute'); |
793 |
} |
} |
823 |
= not defined $self->{last_emitted_start_tag_name}; |
= not defined $self->{last_emitted_start_tag_name}; |
824 |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
825 |
} elsif ($self->{current_token}->{type} eq 'end tag') { |
} elsif ($self->{current_token}->{type} eq 'end tag') { |
826 |
$self->{content_model_flag} = 'PCDATA'; # MUST |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
827 |
if ($self->{current_token}->{attributes}) { |
if ($self->{current_token}->{attributes}) { |
828 |
!!!parse-error (type => 'end tag attribute'); |
!!!parse-error (type => 'end tag attribute'); |
829 |
} |
} |
859 |
= not defined $self->{last_emitted_start_tag_name}; |
= not defined $self->{last_emitted_start_tag_name}; |
860 |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
861 |
} elsif ($self->{current_token}->{type} eq 'end tag') { |
} elsif ($self->{current_token}->{type} eq 'end tag') { |
862 |
$self->{content_model_flag} = 'PCDATA'; # MUST |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
863 |
if ($self->{current_token}->{attributes}) { |
if ($self->{current_token}->{attributes}) { |
864 |
!!!parse-error (type => 'end tag attribute'); |
!!!parse-error (type => 'end tag attribute'); |
865 |
} |
} |
898 |
= not defined $self->{last_emitted_start_tag_name}; |
= not defined $self->{last_emitted_start_tag_name}; |
899 |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
900 |
} elsif ($self->{current_token}->{type} eq 'end tag') { |
} elsif ($self->{current_token}->{type} eq 'end tag') { |
901 |
$self->{content_model_flag} = 'PCDATA'; # MUST |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
902 |
if ($self->{current_token}->{attributes}) { |
if ($self->{current_token}->{attributes}) { |
903 |
!!!parse-error (type => 'end tag attribute'); |
!!!parse-error (type => 'end tag attribute'); |
904 |
} |
} |
918 |
= not defined $self->{last_emitted_start_tag_name}; |
= not defined $self->{last_emitted_start_tag_name}; |
919 |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
920 |
} elsif ($self->{current_token}->{type} eq 'end tag') { |
} elsif ($self->{current_token}->{type} eq 'end tag') { |
921 |
$self->{content_model_flag} = 'PCDATA'; # MUST |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
922 |
if ($self->{current_token}->{attributes}) { |
if ($self->{current_token}->{attributes}) { |
923 |
!!!parse-error (type => 'end tag attribute'); |
!!!parse-error (type => 'end tag attribute'); |
924 |
} |
} |
2199 |
$insert->($el); # /context node/->append_child ($el) |
$insert->($el); # /context node/->append_child ($el) |
2200 |
|
|
2201 |
## Step 3 |
## Step 3 |
2202 |
$self->{content_model_flag} = $content_model_flag; # CDATA or RCDATA |
$self->{content_model} = $content_model_flag; # CDATA or RCDATA |
2203 |
delete $self->{escape}; # MUST |
delete $self->{escape}; # MUST |
2204 |
|
|
2205 |
## Step 4 |
## Step 4 |
2217 |
} |
} |
2218 |
|
|
2219 |
## Step 6 |
## Step 6 |
2220 |
$self->{content_model_flag} = 'PCDATA'; |
$self->{content_model} = PCDATA_CONTENT_MODEL; |
2221 |
|
|
2222 |
## Step 7 |
## Step 7 |
2223 |
if ($token->{type} eq 'end tag' and $token->{tag_name} eq $start_tag_name) { |
if ($token->{type} eq 'end tag' and $token->{tag_name} eq $start_tag_name) { |
2224 |
## Ignore the token |
## Ignore the token |
2225 |
|
} elsif ($content_model_flag == CDATA_CONTENT_MODEL) { |
2226 |
|
!!!parse-error (type => 'in CDATA:#'.$token->{type}); |
2227 |
|
} elsif ($content_model_flag == RCDATA_CONTENT_MODEL) { |
2228 |
|
!!!parse-error (type => 'in RCDATA:#'.$token->{type}); |
2229 |
} else { |
} else { |
2230 |
!!!parse-error (type => 'in '.$content_model_flag.':#'.$token->{type}); |
die "$0: $content_model_flag in parse_rcdata"; |
2231 |
} |
} |
2232 |
!!!next-token; |
!!!next-token; |
2233 |
}; # $parse_rcdata |
}; # $parse_rcdata |
2238 |
!!!create-element ($script_el, 'script', $token->{attributes}); |
!!!create-element ($script_el, 'script', $token->{attributes}); |
2239 |
## TODO: mark as "parser-inserted" |
## TODO: mark as "parser-inserted" |
2240 |
|
|
2241 |
$self->{content_model_flag} = 'CDATA'; |
$self->{content_model} = CDATA_CONTENT_MODEL; |
2242 |
delete $self->{escape}; # MUST |
delete $self->{escape}; # MUST |
2243 |
|
|
2244 |
my $text = ''; |
my $text = ''; |
2251 |
$script_el->manakai_append_text ($text); |
$script_el->manakai_append_text ($text); |
2252 |
} |
} |
2253 |
|
|
2254 |
$self->{content_model_flag} = 'PCDATA'; |
$self->{content_model} = PCDATA_CONTENT_MODEL; |
2255 |
|
|
2256 |
if ($token->{type} eq 'end tag' and |
if ($token->{type} eq 'end tag' and |
2257 |
$token->{tag_name} eq 'script') { |
$token->{tag_name} eq 'script') { |
2505 |
return; |
return; |
2506 |
} elsif ($token->{tag_name} eq 'style') { |
} elsif ($token->{tag_name} eq 'style') { |
2507 |
## NOTE: This is an "as if in head" code clone |
## NOTE: This is an "as if in head" code clone |
2508 |
$parse_rcdata->('CDATA', $insert); |
$parse_rcdata->(CDATA_CONTENT_MODEL, $insert); |
2509 |
return; |
return; |
2510 |
} elsif ({ |
} elsif ({ |
2511 |
base => 1, link => 1, |
base => 1, link => 1, |
2542 |
} elsif ($token->{tag_name} eq 'title') { |
} elsif ($token->{tag_name} eq 'title') { |
2543 |
!!!parse-error (type => 'in body:title'); |
!!!parse-error (type => 'in body:title'); |
2544 |
## NOTE: This is an "as if in head" code clone |
## NOTE: This is an "as if in head" code clone |
2545 |
$parse_rcdata->('RCDATA', sub { |
$parse_rcdata->(RCDATA_CONTENT_MODEL, sub { |
2546 |
if (defined $self->{head_element}) { |
if (defined $self->{head_element}) { |
2547 |
$self->{head_element}->append_child ($_[0]); |
$self->{head_element}->append_child ($_[0]); |
2548 |
} else { |
} else { |
2738 |
|
|
2739 |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
2740 |
|
|
2741 |
$self->{content_model_flag} = 'PLAINTEXT'; |
$self->{content_model} = PLAINTEXT_CONTENT_MODEL; |
2742 |
|
|
2743 |
!!!next-token; |
!!!next-token; |
2744 |
return; |
return; |
2893 |
return; |
return; |
2894 |
} elsif ($token->{tag_name} eq 'xmp') { |
} elsif ($token->{tag_name} eq 'xmp') { |
2895 |
$reconstruct_active_formatting_elements->($insert_to_current); |
$reconstruct_active_formatting_elements->($insert_to_current); |
2896 |
$parse_rcdata->('CDATA', $insert); |
$parse_rcdata->(CDATA_CONTENT_MODEL, $insert); |
2897 |
return; |
return; |
2898 |
} elsif ($token->{tag_name} eq 'table') { |
} elsif ($token->{tag_name} eq 'table') { |
2899 |
## has a p element in scope |
## has a p element in scope |
3009 |
!!!create-element ($el, $token->{tag_name}, $token->{attributes}); |
!!!create-element ($el, $token->{tag_name}, $token->{attributes}); |
3010 |
|
|
3011 |
## TODO: $self->{form_element} if defined |
## TODO: $self->{form_element} if defined |
3012 |
$self->{content_model_flag} = 'RCDATA'; |
$self->{content_model} = RCDATA_CONTENT_MODEL; |
3013 |
delete $self->{escape}; # MUST |
delete $self->{escape}; # MUST |
3014 |
|
|
3015 |
$insert->($el); |
$insert->($el); |
3030 |
$el->manakai_append_text ($text); |
$el->manakai_append_text ($text); |
3031 |
} |
} |
3032 |
|
|
3033 |
$self->{content_model_flag} = 'PCDATA'; |
$self->{content_model} = PCDATA_CONTENT_MODEL; |
3034 |
|
|
3035 |
if ($token->{type} eq 'end tag' and |
if ($token->{type} eq 'end tag' and |
3036 |
$token->{tag_name} eq $tag_name) { |
$token->{tag_name} eq $tag_name) { |
3046 |
noframes => 1, |
noframes => 1, |
3047 |
noscript => 0, ## TODO: 1 if scripting is enabled |
noscript => 0, ## TODO: 1 if scripting is enabled |
3048 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
3049 |
$parse_rcdata->('CDATA', $insert); |
$parse_rcdata->(CDATA_CONTENT_MODEL, $insert); |
3050 |
return; |
return; |
3051 |
} elsif ($token->{tag_name} eq 'select') { |
} elsif ($token->{tag_name} eq 'select') { |
3052 |
$reconstruct_active_formatting_elements->($insert_to_current); |
$reconstruct_active_formatting_elements->($insert_to_current); |
3530 |
} |
} |
3531 |
my $parent = defined $self->{head_element} ? $self->{head_element} |
my $parent = defined $self->{head_element} ? $self->{head_element} |
3532 |
: $self->{open_elements}->[-1]->[0]; |
: $self->{open_elements}->[-1]->[0]; |
3533 |
$parse_rcdata->('RCDATA', sub { $parent->append_child ($_[0]) }); |
$parse_rcdata->(RCDATA_CONTENT_MODEL, |
3534 |
|
sub { $parent->append_child ($_[0]) }); |
3535 |
pop @{$self->{open_elements}} |
pop @{$self->{open_elements}} |
3536 |
if $self->{insertion_mode} eq 'after head'; |
if $self->{insertion_mode} eq 'after head'; |
3537 |
redo B; |
redo B; |
3543 |
!!!parse-error (type => 'after head:'.$token->{tag_name}); |
!!!parse-error (type => 'after head:'.$token->{tag_name}); |
3544 |
push @{$self->{open_elements}}, [$self->{head_element}, 'head']; |
push @{$self->{open_elements}}, [$self->{head_element}, 'head']; |
3545 |
} |
} |
3546 |
$parse_rcdata->('CDATA', $insert_to_current); |
$parse_rcdata->(CDATA_CONTENT_MODEL, $insert_to_current); |
3547 |
pop @{$self->{open_elements}} |
pop @{$self->{open_elements}} |
3548 |
if $self->{insertion_mode} eq 'after head'; |
if $self->{insertion_mode} eq 'after head'; |
3549 |
redo B; |
redo B; |
5292 |
|
|
5293 |
## Step 2 |
## Step 2 |
5294 |
my $node_ln = $node->local_name; |
my $node_ln = $node->local_name; |
5295 |
$p->{content_model_flag} = { |
$p->{content_model} = { |
5296 |
title => 'RCDATA', |
title => RCDATA_CONTENT_MODEL, |
5297 |
textarea => 'RCDATA', |
textarea => RCDATA_CONTENT_MODEL, |
5298 |
style => 'CDATA', |
style => CDATA_CONTENT_MODEL, |
5299 |
script => 'CDATA', |
script => CDATA_CONTENT_MODEL, |
5300 |
xmp => 'CDATA', |
xmp => CDATA_CONTENT_MODEL, |
5301 |
iframe => 'CDATA', |
iframe => CDATA_CONTENT_MODEL, |
5302 |
noembed => 'CDATA', |
noembed => CDATA_CONTENT_MODEL, |
5303 |
noframes => 'CDATA', |
noframes => CDATA_CONTENT_MODEL, |
5304 |
noscript => 'CDATA', |
noscript => CDATA_CONTENT_MODEL, |
5305 |
plaintext => 'PLAINTEXT', |
plaintext => PLAINTEXT_CONTENT_MODEL, |
5306 |
}->{$node_ln} || 'PCDATA'; |
}->{$node_ln}; |
5307 |
## ISSUE: What is "the name of the element"? local name? |
$p->{content_model} = PCDATA_CONTENT_MODEL |
5308 |
|
unless defined $p->{content_model}; |
5309 |
|
## ISSUE: What is "the name of the element"? local name? |
5310 |
|
|
5311 |
$p->{inner_html_node} = [$node, $node_ln]; |
$p->{inner_html_node} = [$node, $node_ln]; |
5312 |
|
|