2903 |
!!!cp ('t39'); |
!!!cp ('t39'); |
2904 |
}; # $clear_up_to_marker |
}; # $clear_up_to_marker |
2905 |
|
|
2906 |
my $parse_rcdata = sub ($$) { |
my $insert; |
2907 |
my ($content_model_flag, $insert) = @_; |
|
2908 |
|
my $parse_rcdata = sub ($) { |
2909 |
|
my ($content_model_flag) = @_; |
2910 |
|
|
2911 |
## Step 1 |
## Step 1 |
2912 |
my $start_tag_name = $token->{tag_name}; |
my $start_tag_name = $token->{tag_name}; |
2914 |
!!!create-element ($el, $start_tag_name, $token->{attributes}); |
!!!create-element ($el, $start_tag_name, $token->{attributes}); |
2915 |
|
|
2916 |
## Step 2 |
## Step 2 |
2917 |
$insert->($el); # /context node/->append_child ($el) |
$insert->($el); |
2918 |
|
|
2919 |
## Step 3 |
## Step 3 |
2920 |
$self->{content_model} = $content_model_flag; # CDATA or RCDATA |
$self->{content_model} = $content_model_flag; # CDATA or RCDATA |
2944 |
$token->{tag_name} eq $start_tag_name) { |
$token->{tag_name} eq $start_tag_name) { |
2945 |
!!!cp ('t42'); |
!!!cp ('t42'); |
2946 |
## Ignore the token |
## Ignore the token |
|
} elsif ($content_model_flag == CDATA_CONTENT_MODEL) { |
|
|
!!!cp ('t43'); |
|
|
!!!parse-error (type => 'in CDATA:#'.$token->{type}); |
|
|
} elsif ($content_model_flag == RCDATA_CONTENT_MODEL) { |
|
|
!!!cp ('t44'); |
|
|
!!!parse-error (type => 'in RCDATA:#'.$token->{type}); |
|
2947 |
} else { |
} else { |
2948 |
die "$0: $content_model_flag in parse_rcdata"; |
## NOTE: An end-of-file token. |
2949 |
|
if ($content_model_flag == CDATA_CONTENT_MODEL) { |
2950 |
|
!!!cp ('t43'); |
2951 |
|
!!!parse-error (type => 'in CDATA:#'.$token->{type}); |
2952 |
|
} elsif ($content_model_flag == RCDATA_CONTENT_MODEL) { |
2953 |
|
!!!cp ('t44'); |
2954 |
|
!!!parse-error (type => 'in RCDATA:#'.$token->{type}); |
2955 |
|
} else { |
2956 |
|
die "$0: $content_model_flag in parse_rcdata"; |
2957 |
|
} |
2958 |
} |
} |
2959 |
!!!next-token; |
!!!next-token; |
2960 |
}; # $parse_rcdata |
}; # $parse_rcdata |
2961 |
|
|
2962 |
my $script_start_tag = sub ($) { |
my $script_start_tag = sub () { |
|
my $insert = $_[0]; |
|
2963 |
my $script_el; |
my $script_el; |
2964 |
!!!create-element ($script_el, 'script', $token->{attributes}); |
!!!create-element ($script_el, 'script', $token->{attributes}); |
2965 |
## TODO: mark as "parser-inserted" |
## TODO: mark as "parser-inserted" |
3216 |
## NOTE: $open_tables->[-1]->[1] is the "tainted" flag. |
## NOTE: $open_tables->[-1]->[1] is the "tainted" flag. |
3217 |
my $open_tables = [[$self->{open_elements}->[0]->[0]]]; |
my $open_tables = [[$self->{open_elements}->[0]->[0]]]; |
3218 |
|
|
3219 |
my $insert_to_current = sub { |
$insert = my $insert_to_current = sub { |
3220 |
$self->{open_elements}->[-1]->[0]->append_child ($_[0]); |
$self->{open_elements}->[-1]->[0]->append_child ($_[0]); |
3221 |
}; # $insert_to_current |
}; # $insert_to_current |
3222 |
|
|
3254 |
} |
} |
3255 |
}; # $insert_to_foster |
}; # $insert_to_foster |
3256 |
|
|
|
my $insert; |
|
|
|
|
3257 |
B: { |
B: { |
3258 |
if ($token->{type} == DOCTYPE_TOKEN) { |
if ($token->{type} == DOCTYPE_TOKEN) { |
3259 |
!!!cp ('t73'); |
!!!cp ('t73'); |
3539 |
## NOTE: There is a "as if in head" code clone. |
## NOTE: There is a "as if in head" code clone. |
3540 |
my $parent = defined $self->{head_element} ? $self->{head_element} |
my $parent = defined $self->{head_element} ? $self->{head_element} |
3541 |
: $self->{open_elements}->[-1]->[0]; |
: $self->{open_elements}->[-1]->[0]; |
3542 |
$parse_rcdata->(RCDATA_CONTENT_MODEL, |
$parse_rcdata->(RCDATA_CONTENT_MODEL); |
|
sub { $parent->append_child ($_[0]) }); |
|
3543 |
pop @{$self->{open_elements}} |
pop @{$self->{open_elements}} |
3544 |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
3545 |
redo B; |
redo B; |
3554 |
} else { |
} else { |
3555 |
!!!cp ('t115'); |
!!!cp ('t115'); |
3556 |
} |
} |
3557 |
$parse_rcdata->(CDATA_CONTENT_MODEL, $insert_to_current); |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
3558 |
pop @{$self->{open_elements}} |
pop @{$self->{open_elements}} |
3559 |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
if $self->{insertion_mode} == AFTER_HEAD_IM; |
3560 |
redo B; |
redo B; |
5205 |
} elsif ($token->{tag_name} eq 'noframes') { |
} elsif ($token->{tag_name} eq 'noframes') { |
5206 |
!!!cp ('t320'); |
!!!cp ('t320'); |
5207 |
## NOTE: As if in body. |
## NOTE: As if in body. |
5208 |
$parse_rcdata->(CDATA_CONTENT_MODEL, $insert_to_current); |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
5209 |
redo B; |
redo B; |
5210 |
} else { |
} else { |
5211 |
if ($self->{insertion_mode} == IN_FRAMESET_IM) { |
if ($self->{insertion_mode} == IN_FRAMESET_IM) { |
5289 |
} elsif ($token->{tag_name} eq 'style') { |
} elsif ($token->{tag_name} eq 'style') { |
5290 |
!!!cp ('t333'); |
!!!cp ('t333'); |
5291 |
## NOTE: This is an "as if in head" code clone |
## NOTE: This is an "as if in head" code clone |
5292 |
$parse_rcdata->(CDATA_CONTENT_MODEL, $insert); |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
5293 |
redo B; |
redo B; |
5294 |
} elsif ({ |
} elsif ({ |
5295 |
base => 1, link => 1, |
base => 1, link => 1, |
5352 |
redo B; |
redo B; |
5353 |
} elsif ($token->{tag_name} eq 'title') { |
} elsif ($token->{tag_name} eq 'title') { |
5354 |
!!!cp ('t341'); |
!!!cp ('t341'); |
|
!!!parse-error (type => 'in body:title'); |
|
5355 |
## NOTE: This is an "as if in head" code clone |
## NOTE: This is an "as if in head" code clone |
5356 |
$parse_rcdata->(RCDATA_CONTENT_MODEL, sub { |
$parse_rcdata->(RCDATA_CONTENT_MODEL); |
|
if (defined $self->{head_element}) { |
|
|
!!!cp ('t339'); |
|
|
$self->{head_element}->append_child ($_[0]); |
|
|
} else { |
|
|
!!!cp ('t340'); |
|
|
$insert->($_[0]); |
|
|
} |
|
|
}); |
|
5357 |
redo B; |
redo B; |
5358 |
} elsif ($token->{tag_name} eq 'body') { |
} elsif ($token->{tag_name} eq 'body') { |
5359 |
!!!parse-error (type => 'in body:body'); |
!!!parse-error (type => 'in body:body'); |
5701 |
} elsif ($token->{tag_name} eq 'xmp') { |
} elsif ($token->{tag_name} eq 'xmp') { |
5702 |
!!!cp ('t381'); |
!!!cp ('t381'); |
5703 |
$reconstruct_active_formatting_elements->($insert_to_current); |
$reconstruct_active_formatting_elements->($insert_to_current); |
5704 |
$parse_rcdata->(CDATA_CONTENT_MODEL, $insert); |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
5705 |
redo B; |
redo B; |
5706 |
} elsif ($token->{tag_name} eq 'table') { |
} elsif ($token->{tag_name} eq 'table') { |
5707 |
## has a p element in scope |
## has a p element in scope |
5877 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
5878 |
!!!cp ('t399'); |
!!!cp ('t399'); |
5879 |
## NOTE: There is an "as if in body" code clone. |
## NOTE: There is an "as if in body" code clone. |
5880 |
$parse_rcdata->(CDATA_CONTENT_MODEL, $insert); |
$parse_rcdata->(CDATA_CONTENT_MODEL); |
5881 |
redo B; |
redo B; |
5882 |
} elsif ($token->{tag_name} eq 'select') { |
} elsif ($token->{tag_name} eq 'select') { |
5883 |
!!!cp ('t400'); |
!!!cp ('t400'); |