2444 |
if (not defined $token->{name} or # <!DOCTYPE> |
if (not defined $token->{name} or # <!DOCTYPE> |
2445 |
defined $token->{public_identifier} or |
defined $token->{public_identifier} or |
2446 |
defined $token->{system_identifier}) { |
defined $token->{system_identifier}) { |
2447 |
|
!!!cp ('t1'); |
2448 |
!!!parse-error (type => 'not HTML5'); |
!!!parse-error (type => 'not HTML5'); |
2449 |
} elsif ($doctype_name ne 'HTML') { |
} elsif ($doctype_name ne 'HTML') { |
2450 |
|
!!!cp ('t2'); |
2451 |
## ISSUE: ASCII case-insensitive? (in fact it does not matter) |
## ISSUE: ASCII case-insensitive? (in fact it does not matter) |
2452 |
!!!parse-error (type => 'not HTML5'); |
!!!parse-error (type => 'not HTML5'); |
2453 |
|
} else { |
2454 |
|
!!!cp ('t3'); |
2455 |
} |
} |
2456 |
|
|
2457 |
my $doctype = $self->{document}->create_document_type_definition |
my $doctype = $self->{document}->create_document_type_definition |
2465 |
$self->{document}->append_child ($doctype); |
$self->{document}->append_child ($doctype); |
2466 |
|
|
2467 |
if ($token->{quirks} or $doctype_name ne 'HTML') { |
if ($token->{quirks} or $doctype_name ne 'HTML') { |
2468 |
|
!!!cp ('t4'); |
2469 |
$self->{document}->manakai_compat_mode ('quirks'); |
$self->{document}->manakai_compat_mode ('quirks'); |
2470 |
} elsif (defined $token->{public_identifier}) { |
} elsif (defined $token->{public_identifier}) { |
2471 |
my $pubid = $token->{public_identifier}; |
my $pubid = $token->{public_identifier}; |
2544 |
"-/W3C/DTD HTML 4.0 TRANSITIONAL/EN" => 1, |
"-/W3C/DTD HTML 4.0 TRANSITIONAL/EN" => 1, |
2545 |
"HTML" => 1, |
"HTML" => 1, |
2546 |
}->{$pubid}) { |
}->{$pubid}) { |
2547 |
|
!!!cp ('t5'); |
2548 |
$self->{document}->manakai_compat_mode ('quirks'); |
$self->{document}->manakai_compat_mode ('quirks'); |
2549 |
} elsif ($pubid eq "-//W3C//DTD HTML 4.01 FRAMESET//EN" or |
} elsif ($pubid eq "-//W3C//DTD HTML 4.01 FRAMESET//EN" or |
2550 |
$pubid eq "-//W3C//DTD HTML 4.01 TRANSITIONAL//EN") { |
$pubid eq "-//W3C//DTD HTML 4.01 TRANSITIONAL//EN") { |
2551 |
if (defined $token->{system_identifier}) { |
if (defined $token->{system_identifier}) { |
2552 |
|
!!!cp ('t6'); |
2553 |
$self->{document}->manakai_compat_mode ('quirks'); |
$self->{document}->manakai_compat_mode ('quirks'); |
2554 |
} else { |
} else { |
2555 |
|
!!!cp ('t7'); |
2556 |
$self->{document}->manakai_compat_mode ('limited quirks'); |
$self->{document}->manakai_compat_mode ('limited quirks'); |
2557 |
} |
} |
2558 |
} elsif ($pubid eq "-//W3C//DTD XHTML 1.0 Frameset//EN" or |
} elsif ($pubid eq "-//W3C//DTD XHTML 1.0 Frameset//EN" or |
2559 |
$pubid eq "-//W3C//DTD XHTML 1.0 Transitional//EN") { |
$pubid eq "-//W3C//DTD XHTML 1.0 Transitional//EN") { |
2560 |
|
!!!cp ('t8'); |
2561 |
$self->{document}->manakai_compat_mode ('limited quirks'); |
$self->{document}->manakai_compat_mode ('limited quirks'); |
2562 |
|
} else { |
2563 |
|
!!!cp ('t9'); |
2564 |
} |
} |
2565 |
|
} else { |
2566 |
|
!!!cp ('t10'); |
2567 |
} |
} |
2568 |
if (defined $token->{system_identifier}) { |
if (defined $token->{system_identifier}) { |
2569 |
my $sysid = $token->{system_identifier}; |
my $sysid = $token->{system_identifier}; |
2570 |
$sysid =~ tr/A-Z/a-z/; |
$sysid =~ tr/A-Z/a-z/; |
2571 |
if ($sysid eq "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd") { |
if ($sysid eq "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd") { |
2572 |
$self->{document}->manakai_compat_mode ('quirks'); |
$self->{document}->manakai_compat_mode ('quirks'); |
2573 |
|
!!!cp ('t11'); |
2574 |
|
} else { |
2575 |
|
!!!cp ('t12'); |
2576 |
} |
} |
2577 |
|
} else { |
2578 |
|
!!!cp ('t13'); |
2579 |
} |
} |
2580 |
|
|
2581 |
## Go to the root element phase. |
## Go to the root element phase. |
2586 |
END_TAG_TOKEN, 1, |
END_TAG_TOKEN, 1, |
2587 |
END_OF_FILE_TOKEN, 1, |
END_OF_FILE_TOKEN, 1, |
2588 |
}->{$token->{type}}) { |
}->{$token->{type}}) { |
2589 |
|
!!!cp ('t14'); |
2590 |
!!!parse-error (type => 'no DOCTYPE'); |
!!!parse-error (type => 'no DOCTYPE'); |
2591 |
$self->{document}->manakai_compat_mode ('quirks'); |
$self->{document}->manakai_compat_mode ('quirks'); |
2592 |
## Go to the root element phase |
## Go to the root element phase |
2597 |
## Ignore the token |
## Ignore the token |
2598 |
|
|
2599 |
unless (length $token->{data}) { |
unless (length $token->{data}) { |
2600 |
|
!!!cp ('t15'); |
2601 |
## Stay in the phase |
## Stay in the phase |
2602 |
!!!next-token; |
!!!next-token; |
2603 |
redo INITIAL; |
redo INITIAL; |
2604 |
|
} else { |
2605 |
|
!!!cp ('t16'); |
2606 |
} |
} |
2607 |
|
} else { |
2608 |
|
!!!cp ('t17'); |
2609 |
} |
} |
2610 |
|
|
2611 |
!!!parse-error (type => 'no DOCTYPE'); |
!!!parse-error (type => 'no DOCTYPE'); |
2614 |
## reprocess |
## reprocess |
2615 |
return; |
return; |
2616 |
} elsif ($token->{type} == COMMENT_TOKEN) { |
} elsif ($token->{type} == COMMENT_TOKEN) { |
2617 |
|
!!!cp ('t18'); |
2618 |
my $comment = $self->{document}->create_comment ($token->{data}); |
my $comment = $self->{document}->create_comment ($token->{data}); |
2619 |
$self->{document}->append_child ($comment); |
$self->{document}->append_child ($comment); |
2620 |
|
|
2625 |
die "$0: $token->{type}: Unknown token type"; |
die "$0: $token->{type}: Unknown token type"; |
2626 |
} |
} |
2627 |
} # INITIAL |
} # INITIAL |
2628 |
|
|
2629 |
|
die "$0: _tree_construction_initial: This should be never reached"; |
2630 |
} # _tree_construction_initial |
} # _tree_construction_initial |
2631 |
|
|
2632 |
sub _tree_construction_root_element ($) { |
sub _tree_construction_root_element ($) { |
2634 |
|
|
2635 |
B: { |
B: { |
2636 |
if ($token->{type} == DOCTYPE_TOKEN) { |
if ($token->{type} == DOCTYPE_TOKEN) { |
2637 |
|
!!!cp ('t19'); |
2638 |
!!!parse-error (type => 'in html:#DOCTYPE'); |
!!!parse-error (type => 'in html:#DOCTYPE'); |
2639 |
## Ignore the token |
## Ignore the token |
2640 |
## Stay in the phase |
## Stay in the phase |
2641 |
!!!next-token; |
!!!next-token; |
2642 |
redo B; |
redo B; |
2643 |
} elsif ($token->{type} == COMMENT_TOKEN) { |
} elsif ($token->{type} == COMMENT_TOKEN) { |
2644 |
|
!!!cp ('t20'); |
2645 |
my $comment = $self->{document}->create_comment ($token->{data}); |
my $comment = $self->{document}->create_comment ($token->{data}); |
2646 |
$self->{document}->append_child ($comment); |
$self->{document}->append_child ($comment); |
2647 |
## Stay in the phase |
## Stay in the phase |
2652 |
## Ignore the token. |
## Ignore the token. |
2653 |
|
|
2654 |
unless (length $token->{data}) { |
unless (length $token->{data}) { |
2655 |
|
!!!cp ('t21'); |
2656 |
## Stay in the phase |
## Stay in the phase |
2657 |
!!!next-token; |
!!!next-token; |
2658 |
redo B; |
redo B; |
2659 |
|
} else { |
2660 |
|
!!!cp ('t22'); |
2661 |
} |
} |
2662 |
|
} else { |
2663 |
|
!!!cp ('t23'); |
2664 |
} |
} |
2665 |
|
|
2666 |
$self->{application_cache_selection}->(undef); |
$self->{application_cache_selection}->(undef); |
2669 |
} elsif ($token->{type} == START_TAG_TOKEN) { |
} elsif ($token->{type} == START_TAG_TOKEN) { |
2670 |
if ($token->{tag_name} eq 'html' and |
if ($token->{tag_name} eq 'html' and |
2671 |
$token->{attributes}->{manifest}) { |
$token->{attributes}->{manifest}) { |
2672 |
|
!!!cp ('t24'); |
2673 |
$self->{application_cache_selection} |
$self->{application_cache_selection} |
2674 |
->($token->{attributes}->{manifest}->{value}); |
->($token->{attributes}->{manifest}->{value}); |
2675 |
## ISSUE: No relative reference resolution? |
## ISSUE: No relative reference resolution? |
2676 |
} else { |
} else { |
2677 |
|
!!!cp ('t25'); |
2678 |
$self->{application_cache_selection}->(undef); |
$self->{application_cache_selection}->(undef); |
2679 |
} |
} |
2680 |
|
|
2684 |
END_TAG_TOKEN, 1, |
END_TAG_TOKEN, 1, |
2685 |
END_OF_FILE_TOKEN, 1, |
END_OF_FILE_TOKEN, 1, |
2686 |
}->{$token->{type}}) { |
}->{$token->{type}}) { |
2687 |
|
!!!cp ('t26'); |
2688 |
$self->{application_cache_selection}->(undef); |
$self->{application_cache_selection}->(undef); |
2689 |
|
|
2690 |
## ISSUE: There is an issue in the spec |
## ISSUE: There is an issue in the spec |
2700 |
#redo B; |
#redo B; |
2701 |
return; ## Go to the main phase. |
return; ## Go to the main phase. |
2702 |
} # B |
} # B |
2703 |
|
|
2704 |
|
die "$0: _tree_construction_root_element: This should never be reached"; |
2705 |
} # _tree_construction_root_element |
} # _tree_construction_root_element |
2706 |
|
|
2707 |
sub _reset_insertion_mode ($) { |
sub _reset_insertion_mode ($) { |
2726 |
if (defined $self->{inner_html_node}) { |
if (defined $self->{inner_html_node}) { |
2727 |
if ($self->{inner_html_node}->[1] eq 'td' or |
if ($self->{inner_html_node}->[1] eq 'td' or |
2728 |
$self->{inner_html_node}->[1] eq 'th') { |
$self->{inner_html_node}->[1] eq 'th') { |
2729 |
|
!!!cp ('t27'); |
2730 |
# |
# |
2731 |
} else { |
} else { |
2732 |
|
!!!cp ('t28'); |
2733 |
$node = $self->{inner_html_node}; |
$node = $self->{inner_html_node}; |
2734 |
} |
} |
2735 |
} |
} |
2756 |
## Step 14 |
## Step 14 |
2757 |
if ($node->[1] eq 'html') { |
if ($node->[1] eq 'html') { |
2758 |
unless (defined $self->{head_element}) { |
unless (defined $self->{head_element}) { |
2759 |
|
!!!cp ('t29'); |
2760 |
$self->{insertion_mode} = BEFORE_HEAD_IM; |
$self->{insertion_mode} = BEFORE_HEAD_IM; |
2761 |
} else { |
} else { |
2762 |
|
!!!cp ('t30'); |
2763 |
$self->{insertion_mode} = AFTER_HEAD_IM; |
$self->{insertion_mode} = AFTER_HEAD_IM; |
2764 |
} |
} |
2765 |
return; |
return; |
2766 |
|
} else { |
2767 |
|
!!!cp ('t31'); |
2768 |
} |
} |
2769 |
|
|
2770 |
## Step 15 |
## Step 15 |
2777 |
## Step 17 |
## Step 17 |
2778 |
redo S3; |
redo S3; |
2779 |
} # S3 |
} # S3 |
2780 |
|
|
2781 |
|
die "$0: _reset_insertion_mode: This line should never be reached"; |
2782 |
} # _reset_insertion_mode |
} # _reset_insertion_mode |
2783 |
|
|
2784 |
sub _tree_construction_main ($) { |
sub _tree_construction_main ($) { |
2800 |
return if $entry->[0] eq '#marker'; |
return if $entry->[0] eq '#marker'; |
2801 |
for (@{$self->{open_elements}}) { |
for (@{$self->{open_elements}}) { |
2802 |
if ($entry->[0] eq $_->[0]) { |
if ($entry->[0] eq $_->[0]) { |
2803 |
|
!!!cp ('t32'); |
2804 |
return; |
return; |
2805 |
} |
} |
2806 |
} |
} |
2815 |
|
|
2816 |
## Step 6 |
## Step 6 |
2817 |
if ($entry->[0] eq '#marker') { |
if ($entry->[0] eq '#marker') { |
2818 |
|
!!!cp ('t33'); |
2819 |
# |
# |
2820 |
} else { |
} else { |
2821 |
my $in_open_elements; |
my $in_open_elements; |
2822 |
OE: for (@{$self->{open_elements}}) { |
OE: for (@{$self->{open_elements}}) { |
2823 |
if ($entry->[0] eq $_->[0]) { |
if ($entry->[0] eq $_->[0]) { |
2824 |
|
!!!cp ('t33'); |
2825 |
$in_open_elements = 1; |
$in_open_elements = 1; |
2826 |
last OE; |
last OE; |
2827 |
} |
} |
2828 |
} |
} |
2829 |
if ($in_open_elements) { |
if ($in_open_elements) { |
2830 |
|
!!!cp ('t34'); |
2831 |
# |
# |
2832 |
} else { |
} else { |
2833 |
|
!!!cp ('t35'); |
2834 |
redo S4; |
redo S4; |
2835 |
} |
} |
2836 |
} |
} |
2853 |
|
|
2854 |
## Step 11 |
## Step 11 |
2855 |
unless ($clone->[0] eq $active_formatting_elements->[-1]->[0]) { |
unless ($clone->[0] eq $active_formatting_elements->[-1]->[0]) { |
2856 |
|
!!!cp ('t36'); |
2857 |
## Step 7' |
## Step 7' |
2858 |
$i++; |
$i++; |
2859 |
$entry = $active_formatting_elements->[$i]; |
$entry = $active_formatting_elements->[$i]; |
2860 |
|
|
2861 |
redo S7; |
redo S7; |
2862 |
} |
} |
2863 |
|
|
2864 |
|
!!!cp ('t37'); |
2865 |
} # S7 |
} # S7 |
2866 |
}; # $reconstruct_active_formatting_elements |
}; # $reconstruct_active_formatting_elements |
2867 |
|
|
2868 |
my $clear_up_to_marker = sub { |
my $clear_up_to_marker = sub { |
2869 |
for (reverse 0..$#$active_formatting_elements) { |
for (reverse 0..$#$active_formatting_elements) { |
2870 |
if ($active_formatting_elements->[$_]->[0] eq '#marker') { |
if ($active_formatting_elements->[$_]->[0] eq '#marker') { |
2871 |
|
!!!cp ('t38'); |
2872 |
splice @$active_formatting_elements, $_; |
splice @$active_formatting_elements, $_; |
2873 |
return; |
return; |
2874 |
} |
} |
2875 |
} |
} |
2876 |
|
|
2877 |
|
!!!cp ('t39'); |
2878 |
}; # $clear_up_to_marker |
}; # $clear_up_to_marker |
2879 |
|
|
2880 |
my $parse_rcdata = sub ($$) { |
my $parse_rcdata = sub ($$) { |
2896 |
my $text = ''; |
my $text = ''; |
2897 |
!!!next-token; |
!!!next-token; |
2898 |
while ($token->{type} == CHARACTER_TOKEN) { # or until stop tokenizing |
while ($token->{type} == CHARACTER_TOKEN) { # or until stop tokenizing |
2899 |
|
!!!cp ('t40'); |
2900 |
$text .= $token->{data}; |
$text .= $token->{data}; |
2901 |
!!!next-token; |
!!!next-token; |
2902 |
} |
} |
2903 |
|
|
2904 |
## Step 5 |
## Step 5 |
2905 |
if (length $text) { |
if (length $text) { |
2906 |
|
!!!cp ('t41'); |
2907 |
my $text = $self->{document}->create_text_node ($text); |
my $text = $self->{document}->create_text_node ($text); |
2908 |
$el->append_child ($text); |
$el->append_child ($text); |
2909 |
} |
} |
2912 |
$self->{content_model} = PCDATA_CONTENT_MODEL; |
$self->{content_model} = PCDATA_CONTENT_MODEL; |
2913 |
|
|
2914 |
## Step 7 |
## Step 7 |
2915 |
if ($token->{type} == END_TAG_TOKEN and $token->{tag_name} eq $start_tag_name) { |
if ($token->{type} == END_TAG_TOKEN and |
2916 |
|
$token->{tag_name} eq $start_tag_name) { |
2917 |
|
!!!cp ('t42'); |
2918 |
## Ignore the token |
## Ignore the token |
2919 |
} elsif ($content_model_flag == CDATA_CONTENT_MODEL) { |
} elsif ($content_model_flag == CDATA_CONTENT_MODEL) { |
2920 |
|
!!!cp ('t43'); |
2921 |
!!!parse-error (type => 'in CDATA:#'.$token->{type}); |
!!!parse-error (type => 'in CDATA:#'.$token->{type}); |
2922 |
} elsif ($content_model_flag == RCDATA_CONTENT_MODEL) { |
} elsif ($content_model_flag == RCDATA_CONTENT_MODEL) { |
2923 |
|
!!!cp ('t44'); |
2924 |
!!!parse-error (type => 'in RCDATA:#'.$token->{type}); |
!!!parse-error (type => 'in RCDATA:#'.$token->{type}); |
2925 |
} else { |
} else { |
2926 |
die "$0: $content_model_flag in parse_rcdata"; |
die "$0: $content_model_flag in parse_rcdata"; |
2940 |
my $text = ''; |
my $text = ''; |
2941 |
!!!next-token; |
!!!next-token; |
2942 |
while ($token->{type} == CHARACTER_TOKEN) { |
while ($token->{type} == CHARACTER_TOKEN) { |
2943 |
|
!!!cp ('t45'); |
2944 |
$text .= $token->{data}; |
$text .= $token->{data}; |
2945 |
!!!next-token; |
!!!next-token; |
2946 |
} # stop if non-character token or tokenizer stops tokenising |
} # stop if non-character token or tokenizer stops tokenising |
2947 |
if (length $text) { |
if (length $text) { |
2948 |
|
!!!cp ('t46'); |
2949 |
$script_el->manakai_append_text ($text); |
$script_el->manakai_append_text ($text); |
2950 |
} |
} |
2951 |
|
|
2953 |
|
|
2954 |
if ($token->{type} == END_TAG_TOKEN and |
if ($token->{type} == END_TAG_TOKEN and |
2955 |
$token->{tag_name} eq 'script') { |
$token->{tag_name} eq 'script') { |
2956 |
|
!!!cp ('t47'); |
2957 |
## Ignore the token |
## Ignore the token |
2958 |
} else { |
} else { |
2959 |
|
!!!cp ('t48'); |
2960 |
!!!parse-error (type => 'in CDATA:#'.$token->{type}); |
!!!parse-error (type => 'in CDATA:#'.$token->{type}); |
2961 |
## ISSUE: And ignore? |
## ISSUE: And ignore? |
2962 |
## TODO: mark as "already executed" |
## TODO: mark as "already executed" |
2963 |
} |
} |
2964 |
|
|
2965 |
if (defined $self->{inner_html_node}) { |
if (defined $self->{inner_html_node}) { |
2966 |
|
!!!cp ('t49'); |
2967 |
## TODO: mark as "already executed" |
## TODO: mark as "already executed" |
2968 |
} else { |
} else { |
2969 |
|
!!!cp ('t50'); |
2970 |
## TODO: $old_insertion_point = current insertion point |
## TODO: $old_insertion_point = current insertion point |
2971 |
## TODO: insertion point = just before the next input character |
## TODO: insertion point = just before the next input character |
2972 |
|
|
2989 |
my $formatting_element_i_in_active; |
my $formatting_element_i_in_active; |
2990 |
AFE: for (reverse 0..$#$active_formatting_elements) { |
AFE: for (reverse 0..$#$active_formatting_elements) { |
2991 |
if ($active_formatting_elements->[$_]->[1] eq $tag_name) { |
if ($active_formatting_elements->[$_]->[1] eq $tag_name) { |
2992 |
|
!!!cp ('t51'); |
2993 |
$formatting_element = $active_formatting_elements->[$_]; |
$formatting_element = $active_formatting_elements->[$_]; |
2994 |
$formatting_element_i_in_active = $_; |
$formatting_element_i_in_active = $_; |
2995 |
last AFE; |
last AFE; |
2996 |
} elsif ($active_formatting_elements->[$_]->[0] eq '#marker') { |
} elsif ($active_formatting_elements->[$_]->[0] eq '#marker') { |
2997 |
|
!!!cp ('t52'); |
2998 |
last AFE; |
last AFE; |
2999 |
} |
} |
3000 |
} # AFE |
} # AFE |
3001 |
unless (defined $formatting_element) { |
unless (defined $formatting_element) { |
3002 |
|
!!!cp ('t53'); |
3003 |
!!!parse-error (type => 'unmatched end tag:'.$tag_name); |
!!!parse-error (type => 'unmatched end tag:'.$tag_name); |
3004 |
## Ignore the token |
## Ignore the token |
3005 |
!!!next-token; |
!!!next-token; |
3012 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
3013 |
if ($node->[0] eq $formatting_element->[0]) { |
if ($node->[0] eq $formatting_element->[0]) { |
3014 |
if ($in_scope) { |
if ($in_scope) { |
3015 |
|
!!!cp ('t54'); |
3016 |
$formatting_element_i_in_open = $_; |
$formatting_element_i_in_open = $_; |
3017 |
last INSCOPE; |
last INSCOPE; |
3018 |
} else { # in open elements but not in scope |
} else { # in open elements but not in scope |
3019 |
|
!!!cp ('t55'); |
3020 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
3021 |
## Ignore the token |
## Ignore the token |
3022 |
!!!next-token; |
!!!next-token; |
3026 |
table => 1, caption => 1, td => 1, th => 1, |
table => 1, caption => 1, td => 1, th => 1, |
3027 |
button => 1, marquee => 1, object => 1, html => 1, |
button => 1, marquee => 1, object => 1, html => 1, |
3028 |
}->{$node->[1]}) { |
}->{$node->[1]}) { |
3029 |
|
!!!cp ('t56'); |
3030 |
$in_scope = 0; |
$in_scope = 0; |
3031 |
} |
} |
3032 |
} # INSCOPE |
} # INSCOPE |
3033 |
unless (defined $formatting_element_i_in_open) { |
unless (defined $formatting_element_i_in_open) { |
3034 |
|
!!!cp ('t57'); |
3035 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
3036 |
pop @$active_formatting_elements; # $formatting_element |
pop @$active_formatting_elements; # $formatting_element |
3037 |
!!!next-token; ## TODO: ok? |
!!!next-token; ## TODO: ok? |
3038 |
return; |
return; |
3039 |
} |
} |
3040 |
if (not $self->{open_elements}->[-1]->[0] eq $formatting_element->[0]) { |
if (not $self->{open_elements}->[-1]->[0] eq $formatting_element->[0]) { |
3041 |
|
!!!cp ('t58'); |
3042 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
3043 |
} |
} |
3044 |
|
|
3051 |
#not $phrasing_category->{$node->[1]} and |
#not $phrasing_category->{$node->[1]} and |
3052 |
($special_category->{$node->[1]} or |
($special_category->{$node->[1]} or |
3053 |
$scoping_category->{$node->[1]})) { |
$scoping_category->{$node->[1]})) { |
3054 |
|
!!!cp ('t59'); |
3055 |
$furthest_block = $node; |
$furthest_block = $node; |
3056 |
$furthest_block_i_in_open = $_; |
$furthest_block_i_in_open = $_; |
3057 |
} elsif ($node->[0] eq $formatting_element->[0]) { |
} elsif ($node->[0] eq $formatting_element->[0]) { |
3058 |
|
!!!cp ('t60'); |
3059 |
last OE; |
last OE; |
3060 |
} |
} |
3061 |
} # OE |
} # OE |
3062 |
|
|
3063 |
## Step 3 |
## Step 3 |
3064 |
unless (defined $furthest_block) { # MUST |
unless (defined $furthest_block) { # MUST |
3065 |
|
!!!cp ('t61'); |
3066 |
splice @{$self->{open_elements}}, $formatting_element_i_in_open; |
splice @{$self->{open_elements}}, $formatting_element_i_in_open; |
3067 |
splice @$active_formatting_elements, $formatting_element_i_in_active, 1; |
splice @$active_formatting_elements, $formatting_element_i_in_active, 1; |
3068 |
!!!next-token; |
!!!next-token; |
3075 |
## Step 5 |
## Step 5 |
3076 |
my $furthest_block_parent = $furthest_block->[0]->parent_node; |
my $furthest_block_parent = $furthest_block->[0]->parent_node; |
3077 |
if (defined $furthest_block_parent) { |
if (defined $furthest_block_parent) { |
3078 |
|
!!!cp ('t62'); |
3079 |
$furthest_block_parent->remove_child ($furthest_block->[0]); |
$furthest_block_parent->remove_child ($furthest_block->[0]); |
3080 |
} |
} |
3081 |
|
|
3098 |
S7S2: { |
S7S2: { |
3099 |
for (reverse 0..$#$active_formatting_elements) { |
for (reverse 0..$#$active_formatting_elements) { |
3100 |
if ($active_formatting_elements->[$_]->[0] eq $node->[0]) { |
if ($active_formatting_elements->[$_]->[0] eq $node->[0]) { |
3101 |
|
!!!cp ('t63'); |
3102 |
$node_i_in_active = $_; |
$node_i_in_active = $_; |
3103 |
last S7S2; |
last S7S2; |
3104 |
} |
} |
3112 |
|
|
3113 |
## Step 4 |
## Step 4 |
3114 |
if ($last_node->[0] eq $furthest_block->[0]) { |
if ($last_node->[0] eq $furthest_block->[0]) { |
3115 |
|
!!!cp ('t64'); |
3116 |
$bookmark_prev_el = $node->[0]; |
$bookmark_prev_el = $node->[0]; |
3117 |
} |
} |
3118 |
|
|
3119 |
## Step 5 |
## Step 5 |
3120 |
if ($node->[0]->has_child_nodes ()) { |
if ($node->[0]->has_child_nodes ()) { |
3121 |
|
!!!cp ('t65'); |
3122 |
my $clone = [$node->[0]->clone_node (0), $node->[1]]; |
my $clone = [$node->[0]->clone_node (0), $node->[1]]; |
3123 |
$active_formatting_elements->[$node_i_in_active] = $clone; |
$active_formatting_elements->[$node_i_in_active] = $clone; |
3124 |
$self->{open_elements}->[$node_i_in_open] = $clone; |
$self->{open_elements}->[$node_i_in_open] = $clone; |
3153 |
my $i; |
my $i; |
3154 |
AFE: for (reverse 0..$#$active_formatting_elements) { |
AFE: for (reverse 0..$#$active_formatting_elements) { |
3155 |
if ($active_formatting_elements->[$_]->[0] eq $formatting_element->[0]) { |
if ($active_formatting_elements->[$_]->[0] eq $formatting_element->[0]) { |
3156 |
|
!!!cp ('t66'); |
3157 |
splice @$active_formatting_elements, $_, 1; |
splice @$active_formatting_elements, $_, 1; |
3158 |
$i-- and last AFE if defined $i; |
$i-- and last AFE if defined $i; |
3159 |
} elsif ($active_formatting_elements->[$_]->[0] eq $bookmark_prev_el) { |
} elsif ($active_formatting_elements->[$_]->[0] eq $bookmark_prev_el) { |
3160 |
|
!!!cp ('t67'); |
3161 |
$i = $_; |
$i = $_; |
3162 |
} |
} |
3163 |
} # AFE |
} # AFE |
3167 |
undef $i; |
undef $i; |
3168 |
OE: for (reverse 0..$#{$self->{open_elements}}) { |
OE: for (reverse 0..$#{$self->{open_elements}}) { |
3169 |
if ($self->{open_elements}->[$_]->[0] eq $formatting_element->[0]) { |
if ($self->{open_elements}->[$_]->[0] eq $formatting_element->[0]) { |
3170 |
|
!!!cp ('t68'); |
3171 |
splice @{$self->{open_elements}}, $_, 1; |
splice @{$self->{open_elements}}, $_, 1; |
3172 |
$i-- and last OE if defined $i; |
$i-- and last OE if defined $i; |
3173 |
} elsif ($self->{open_elements}->[$_]->[0] eq $furthest_block->[0]) { |
} elsif ($self->{open_elements}->[$_]->[0] eq $furthest_block->[0]) { |
3174 |
|
!!!cp ('t69'); |
3175 |
$i = $_; |
$i = $_; |
3176 |
} |
} |
3177 |
} # OE |
} # OE |
3199 |
if ($self->{open_elements}->[$_]->[1] eq 'table') { |
if ($self->{open_elements}->[$_]->[1] eq 'table') { |
3200 |
my $parent = $self->{open_elements}->[$_]->[0]->parent_node; |
my $parent = $self->{open_elements}->[$_]->[0]->parent_node; |
3201 |
if (defined $parent and $parent->node_type == 1) { |
if (defined $parent and $parent->node_type == 1) { |
3202 |
|
!!!cp ('t70'); |
3203 |
$foster_parent_element = $parent; |
$foster_parent_element = $parent; |
3204 |
$next_sibling = $self->{open_elements}->[$_]->[0]; |
$next_sibling = $self->{open_elements}->[$_]->[0]; |
3205 |
} else { |
} else { |
3206 |
|
!!!cp ('t71'); |
3207 |
$foster_parent_element |
$foster_parent_element |
3208 |
= $self->{open_elements}->[$_ - 1]->[0]; |
= $self->{open_elements}->[$_ - 1]->[0]; |
3209 |
} |
} |
3215 |
$foster_parent_element->insert_before |
$foster_parent_element->insert_before |
3216 |
($child, $next_sibling); |
($child, $next_sibling); |
3217 |
} else { |
} else { |
3218 |
|
!!!cp ('t72'); |
3219 |
$self->{open_elements}->[-1]->[0]->append_child ($child); |
$self->{open_elements}->[-1]->[0]->append_child ($child); |
3220 |
} |
} |
3221 |
}; # $insert_to_foster |
}; # $insert_to_foster |
3224 |
|
|
3225 |
B: { |
B: { |
3226 |
if ($token->{type} == DOCTYPE_TOKEN) { |
if ($token->{type} == DOCTYPE_TOKEN) { |
3227 |
|
!!!cp ('t73'); |
3228 |
!!!parse-error (type => 'DOCTYPE in the middle'); |
!!!parse-error (type => 'DOCTYPE in the middle'); |
3229 |
## Ignore the token |
## Ignore the token |
3230 |
## Stay in the phase |
## Stay in the phase |
3232 |
redo B; |
redo B; |
3233 |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
3234 |
if ($self->{insertion_mode} & AFTER_HTML_IMS) { |
if ($self->{insertion_mode} & AFTER_HTML_IMS) { |
3235 |
|
!!!cp ('t74'); |
3236 |
# |
# |
3237 |
} else { |
} else { |
3238 |
## Generate implied end tags |
## Generate implied end tags |
3240 |
dd => 1, dt => 1, li => 1, p => 1, td => 1, th => 1, tr => 1, |
dd => 1, dt => 1, li => 1, p => 1, td => 1, th => 1, tr => 1, |
3241 |
tbody => 1, tfoot=> 1, thead => 1, |
tbody => 1, tfoot=> 1, thead => 1, |
3242 |
}->{$self->{open_elements}->[-1]->[1]}) { |
}->{$self->{open_elements}->[-1]->[1]}) { |
3243 |
|
!!!cp ('t75'); |
3244 |
!!!back-token; |
!!!back-token; |
3245 |
$token = {type => END_TAG_TOKEN, tag_name => $self->{open_elements}->[-1]->[1]}; |
$token = {type => END_TAG_TOKEN, tag_name => $self->{open_elements}->[-1]->[1]}; |
3246 |
redo B; |
redo B; |
3248 |
|
|
3249 |
if (@{$self->{open_elements}} > 2 or |
if (@{$self->{open_elements}} > 2 or |
3250 |
(@{$self->{open_elements}} == 2 and $self->{open_elements}->[1]->[1] ne 'body')) { |
(@{$self->{open_elements}} == 2 and $self->{open_elements}->[1]->[1] ne 'body')) { |
3251 |
|
!!!cp ('t76'); |
3252 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
3253 |
} elsif (defined $self->{inner_html_node} and |
} elsif (defined $self->{inner_html_node} and |
3254 |
@{$self->{open_elements}} > 1 and |
@{$self->{open_elements}} > 1 and |
3255 |
$self->{open_elements}->[1]->[1] ne 'body') { |
$self->{open_elements}->[1]->[1] ne 'body') { |
3256 |
|
!!!cp ('t77'); |
3257 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
3258 |
|
} else { |
3259 |
|
!!!cp ('t78'); |
3260 |
} |
} |
3261 |
|
|
3262 |
## ISSUE: There is an issue in the spec. |
## ISSUE: There is an issue in the spec. |
3267 |
} elsif ($token->{type} == START_TAG_TOKEN and |
} elsif ($token->{type} == START_TAG_TOKEN and |
3268 |
$token->{tag_name} eq 'html') { |
$token->{tag_name} eq 'html') { |
3269 |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) { |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) { |
3270 |
|
!!!cp ('t79'); |
3271 |
## Turn into the main phase |
## Turn into the main phase |
3272 |
!!!parse-error (type => 'after html:html'); |
!!!parse-error (type => 'after html:html'); |
3273 |
$self->{insertion_mode} = AFTER_BODY_IM; |
$self->{insertion_mode} = AFTER_BODY_IM; |
3274 |
} elsif ($self->{insertion_mode} == AFTER_HTML_FRAMESET_IM) { |
} elsif ($self->{insertion_mode} == AFTER_HTML_FRAMESET_IM) { |
3275 |
|
!!!cp ('t80'); |
3276 |
## Turn into the main phase |
## Turn into the main phase |
3277 |
!!!parse-error (type => 'after html:html'); |
!!!parse-error (type => 'after html:html'); |
3278 |
$self->{insertion_mode} = AFTER_FRAMESET_IM; |
$self->{insertion_mode} = AFTER_FRAMESET_IM; |
3279 |
|
} else { |
3280 |
|
!!!cp ('t81'); |
3281 |
} |
} |
3282 |
|
|
3283 |
## ISSUE: "aa<html>" is not a parse error. |
## ISSUE: "aa<html>" is not a parse error. |
3284 |
## ISSUE: "<html>" in fragment is not a parse error. |
## ISSUE: "<html>" in fragment is not a parse error. |
3285 |
unless ($token->{first_start_tag}) { |
unless ($token->{first_start_tag}) { |
3286 |
|
!!!cp ('t82'); |
3287 |
!!!parse-error (type => 'not first start tag'); |
!!!parse-error (type => 'not first start tag'); |
3288 |
|
} else { |
3289 |
|
!!!cp ('t83'); |
3290 |
} |
} |
3291 |
my $top_el = $self->{open_elements}->[0]->[0]; |
my $top_el = $self->{open_elements}->[0]->[0]; |
3292 |
for my $attr_name (keys %{$token->{attributes}}) { |
for my $attr_name (keys %{$token->{attributes}}) { |
3293 |
unless ($top_el->has_attribute_ns (undef, $attr_name)) { |
unless ($top_el->has_attribute_ns (undef, $attr_name)) { |
3294 |
|
!!!cp ('t84'); |
3295 |
$top_el->set_attribute_ns |
$top_el->set_attribute_ns |
3296 |
(undef, [undef, $attr_name], |
(undef, [undef, $attr_name], |
3297 |
$token->{attributes}->{$attr_name}->{value}); |
$token->{attributes}->{$attr_name}->{value}); |
3302 |
} elsif ($token->{type} == COMMENT_TOKEN) { |
} elsif ($token->{type} == COMMENT_TOKEN) { |
3303 |
my $comment = $self->{document}->create_comment ($token->{data}); |
my $comment = $self->{document}->create_comment ($token->{data}); |
3304 |
if ($self->{insertion_mode} & AFTER_HTML_IMS) { |
if ($self->{insertion_mode} & AFTER_HTML_IMS) { |
3305 |
|
!!!cp ('t85'); |
3306 |
$self->{document}->append_child ($comment); |
$self->{document}->append_child ($comment); |
3307 |
} elsif ($self->{insertion_mode} == AFTER_BODY_IM) { |
} elsif ($self->{insertion_mode} == AFTER_BODY_IM) { |
3308 |
|
!!!cp ('t86'); |
3309 |
$self->{open_elements}->[0]->[0]->append_child ($comment); |
$self->{open_elements}->[0]->[0]->append_child ($comment); |
3310 |
} else { |
} else { |
3311 |
|
!!!cp ('t87'); |
3312 |
$self->{open_elements}->[-1]->[0]->append_child ($comment); |
$self->{open_elements}->[-1]->[0]->append_child ($comment); |
3313 |
} |
} |
3314 |
!!!next-token; |
!!!next-token; |
3318 |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { |
3319 |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($1); |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($1); |
3320 |
unless (length $token->{data}) { |
unless (length $token->{data}) { |
3321 |
|
!!!cp ('t88'); |
3322 |
!!!next-token; |
!!!next-token; |
3323 |
redo B; |
redo B; |
3324 |
} |
} |
3325 |
} |
} |
3326 |
|
|
3327 |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
3328 |
|
!!!cp ('t89'); |
3329 |
## As if <head> |
## As if <head> |
3330 |
!!!create-element ($self->{head_element}, 'head'); |
!!!create-element ($self->{head_element}, 'head'); |
3331 |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
3336 |
|
|
3337 |
## Reprocess in the "after head" insertion mode... |
## Reprocess in the "after head" insertion mode... |
3338 |
} elsif ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
} elsif ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
3339 |
|
!!!cp ('t90'); |
3340 |
## As if </noscript> |
## As if </noscript> |
3341 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
3342 |
!!!parse-error (type => 'in noscript:#character'); |
!!!parse-error (type => 'in noscript:#character'); |
3347 |
|
|
3348 |
## Reprocess in the "after head" insertion mode... |
## Reprocess in the "after head" insertion mode... |
3349 |
} elsif ($self->{insertion_mode} == IN_HEAD_IM) { |
} elsif ($self->{insertion_mode} == IN_HEAD_IM) { |
3350 |
|
!!!cp ('t91'); |
3351 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
3352 |
|
|
3353 |
## Reprocess in the "after head" insertion mode... |
## Reprocess in the "after head" insertion mode... |
3354 |
|
} else { |
3355 |
|
!!!cp ('t92'); |
3356 |
} |
} |
3357 |
|
|
3358 |
## "after head" insertion mode |
## "after head" insertion mode |
3364 |
} elsif ($token->{type} == START_TAG_TOKEN) { |
} elsif ($token->{type} == START_TAG_TOKEN) { |
3365 |
if ($token->{tag_name} eq 'head') { |
if ($token->{tag_name} eq 'head') { |
3366 |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
3367 |
|
!!!cp ('t93'); |
3368 |
!!!create-element ($self->{head_element}, $token->{tag_name}, $token->{attributes}); |
!!!create-element ($self->{head_element}, $token->{tag_name}, $token->{attributes}); |
3369 |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
3370 |
push @{$self->{open_elements}}, [$self->{head_element}, $token->{tag_name}]; |
push @{$self->{open_elements}}, [$self->{head_element}, $token->{tag_name}]; |
3372 |
!!!next-token; |
!!!next-token; |
3373 |
redo B; |
redo B; |
3374 |
} elsif ($self->{insertion_mode} == AFTER_HEAD_IM) { |
} elsif ($self->{insertion_mode} == AFTER_HEAD_IM) { |
3375 |
|
!!!cp ('t94'); |
3376 |
# |
# |
3377 |
} else { |
} else { |
3378 |
|
!!!cp ('t95'); |
3379 |
!!!parse-error (type => 'in head:head'); # or in head noscript |
!!!parse-error (type => 'in head:head'); # or in head noscript |
3380 |
## Ignore the token |
## Ignore the token |
3381 |
!!!next-token; |
!!!next-token; |
3382 |
redo B; |
redo B; |
3383 |
} |
} |
3384 |
} elsif ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
} elsif ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
3385 |
|
!!!cp ('t96'); |
3386 |
## As if <head> |
## As if <head> |
3387 |
!!!create-element ($self->{head_element}, 'head'); |
!!!create-element ($self->{head_element}, 'head'); |
3388 |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
3390 |
|
|
3391 |
$self->{insertion_mode} = IN_HEAD_IM; |
$self->{insertion_mode} = IN_HEAD_IM; |
3392 |
## Reprocess in the "in head" insertion mode... |
## Reprocess in the "in head" insertion mode... |
3393 |
|
} else { |
3394 |
|
!!!cp ('t97'); |
3395 |
} |
} |
3396 |
|
|
3397 |
if ($token->{tag_name} eq 'base') { |
if ($token->{tag_name} eq 'base') { |
3398 |
if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
3399 |
|
!!!cp ('t98'); |
3400 |
## As if </noscript> |
## As if </noscript> |
3401 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
3402 |
!!!parse-error (type => 'in noscript:base'); |
!!!parse-error (type => 'in noscript:base'); |
3403 |
|
|
3404 |
$self->{insertion_mode} = IN_HEAD_IM; |
$self->{insertion_mode} = IN_HEAD_IM; |
3405 |
## Reprocess in the "in head" insertion mode... |
## Reprocess in the "in head" insertion mode... |
3406 |
|
} else { |
3407 |
|
!!!cp ('t99'); |
3408 |
} |
} |
3409 |
|
|
3410 |
## NOTE: There is a "as if in head" code clone. |
## NOTE: There is a "as if in head" code clone. |
3411 |
if ($self->{insertion_mode} == AFTER_HEAD_IM) { |
if ($self->{insertion_mode} == AFTER_HEAD_IM) { |
3412 |
|
!!!cp ('t100'); |
3413 |
!!!parse-error (type => 'after head:'.$token->{tag_name}); |
!!!parse-error (type => 'after head:'.$token->{tag_name}); |
3414 |
push @{$self->{open_elements}}, [$self->{head_element}, 'head']; |
push @{$self->{open_elements}}, [$self->{head_element}, 'head']; |
3415 |
|
} else { |
3416 |
|
!!!cp ('t101'); |
3417 |
} |
} |
3418 |
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
3419 |
pop @{$self->{open_elements}}; ## ISSUE: This step is missing in the spec. |
pop @{$self->{open_elements}}; ## ISSUE: This step is missing in the spec. |
3424 |
} elsif ($token->{tag_name} eq 'link') { |
} elsif ($token->{tag_name} eq 'link') { |
3425 |
## NOTE: There is a "as if in head" code clone. |
## NOTE: There is a "as if in head" code clone. |
3426 |
if ($self->{insertion_mode} == AFTER_HEAD_IM) { |
if ($self->{insertion_mode} == AFTER_HEAD_IM) { |
3427 |
|
!!!cp ('t102'); |
3428 |
!!!parse-error (type => 'after head:'.$token->{tag_name}); |
!!!parse-error (type => 'after head:'.$token->{tag_name}); |
3429 |
push @{$self->{open_elements}}, [$self->{head_element}, 'head']; |
push @{$self->{open_elements}}, [$self->{head_element}, 'head']; |
3430 |
|
} else { |
3431 |
|
!!!cp ('t103'); |
3432 |
} |
} |
3433 |
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
3434 |
pop @{$self->{open_elements}}; ## ISSUE: This step is missing in the spec. |
pop @{$self->{open_elements}}; ## ISSUE: This step is missing in the spec. |
3439 |
} elsif ($token->{tag_name} eq 'meta') { |
} elsif ($token->{tag_name} eq 'meta') { |
3440 |
## NOTE: There is a "as if in head" code clone. |
## NOTE: There is a "as if in head" code clone. |
3441 |
if ($self->{insertion_mode} == AFTER_HEAD_IM) { |
if ($self->{insertion_mode} == AFTER_HEAD_IM) { |
3442 |
|
!!!cp ('t104'); |
3443 |
!!!parse-error (type => 'after head:'.$token->{tag_name}); |
!!!parse-error (type => 'after head:'.$token->{tag_name}); |
3444 |
push @{$self->{open_elements}}, [$self->{head_element}, 'head']; |
push @{$self->{open_elements}}, [$self->{head_element}, 'head']; |
3445 |
|
} else { |
3446 |
|
!!!cp ('t105'); |
3447 |
} |
} |
3448 |
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
3449 |
my $meta_el = pop @{$self->{open_elements}}; ## ISSUE: This step is missing in the spec. |
my $meta_el = pop @{$self->{open_elements}}; ## ISSUE: This step is missing in the spec. |
3450 |
|
|
3451 |
unless ($self->{confident}) { |
unless ($self->{confident}) { |
3452 |
if ($token->{attributes}->{charset}) { ## TODO: And if supported |
if ($token->{attributes}->{charset}) { ## TODO: And if supported |
3453 |
|
!!!cp ('t106'); |
3454 |
$self->{change_encoding} |
$self->{change_encoding} |
3455 |
->($self, $token->{attributes}->{charset}->{value}); |
->($self, $token->{attributes}->{charset}->{value}); |
3456 |
|
|
3465 |
[\x09-\x0D\x20]*= |
[\x09-\x0D\x20]*= |
3466 |
[\x09-\x0D\x20]*(?>"([^"]*)"|'([^']*)'| |
[\x09-\x0D\x20]*(?>"([^"]*)"|'([^']*)'| |
3467 |
([^"'\x09-\x0D\x20][^\x09-\x0D\x20]*))/x) { |
([^"'\x09-\x0D\x20][^\x09-\x0D\x20]*))/x) { |
3468 |
|
!!!cp ('t107'); |
3469 |
$self->{change_encoding} |
$self->{change_encoding} |
3470 |
->($self, defined $1 ? $1 : defined $2 ? $2 : $3); |
->($self, defined $1 ? $1 : defined $2 ? $2 : $3); |
3471 |
$meta_el->[0]->get_attribute_node_ns (undef, 'content') |
$meta_el->[0]->get_attribute_node_ns (undef, 'content') |
3472 |
->set_user_data (manakai_has_reference => |
->set_user_data (manakai_has_reference => |
3473 |
$token->{attributes}->{content} |
$token->{attributes}->{content} |
3474 |
->{has_reference}); |
->{has_reference}); |
3475 |
|
} else { |
3476 |
|
!!!cp ('t108'); |
3477 |
} |
} |
3478 |
} |
} |
3479 |
} else { |
} else { |
3480 |
if ($token->{attributes}->{charset}) { |
if ($token->{attributes}->{charset}) { |
3481 |
|
!!!cp ('t109'); |
3482 |
$meta_el->[0]->get_attribute_node_ns (undef, 'charset') |
$meta_el->[0]->get_attribute_node_ns (undef, 'charset') |
3483 |
->set_user_data (manakai_has_reference => |
->set_user_data (manakai_has_reference => |
3484 |
$token->{attributes}->{charset} |
$token->{attributes}->{charset} |
3485 |
->{has_reference}); |
->{has_reference}); |
3486 |
} |
} |
3487 |
if ($token->{attributes}->{content}) { |
if ($token->{attributes}->{content}) { |
3488 |
|
!!!cp ('t110'); |
3489 |
$meta_el->[0]->get_attribute_node_ns (undef, 'content') |
$meta_el->[0]->get_attribute_node_ns (undef, 'content') |
3490 |
->set_user_data (manakai_has_reference => |
->set_user_data (manakai_has_reference => |
3491 |
$token->{attributes}->{content} |
$token->{attributes}->{content} |
3499 |
redo B; |
redo B; |
3500 |
} elsif ($token->{tag_name} eq 'title') { |
} elsif ($token->{tag_name} eq 'title') { |
3501 |
if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
3502 |
|
!!!cp ('t111'); |
3503 |
## As if </noscript> |
## As if </noscript> |
3504 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
3505 |
!!!parse-error (type => 'in noscript:title'); |
!!!parse-error (type => 'in noscript:title'); |
3507 |
$self->{insertion_mode} = IN_HEAD_IM; |
$self->{insertion_mode} = IN_HEAD_IM; |
3508 |
## Reprocess in the "in head" insertion mode... |
## Reprocess in the "in head" insertion mode... |
3509 |
} elsif ($self->{insertion_mode} == AFTER_HEAD_IM) { |
} elsif ($self->{insertion_mode} == AFTER_HEAD_IM) { |
3510 |
|
!!!cp ('t112'); |
3511 |
!!!parse-error (type => 'after head:'.$token->{tag_name}); |
!!!parse-error (type => 'after head:'.$token->{tag_name}); |
3512 |
push @{$self->{open_elements}}, [$self->{head_element}, 'head']; |
push @{$self->{open_elements}}, [$self->{head_element}, 'head']; |
3513 |
|
} else { |
3514 |
|
!!!cp ('t113'); |
3515 |
} |
} |
3516 |
|
|
3517 |
## NOTE: There is a "as if in head" code clone. |
## NOTE: There is a "as if in head" code clone. |
3527 |
## insertion mode IN_HEAD_IM) |
## insertion mode IN_HEAD_IM) |
3528 |
## NOTE: There is a "as if in head" code clone. |
## NOTE: There is a "as if in head" code clone. |
3529 |
if ($self->{insertion_mode} == AFTER_HEAD_IM) { |
if ($self->{insertion_mode} == AFTER_HEAD_IM) { |
3530 |
|
!!!cp ('t114'); |
3531 |
!!!parse-error (type => 'after head:'.$token->{tag_name}); |
!!!parse-error (type => 'after head:'.$token->{tag_name}); |
3532 |
push @{$self->{open_elements}}, [$self->{head_element}, 'head']; |
push @{$self->{open_elements}}, [$self->{head_element}, 'head']; |
3533 |
|
} else { |
3534 |
|
!!!cp ('t115'); |
3535 |
} |
} |
3536 |
$parse_rcdata->(CDATA_CONTENT_MODEL, $insert_to_current); |
$parse_rcdata->(CDATA_CONTENT_MODEL, $insert_to_current); |
3537 |
pop @{$self->{open_elements}} |
pop @{$self->{open_elements}} |
3539 |
redo B; |
redo B; |
3540 |
} elsif ($token->{tag_name} eq 'noscript') { |
} elsif ($token->{tag_name} eq 'noscript') { |
3541 |
if ($self->{insertion_mode} == IN_HEAD_IM) { |
if ($self->{insertion_mode} == IN_HEAD_IM) { |
3542 |
|
!!!cp ('t116'); |
3543 |
## NOTE: and scripting is disalbed |
## NOTE: and scripting is disalbed |
3544 |
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
3545 |
$self->{insertion_mode} = IN_HEAD_NOSCRIPT_IM; |
$self->{insertion_mode} = IN_HEAD_NOSCRIPT_IM; |
3546 |
!!!next-token; |
!!!next-token; |
3547 |
redo B; |
redo B; |
3548 |
} elsif ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
} elsif ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
3549 |
|
!!!cp ('t117'); |
3550 |
!!!parse-error (type => 'in noscript:noscript'); |
!!!parse-error (type => 'in noscript:noscript'); |
3551 |
## Ignore the token |
## Ignore the token |
3552 |
!!!next-token; |
!!!next-token; |
3553 |
redo B; |
redo B; |
3554 |
} else { |
} else { |
3555 |
|
!!!cp ('t118'); |
3556 |
# |
# |
3557 |
} |
} |
3558 |
} elsif ($token->{tag_name} eq 'script') { |
} elsif ($token->{tag_name} eq 'script') { |
3559 |
if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
3560 |
|
!!!cp ('t119'); |
3561 |
## As if </noscript> |
## As if </noscript> |
3562 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
3563 |
!!!parse-error (type => 'in noscript:script'); |
!!!parse-error (type => 'in noscript:script'); |
3565 |
$self->{insertion_mode} = IN_HEAD_IM; |
$self->{insertion_mode} = IN_HEAD_IM; |
3566 |
## Reprocess in the "in head" insertion mode... |
## Reprocess in the "in head" insertion mode... |
3567 |
} elsif ($self->{insertion_mode} == AFTER_HEAD_IM) { |
} elsif ($self->{insertion_mode} == AFTER_HEAD_IM) { |
3568 |
|
!!!cp ('t120'); |
3569 |
!!!parse-error (type => 'after head:'.$token->{tag_name}); |
!!!parse-error (type => 'after head:'.$token->{tag_name}); |
3570 |
push @{$self->{open_elements}}, [$self->{head_element}, 'head']; |
push @{$self->{open_elements}}, [$self->{head_element}, 'head']; |
3571 |
|
} else { |
3572 |
|
!!!cp ('t121'); |
3573 |
} |
} |
3574 |
|
|
3575 |
## NOTE: There is a "as if in head" code clone. |
## NOTE: There is a "as if in head" code clone. |
3580 |
} elsif ($token->{tag_name} eq 'body' or |
} elsif ($token->{tag_name} eq 'body' or |
3581 |
$token->{tag_name} eq 'frameset') { |
$token->{tag_name} eq 'frameset') { |
3582 |
if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
3583 |
|
!!!cp ('t122'); |
3584 |
## As if </noscript> |
## As if </noscript> |
3585 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
3586 |
!!!parse-error (type => 'in noscript:'.$token->{tag_name}); |
!!!parse-error (type => 'in noscript:'.$token->{tag_name}); |
3591 |
|
|
3592 |
## Reprocess in the "after head" insertion mode... |
## Reprocess in the "after head" insertion mode... |
3593 |
} elsif ($self->{insertion_mode} == IN_HEAD_IM) { |
} elsif ($self->{insertion_mode} == IN_HEAD_IM) { |
3594 |
|
!!!cp ('t124'); |
3595 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
3596 |
|
|
3597 |
## Reprocess in the "after head" insertion mode... |
## Reprocess in the "after head" insertion mode... |
3598 |
|
} else { |
3599 |
|
!!!cp ('t125'); |
3600 |
} |
} |
3601 |
|
|
3602 |
## "after head" insertion mode |
## "after head" insertion mode |
3603 |
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
3604 |
if ($token->{tag_name} eq 'body') { |
if ($token->{tag_name} eq 'body') { |
3605 |
|
!!!cp ('t126'); |
3606 |
$self->{insertion_mode} = IN_BODY_IM; |
$self->{insertion_mode} = IN_BODY_IM; |
3607 |
} elsif ($token->{tag_name} eq 'frameset') { |
} elsif ($token->{tag_name} eq 'frameset') { |
3608 |
|
!!!cp ('t127'); |
3609 |
$self->{insertion_mode} = IN_FRAMESET_IM; |
$self->{insertion_mode} = IN_FRAMESET_IM; |
3610 |
} else { |
} else { |
3611 |
die "$0: tag name: $self->{tag_name}"; |
die "$0: tag name: $self->{tag_name}"; |
3613 |
!!!next-token; |
!!!next-token; |
3614 |
redo B; |
redo B; |
3615 |
} else { |
} else { |
3616 |
|
!!!cp ('t128'); |
3617 |
# |
# |
3618 |
} |
} |
3619 |
|
|
3620 |
if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
3621 |
|
!!!cp ('t129'); |
3622 |
## As if </noscript> |
## As if </noscript> |
3623 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
3624 |
!!!parse-error (type => 'in noscript:/'.$token->{tag_name}); |
!!!parse-error (type => 'in noscript:/'.$token->{tag_name}); |
3629 |
|
|
3630 |
## Reprocess in the "after head" insertion mode... |
## Reprocess in the "after head" insertion mode... |
3631 |
} elsif ($self->{insertion_mode} == IN_HEAD_IM) { |
} elsif ($self->{insertion_mode} == IN_HEAD_IM) { |
3632 |
|
!!!cp ('t130'); |
3633 |
## As if </head> |
## As if </head> |
3634 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
3635 |
|
|
3636 |
## Reprocess in the "after head" insertion mode... |
## Reprocess in the "after head" insertion mode... |
3637 |
|
} else { |
3638 |
|
!!!cp ('t131'); |
3639 |
} |
} |
3640 |
|
|
3641 |
## "after head" insertion mode |
## "after head" insertion mode |
3647 |
} elsif ($token->{type} == END_TAG_TOKEN) { |
} elsif ($token->{type} == END_TAG_TOKEN) { |
3648 |
if ($token->{tag_name} eq 'head') { |
if ($token->{tag_name} eq 'head') { |
3649 |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
3650 |
|
!!!cp ('t132'); |
3651 |
## As if <head> |
## As if <head> |
3652 |
!!!create-element ($self->{head_element}, 'head'); |
!!!create-element ($self->{head_element}, 'head'); |
3653 |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
3659 |
!!!next-token; |
!!!next-token; |
3660 |
redo B; |
redo B; |
3661 |
} elsif ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
} elsif ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
3662 |
|
!!!cp ('t133'); |
3663 |
## As if </noscript> |
## As if </noscript> |
3664 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
3665 |
!!!parse-error (type => 'in noscript:script'); |
!!!parse-error (type => 'in noscript:script'); |
3670 |
!!!next-token; |
!!!next-token; |
3671 |
redo B; |
redo B; |
3672 |
} elsif ($self->{insertion_mode} == IN_HEAD_IM) { |
} elsif ($self->{insertion_mode} == IN_HEAD_IM) { |
3673 |
|
!!!cp ('t134'); |
3674 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
3675 |
$self->{insertion_mode} = AFTER_HEAD_IM; |
$self->{insertion_mode} = AFTER_HEAD_IM; |
3676 |
!!!next-token; |
!!!next-token; |
3677 |
redo B; |
redo B; |
3678 |
} else { |
} else { |
3679 |
|
!!!cp ('t135'); |
3680 |
# |
# |
3681 |
} |
} |
3682 |
} elsif ($token->{tag_name} eq 'noscript') { |
} elsif ($token->{tag_name} eq 'noscript') { |
3683 |
if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
3684 |
|
!!!cp ('t136'); |
3685 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
3686 |
$self->{insertion_mode} = IN_HEAD_IM; |
$self->{insertion_mode} = IN_HEAD_IM; |
3687 |
!!!next-token; |
!!!next-token; |
3688 |
redo B; |
redo B; |
3689 |
} elsif ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
} elsif ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
3690 |
|
!!!cp ('t137'); |
3691 |
!!!parse-error (type => 'unmatched end tag:noscript'); |
!!!parse-error (type => 'unmatched end tag:noscript'); |
3692 |
## Ignore the token ## ISSUE: An issue in the spec. |
## Ignore the token ## ISSUE: An issue in the spec. |
3693 |
!!!next-token; |
!!!next-token; |
3694 |
redo B; |
redo B; |
3695 |
} else { |
} else { |
3696 |
|
!!!cp ('t138'); |
3697 |
# |
# |
3698 |
} |
} |
3699 |
} elsif ({ |
} elsif ({ |
3700 |
body => 1, html => 1, |
body => 1, html => 1, |
3701 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
3702 |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
3703 |
|
!!!cp ('t139'); |
3704 |
## As if <head> |
## As if <head> |
3705 |
!!!create-element ($self->{head_element}, 'head'); |
!!!create-element ($self->{head_element}, 'head'); |
3706 |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
3709 |
$self->{insertion_mode} = IN_HEAD_IM; |
$self->{insertion_mode} = IN_HEAD_IM; |
3710 |
## Reprocess in the "in head" insertion mode... |
## Reprocess in the "in head" insertion mode... |
3711 |
} elsif ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
} elsif ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
3712 |
|
!!!cp ('t140'); |
3713 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
3714 |
## Ignore the token |
## Ignore the token |
3715 |
!!!next-token; |
!!!next-token; |
3716 |
redo B; |
redo B; |
3717 |
|
} else { |
3718 |
|
!!!cp ('t141'); |
3719 |
} |
} |
3720 |
|
|
3721 |
# |
# |
3723 |
p => 1, br => 1, |
p => 1, br => 1, |
3724 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
3725 |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
if ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
3726 |
|
!!!cp ('t142'); |
3727 |
## As if <head> |
## As if <head> |
3728 |
!!!create-element ($self->{head_element}, 'head'); |
!!!create-element ($self->{head_element}, 'head'); |
3729 |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
3731 |
|
|
3732 |
$self->{insertion_mode} = IN_HEAD_IM; |
$self->{insertion_mode} = IN_HEAD_IM; |
3733 |
## Reprocess in the "in head" insertion mode... |
## Reprocess in the "in head" insertion mode... |
3734 |
|
} else { |
3735 |
|
!!!cp ('t143'); |
3736 |
} |
} |
3737 |
|
|
3738 |
# |
# |
3739 |
} else { |
} else { |
3740 |
if ($self->{insertion_mode} == AFTER_HEAD_IM) { |
if ($self->{insertion_mode} == AFTER_HEAD_IM) { |
3741 |
|
!!!cp ('t144'); |
3742 |
# |
# |
3743 |
} else { |
} else { |
3744 |
|
!!!cp ('t145'); |
3745 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
3746 |
## Ignore the token |
## Ignore the token |
3747 |
!!!next-token; |
!!!next-token; |
3750 |
} |
} |
3751 |
|
|
3752 |
if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
if ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
3753 |
|
!!!cp ('t146'); |
3754 |
## As if </noscript> |
## As if </noscript> |
3755 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
3756 |
!!!parse-error (type => 'in noscript:/'.$token->{tag_name}); |
!!!parse-error (type => 'in noscript:/'.$token->{tag_name}); |
3761 |
|
|
3762 |
## Reprocess in the "after head" insertion mode... |
## Reprocess in the "after head" insertion mode... |
3763 |
} elsif ($self->{insertion_mode} == IN_HEAD_IM) { |
} elsif ($self->{insertion_mode} == IN_HEAD_IM) { |
3764 |
|
!!!cp ('t147'); |
3765 |
## As if </head> |
## As if </head> |
3766 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
3767 |
|
|
3768 |
## Reprocess in the "after head" insertion mode... |
## Reprocess in the "after head" insertion mode... |
3769 |
} elsif ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
} elsif ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
3770 |
|
!!!cp ('t148'); |
3771 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
3772 |
## Ignore the token ## ISSUE: An issue in the spec. |
## Ignore the token ## ISSUE: An issue in the spec. |
3773 |
!!!next-token; |
!!!next-token; |
3774 |
redo B; |
redo B; |
3775 |
|
} else { |
3776 |
|
!!!cp ('t149'); |
3777 |
} |
} |
3778 |
|
|
3779 |
## "after head" insertion mode |
## "after head" insertion mode |
3789 |
## ISSUE: An issue in the spec. |
## ISSUE: An issue in the spec. |
3790 |
} elsif ($self->{insertion_mode} & BODY_IMS) { |
} elsif ($self->{insertion_mode} & BODY_IMS) { |
3791 |
if ($token->{type} == CHARACTER_TOKEN) { |
if ($token->{type} == CHARACTER_TOKEN) { |
3792 |
|
!!!cp ('t150'); |
3793 |
## NOTE: There is a code clone of "character in body". |
## NOTE: There is a code clone of "character in body". |
3794 |
$reconstruct_active_formatting_elements->($insert_to_current); |
$reconstruct_active_formatting_elements->($insert_to_current); |
3795 |
|
|
3808 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
3809 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
3810 |
if ($node->[1] eq 'td' or $node->[1] eq 'th') { |
if ($node->[1] eq 'td' or $node->[1] eq 'th') { |
3811 |
|
!!!cp ('t151'); |
3812 |
$tn = $node->[1]; |
$tn = $node->[1]; |
3813 |
last INSCOPE; |
last INSCOPE; |
3814 |
} elsif ({ |
} elsif ({ |
3815 |
table => 1, html => 1, |
table => 1, html => 1, |
3816 |
}->{$node->[1]}) { |
}->{$node->[1]}) { |
3817 |
|
!!!cp ('t152'); |
3818 |
last INSCOPE; |
last INSCOPE; |
3819 |
} |
} |
3820 |
} # INSCOPE |
} # INSCOPE |
3821 |
unless (defined $tn) { |
unless (defined $tn) { |
3822 |
|
!!!cp ('t153'); |
3823 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
3824 |
## Ignore the token |
## Ignore the token |
3825 |
!!!next-token; |
!!!next-token; |
3826 |
redo B; |
redo B; |
3827 |
} |
} |
3828 |
|
|
3829 |
|
!!!cp ('t154'); |
3830 |
## Close the cell |
## Close the cell |
3831 |
!!!back-token; # <?> |
!!!back-token; # <?> |
3832 |
$token = {type => END_TAG_TOKEN, tag_name => $tn}; |
$token = {type => END_TAG_TOKEN, tag_name => $tn}; |
3840 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
3841 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
3842 |
if ($node->[1] eq 'caption') { |
if ($node->[1] eq 'caption') { |
3843 |
|
!!!cp ('t155'); |
3844 |
$i = $_; |
$i = $_; |
3845 |
last INSCOPE; |
last INSCOPE; |
3846 |
} elsif ({ |
} elsif ({ |
3847 |
table => 1, html => 1, |
table => 1, html => 1, |
3848 |
}->{$node->[1]}) { |
}->{$node->[1]}) { |
3849 |
|
!!!cp ('t156'); |
3850 |
last INSCOPE; |
last INSCOPE; |
3851 |
} |
} |
3852 |
} # INSCOPE |
} # INSCOPE |
3853 |
unless (defined $i) { |
unless (defined $i) { |
3854 |
|
!!!cp ('t157'); |
3855 |
!!!parse-error (type => 'unmatched end tag:caption'); |
!!!parse-error (type => 'unmatched end tag:caption'); |
3856 |
## Ignore the token |
## Ignore the token |
3857 |
!!!next-token; |
!!!next-token; |
3864 |
td => 1, th => 1, tr => 1, |
td => 1, th => 1, tr => 1, |
3865 |
tbody => 1, tfoot=> 1, thead => 1, |
tbody => 1, tfoot=> 1, thead => 1, |
3866 |
}->{$self->{open_elements}->[-1]->[1]}) { |
}->{$self->{open_elements}->[-1]->[1]}) { |
3867 |
|
!!!cp ('t158'); |
3868 |
!!!back-token; # <?> |
!!!back-token; # <?> |
3869 |
$token = {type => END_TAG_TOKEN, tag_name => 'caption'}; |
$token = {type => END_TAG_TOKEN, tag_name => 'caption'}; |
3870 |
!!!back-token; |
!!!back-token; |
3874 |
} |
} |
3875 |
|
|
3876 |
if ($self->{open_elements}->[-1]->[1] ne 'caption') { |
if ($self->{open_elements}->[-1]->[1] ne 'caption') { |
3877 |
|
!!!cp ('t159'); |
3878 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
3879 |
|
} else { |
3880 |
|
!!!cp ('t160'); |
3881 |
} |
} |
3882 |
|
|
3883 |
splice @{$self->{open_elements}}, $i; |
splice @{$self->{open_elements}}, $i; |
3889 |
## reprocess |
## reprocess |
3890 |
redo B; |
redo B; |
3891 |
} else { |
} else { |
3892 |
|
!!!cp ('t161'); |
3893 |
# |
# |
3894 |
} |
} |
3895 |
} else { |
} else { |
3896 |
|
!!!cp ('t162'); |
3897 |
# |
# |
3898 |
} |
} |
3899 |
} elsif ($token->{type} == END_TAG_TOKEN) { |
} elsif ($token->{type} == END_TAG_TOKEN) { |
3904 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
3905 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
3906 |
if ($node->[1] eq $token->{tag_name}) { |
if ($node->[1] eq $token->{tag_name}) { |
3907 |
|
!!!cp ('t163'); |
3908 |
$i = $_; |
$i = $_; |
3909 |
last INSCOPE; |
last INSCOPE; |
3910 |
} elsif ({ |
} elsif ({ |
3911 |
table => 1, html => 1, |
table => 1, html => 1, |
3912 |
}->{$node->[1]}) { |
}->{$node->[1]}) { |
3913 |
|
!!!cp ('t164'); |
3914 |
last INSCOPE; |
last INSCOPE; |
3915 |
} |
} |
3916 |
} # INSCOPE |
} # INSCOPE |
3917 |
unless (defined $i) { |
unless (defined $i) { |
3918 |
|
!!!cp ('t165'); |
3919 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
3920 |
## Ignore the token |
## Ignore the token |
3921 |
!!!next-token; |
!!!next-token; |
3930 |
tr => 1, |
tr => 1, |
3931 |
tbody => 1, tfoot=> 1, thead => 1, |
tbody => 1, tfoot=> 1, thead => 1, |
3932 |
}->{$self->{open_elements}->[-1]->[1]}) { |
}->{$self->{open_elements}->[-1]->[1]}) { |
3933 |
|
!!!cp ('t166'); |
3934 |
!!!back-token; |
!!!back-token; |
3935 |
$token = {type => END_TAG_TOKEN, |
$token = {type => END_TAG_TOKEN, |
3936 |
tag_name => $self->{open_elements}->[-1]->[1]}; # MUST |
tag_name => $self->{open_elements}->[-1]->[1]}; # MUST |
3938 |
} |
} |
3939 |
|
|
3940 |
if ($self->{open_elements}->[-1]->[1] ne $token->{tag_name}) { |
if ($self->{open_elements}->[-1]->[1] ne $token->{tag_name}) { |
3941 |
|
!!!cp ('t167'); |
3942 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
3943 |
|
} else { |
3944 |
|
!!!cp ('t168'); |
3945 |
} |
} |
3946 |
|
|
3947 |
splice @{$self->{open_elements}}, $i; |
splice @{$self->{open_elements}}, $i; |
3953 |
!!!next-token; |
!!!next-token; |
3954 |
redo B; |
redo B; |
3955 |
} elsif ($self->{insertion_mode} == IN_CAPTION_IM) { |
} elsif ($self->{insertion_mode} == IN_CAPTION_IM) { |
3956 |
|
!!!cp ('t169'); |
3957 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
3958 |
## Ignore the token |
## Ignore the token |
3959 |
!!!next-token; |
!!!next-token; |
3960 |
redo B; |
redo B; |
3961 |
} else { |
} else { |
3962 |
|
!!!cp ('t170'); |
3963 |
# |
# |
3964 |
} |
} |
3965 |
} elsif ($token->{tag_name} eq 'caption') { |
} elsif ($token->{tag_name} eq 'caption') { |
3969 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
3970 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
3971 |
if ($node->[1] eq $token->{tag_name}) { |
if ($node->[1] eq $token->{tag_name}) { |
3972 |
|
!!!cp ('t171'); |
3973 |
$i = $_; |
$i = $_; |
3974 |
last INSCOPE; |
last INSCOPE; |
3975 |
} elsif ({ |
} elsif ({ |
3976 |
table => 1, html => 1, |
table => 1, html => 1, |
3977 |
}->{$node->[1]}) { |
}->{$node->[1]}) { |
3978 |
|
!!!cp ('t172'); |
3979 |
last INSCOPE; |
last INSCOPE; |
3980 |
} |
} |
3981 |
} # INSCOPE |
} # INSCOPE |
3982 |
unless (defined $i) { |
unless (defined $i) { |
3983 |
|
!!!cp ('t173'); |
3984 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
3985 |
## Ignore the token |
## Ignore the token |
3986 |
!!!next-token; |
!!!next-token; |
3993 |
td => 1, th => 1, tr => 1, |
td => 1, th => 1, tr => 1, |
3994 |
tbody => 1, tfoot=> 1, thead => 1, |
tbody => 1, tfoot=> 1, thead => 1, |
3995 |
}->{$self->{open_elements}->[-1]->[1]}) { |
}->{$self->{open_elements}->[-1]->[1]}) { |
3996 |
|
!!!cp ('t174'); |
3997 |
!!!back-token; |
!!!back-token; |
3998 |
$token = {type => END_TAG_TOKEN, |
$token = {type => END_TAG_TOKEN, |
3999 |
tag_name => $self->{open_elements}->[-1]->[1]}; # MUST |
tag_name => $self->{open_elements}->[-1]->[1]}; # MUST |
4001 |
} |
} |
4002 |
|
|
4003 |
if ($self->{open_elements}->[-1]->[1] ne 'caption') { |
if ($self->{open_elements}->[-1]->[1] ne 'caption') { |
4004 |
|
!!!cp ('t175'); |
4005 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
4006 |
|
} else { |
4007 |
|
!!!cp ('t176'); |
4008 |
} |
} |
4009 |
|
|
4010 |
splice @{$self->{open_elements}}, $i; |
splice @{$self->{open_elements}}, $i; |
4016 |
!!!next-token; |
!!!next-token; |
4017 |
redo B; |
redo B; |
4018 |
} elsif ($self->{insertion_mode} == IN_CELL_IM) { |
} elsif ($self->{insertion_mode} == IN_CELL_IM) { |
4019 |
|
!!!cp ('t177'); |
4020 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
4021 |
## Ignore the token |
## Ignore the token |
4022 |
!!!next-token; |
!!!next-token; |
4023 |
redo B; |
redo B; |
4024 |
} else { |
} else { |
4025 |
|
!!!cp ('t178'); |
4026 |
# |
# |
4027 |
} |
} |
4028 |
} elsif ({ |
} elsif ({ |
4036 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
4037 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
4038 |
if ($node->[1] eq $token->{tag_name}) { |
if ($node->[1] eq $token->{tag_name}) { |
4039 |
|
!!!cp ('t179'); |
4040 |
$i = $_; |
$i = $_; |
4041 |
last INSCOPE; |
last INSCOPE; |
4042 |
} elsif ($node->[1] eq 'td' or $node->[1] eq 'th') { |
} elsif ($node->[1] eq 'td' or $node->[1] eq 'th') { |
4043 |
|
!!!cp ('t180'); |
4044 |
$tn = $node->[1]; |
$tn = $node->[1]; |
4045 |
## NOTE: There is exactly one |td| or |th| element |
## NOTE: There is exactly one |td| or |th| element |
4046 |
## in scope in the stack of open elements by definition. |
## in scope in the stack of open elements by definition. |
4047 |
} elsif ({ |
} elsif ({ |
4048 |
table => 1, html => 1, |
table => 1, html => 1, |
4049 |
}->{$node->[1]}) { |
}->{$node->[1]}) { |
4050 |
|
!!!cp ('t181'); |
4051 |
last INSCOPE; |
last INSCOPE; |
4052 |
} |
} |
4053 |
} # INSCOPE |
} # INSCOPE |
4054 |
unless (defined $i) { |
unless (defined $i) { |
4055 |
|
!!!cp ('t182'); |
4056 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
4057 |
## Ignore the token |
## Ignore the token |
4058 |
!!!next-token; |
!!!next-token; |
4059 |
redo B; |
redo B; |
4060 |
|
} else { |
4061 |
|
!!!cp ('t183'); |
4062 |
} |
} |
4063 |
|
|
4064 |
## Close the cell |
## Close the cell |
4075 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
4076 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
4077 |
if ($node->[1] eq 'caption') { |
if ($node->[1] eq 'caption') { |
4078 |
|
!!!cp ('t184'); |
4079 |
$i = $_; |
$i = $_; |
4080 |
last INSCOPE; |
last INSCOPE; |
4081 |
} elsif ({ |
} elsif ({ |
4082 |
table => 1, html => 1, |
table => 1, html => 1, |
4083 |
}->{$node->[1]}) { |
}->{$node->[1]}) { |
4084 |
|
!!!cp ('t185'); |
4085 |
last INSCOPE; |
last INSCOPE; |
4086 |
} |
} |
4087 |
} # INSCOPE |
} # INSCOPE |
4088 |
unless (defined $i) { |
unless (defined $i) { |
4089 |
|
!!!cp ('t186'); |
4090 |
!!!parse-error (type => 'unmatched end tag:caption'); |
!!!parse-error (type => 'unmatched end tag:caption'); |
4091 |
## Ignore the token |
## Ignore the token |
4092 |
!!!next-token; |
!!!next-token; |
4099 |
td => 1, th => 1, tr => 1, |
td => 1, th => 1, tr => 1, |
4100 |
tbody => 1, tfoot=> 1, thead => 1, |
tbody => 1, tfoot=> 1, thead => 1, |
4101 |
}->{$self->{open_elements}->[-1]->[1]}) { |
}->{$self->{open_elements}->[-1]->[1]}) { |
4102 |
|
!!!cp ('t187'); |
4103 |
!!!back-token; # </table> |
!!!back-token; # </table> |
4104 |
$token = {type => END_TAG_TOKEN, tag_name => 'caption'}; |
$token = {type => END_TAG_TOKEN, tag_name => 'caption'}; |
4105 |
!!!back-token; |
!!!back-token; |
4109 |
} |
} |
4110 |
|
|
4111 |
if ($self->{open_elements}->[-1]->[1] ne 'caption') { |
if ($self->{open_elements}->[-1]->[1] ne 'caption') { |
4112 |
|
!!!cp ('t188'); |
4113 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
4114 |
|
} else { |
4115 |
|
!!!cp ('t189'); |
4116 |
} |
} |
4117 |
|
|
4118 |
splice @{$self->{open_elements}}, $i; |
splice @{$self->{open_elements}}, $i; |
4127 |
body => 1, col => 1, colgroup => 1, html => 1, |
body => 1, col => 1, colgroup => 1, html => 1, |
4128 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
4129 |
if ($self->{insertion_mode} & BODY_TABLE_IMS) { |
if ($self->{insertion_mode} & BODY_TABLE_IMS) { |
4130 |
|
!!!cp ('t190'); |
4131 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
4132 |
## Ignore the token |
## Ignore the token |
4133 |
!!!next-token; |
!!!next-token; |
4134 |
redo B; |
redo B; |
4135 |
} else { |
} else { |
4136 |
|
!!!cp ('t191'); |
4137 |
# |
# |
4138 |
} |
} |
4139 |
} elsif ({ |
} elsif ({ |
4141 |
thead => 1, tr => 1, |
thead => 1, tr => 1, |
4142 |
}->{$token->{tag_name}} and |
}->{$token->{tag_name}} and |
4143 |
$self->{insertion_mode} == IN_CAPTION_IM) { |
$self->{insertion_mode} == IN_CAPTION_IM) { |
4144 |
|
!!!cp ('t192'); |
4145 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
4146 |
## Ignore the token |
## Ignore the token |
4147 |
!!!next-token; |
!!!next-token; |
4148 |
redo B; |
redo B; |
4149 |
} else { |
} else { |
4150 |
|
!!!cp ('t193'); |
4151 |
# |
# |
4152 |
} |
} |
4153 |
} else { |
} else { |
4162 |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($1); |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($1); |
4163 |
|
|
4164 |
unless (length $token->{data}) { |
unless (length $token->{data}) { |
4165 |
|
!!!cp ('t194'); |
4166 |
!!!next-token; |
!!!next-token; |
4167 |
redo B; |
redo B; |
4168 |
|
} else { |
4169 |
|
!!!cp ('t195'); |
4170 |
} |
} |
4171 |
} |
} |
4172 |
|
|
4190 |
if ($self->{open_elements}->[$_]->[1] eq 'table') { |
if ($self->{open_elements}->[$_]->[1] eq 'table') { |
4191 |
my $parent = $self->{open_elements}->[$_]->[0]->parent_node; |
my $parent = $self->{open_elements}->[$_]->[0]->parent_node; |
4192 |
if (defined $parent and $parent->node_type == 1) { |
if (defined $parent and $parent->node_type == 1) { |
4193 |
|
!!!cp ('t196'); |
4194 |
$foster_parent_element = $parent; |
$foster_parent_element = $parent; |
4195 |
$next_sibling = $self->{open_elements}->[$_]->[0]; |
$next_sibling = $self->{open_elements}->[$_]->[0]; |
4196 |
$prev_sibling = $next_sibling->previous_sibling; |
$prev_sibling = $next_sibling->previous_sibling; |
4197 |
} else { |
} else { |
4198 |
|
!!!cp ('t197'); |
4199 |
$foster_parent_element = $self->{open_elements}->[$_ - 1]->[0]; |
$foster_parent_element = $self->{open_elements}->[$_ - 1]->[0]; |
4200 |
$prev_sibling = $foster_parent_element->last_child; |
$prev_sibling = $foster_parent_element->last_child; |
4201 |
} |
} |
4207 |
unless defined $foster_parent_element; |
unless defined $foster_parent_element; |
4208 |
if (defined $prev_sibling and |
if (defined $prev_sibling and |
4209 |
$prev_sibling->node_type == 3) { |
$prev_sibling->node_type == 3) { |
4210 |
|
!!!cp ('t198'); |
4211 |
$prev_sibling->manakai_append_text ($token->{data}); |
$prev_sibling->manakai_append_text ($token->{data}); |
4212 |
} else { |
} else { |
4213 |
|
!!!cp ('t199'); |
4214 |
$foster_parent_element->insert_before |
$foster_parent_element->insert_before |
4215 |
($self->{document}->create_text_node ($token->{data}), |
($self->{document}->create_text_node ($token->{data}), |
4216 |
$next_sibling); |
$next_sibling); |
4217 |
} |
} |
4218 |
} else { |
} else { |
4219 |
|
!!!cp ('t200'); |
4220 |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data}); |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data}); |
4221 |
} |
} |
4222 |
|
|
4231 |
## Clear back to table context |
## Clear back to table context |
4232 |
while ($self->{open_elements}->[-1]->[1] ne 'table' and |
while ($self->{open_elements}->[-1]->[1] ne 'table' and |
4233 |
$self->{open_elements}->[-1]->[1] ne 'html') { |
$self->{open_elements}->[-1]->[1] ne 'html') { |
4234 |
|
!!!cp ('t201'); |
4235 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
4236 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4237 |
} |
} |
4243 |
|
|
4244 |
if ($self->{insertion_mode} == IN_TABLE_BODY_IM) { |
if ($self->{insertion_mode} == IN_TABLE_BODY_IM) { |
4245 |
unless ($token->{tag_name} eq 'tr') { |
unless ($token->{tag_name} eq 'tr') { |
4246 |
|
!!!cp ('t202'); |
4247 |
!!!parse-error (type => 'missing start tag:tr'); |
!!!parse-error (type => 'missing start tag:tr'); |
4248 |
} |
} |
4249 |
|
|
4251 |
while (not { |
while (not { |
4252 |
tbody => 1, tfoot => 1, thead => 1, html => 1, |
tbody => 1, tfoot => 1, thead => 1, html => 1, |
4253 |
}->{$self->{open_elements}->[-1]->[1]}) { |
}->{$self->{open_elements}->[-1]->[1]}) { |
4254 |
|
!!!cp ('t203'); |
4255 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
4256 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4257 |
} |
} |
4258 |
|
|
4259 |
$self->{insertion_mode} = IN_ROW_IM; |
$self->{insertion_mode} = IN_ROW_IM; |
4260 |
if ($token->{tag_name} eq 'tr') { |
if ($token->{tag_name} eq 'tr') { |
4261 |
|
!!!cp ('t204'); |
4262 |
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
4263 |
!!!next-token; |
!!!next-token; |
4264 |
redo B; |
redo B; |
4265 |
} else { |
} else { |
4266 |
|
!!!cp ('t205'); |
4267 |
!!!insert-element ('tr'); |
!!!insert-element ('tr'); |
4268 |
## reprocess in the "in row" insertion mode |
## reprocess in the "in row" insertion mode |
4269 |
} |
} |
4270 |
|
} else { |
4271 |
|
!!!cp ('t206'); |
4272 |
} |
} |
4273 |
|
|
4274 |
## Clear back to table row context |
## Clear back to table row context |
4275 |
while (not { |
while (not { |
4276 |
tr => 1, html => 1, |
tr => 1, html => 1, |
4277 |
}->{$self->{open_elements}->[-1]->[1]}) { |
}->{$self->{open_elements}->[-1]->[1]}) { |
4278 |
|
!!!cp ('t207'); |
4279 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
4280 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4281 |
} |
} |
4299 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
4300 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
4301 |
if ($node->[1] eq 'tr') { |
if ($node->[1] eq 'tr') { |
4302 |
|
!!!cp ('t208'); |
4303 |
$i = $_; |
$i = $_; |
4304 |
last INSCOPE; |
last INSCOPE; |
4305 |
} elsif ({ |
} elsif ({ |
4306 |
table => 1, html => 1, |
table => 1, html => 1, |
4307 |
}->{$node->[1]}) { |
}->{$node->[1]}) { |
4308 |
|
!!!cp ('t209'); |
4309 |
last INSCOPE; |
last INSCOPE; |
4310 |
} |
} |
4311 |
} # INSCOPE |
} # INSCOPE |
4312 |
unless (defined $i) { |
unless (defined $i) { |
4313 |
!!!parse-error (type => 'unmacthed end tag:'.$token->{tag_name}); |
!!!cp ('t210'); |
4314 |
|
!!!parse-error (type => 'unmacthed end tag:'.$token->{tag_name}); |
4315 |
## Ignore the token |
## Ignore the token |
4316 |
!!!next-token; |
!!!next-token; |
4317 |
redo B; |
redo B; |
4321 |
while (not { |
while (not { |
4322 |
tr => 1, html => 1, |
tr => 1, html => 1, |
4323 |
}->{$self->{open_elements}->[-1]->[1]}) { |
}->{$self->{open_elements}->[-1]->[1]}) { |
4324 |
|
!!!cp ('t211'); |
4325 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
4326 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4327 |
} |
} |
4329 |
pop @{$self->{open_elements}}; # tr |
pop @{$self->{open_elements}}; # tr |
4330 |
$self->{insertion_mode} = IN_TABLE_BODY_IM; |
$self->{insertion_mode} = IN_TABLE_BODY_IM; |
4331 |
if ($token->{tag_name} eq 'tr') { |
if ($token->{tag_name} eq 'tr') { |
4332 |
|
!!!cp ('t212'); |
4333 |
## reprocess |
## reprocess |
4334 |
redo B; |
redo B; |
4335 |
} else { |
} else { |
4336 |
|
!!!cp ('t213'); |
4337 |
## reprocess in the "in table body" insertion mode... |
## reprocess in the "in table body" insertion mode... |
4338 |
} |
} |
4339 |
} |
} |
4346 |
if ({ |
if ({ |
4347 |
tbody => 1, thead => 1, tfoot => 1, |
tbody => 1, thead => 1, tfoot => 1, |
4348 |
}->{$node->[1]}) { |
}->{$node->[1]}) { |
4349 |
|
!!!cp ('t214'); |
4350 |
$i = $_; |
$i = $_; |
4351 |
last INSCOPE; |
last INSCOPE; |
4352 |
} elsif ({ |
} elsif ({ |
4353 |
table => 1, html => 1, |
table => 1, html => 1, |
4354 |
}->{$node->[1]}) { |
}->{$node->[1]}) { |
4355 |
|
!!!cp ('t215'); |
4356 |
last INSCOPE; |
last INSCOPE; |
4357 |
} |
} |
4358 |
} # INSCOPE |
} # INSCOPE |
4359 |
unless (defined $i) { |
unless (defined $i) { |
4360 |
|
!!!cp ('t216'); |
4361 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
4362 |
## Ignore the token |
## Ignore the token |
4363 |
!!!next-token; |
!!!next-token; |
4368 |
while (not { |
while (not { |
4369 |
tbody => 1, tfoot => 1, thead => 1, html => 1, |
tbody => 1, tfoot => 1, thead => 1, html => 1, |
4370 |
}->{$self->{open_elements}->[-1]->[1]}) { |
}->{$self->{open_elements}->[-1]->[1]}) { |
4371 |
|
!!!cp ('t217'); |
4372 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
4373 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4374 |
} |
} |
4383 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4384 |
$self->{insertion_mode} = IN_TABLE_IM; |
$self->{insertion_mode} = IN_TABLE_IM; |
4385 |
## reprocess in "in table" insertion mode... |
## reprocess in "in table" insertion mode... |
4386 |
|
} else { |
4387 |
|
!!!cp ('t218'); |
4388 |
} |
} |
4389 |
|
|
4390 |
if ($token->{tag_name} eq 'col') { |
if ($token->{tag_name} eq 'col') { |
4391 |
## Clear back to table context |
## Clear back to table context |
4392 |
while ($self->{open_elements}->[-1]->[1] ne 'table' and |
while ($self->{open_elements}->[-1]->[1] ne 'table' and |
4393 |
$self->{open_elements}->[-1]->[1] ne 'html') { |
$self->{open_elements}->[-1]->[1] ne 'html') { |
4394 |
|
!!!cp ('t219'); |
4395 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
4396 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4397 |
} |
} |
4408 |
## Clear back to table context |
## Clear back to table context |
4409 |
while ($self->{open_elements}->[-1]->[1] ne 'table' and |
while ($self->{open_elements}->[-1]->[1] ne 'table' and |
4410 |
$self->{open_elements}->[-1]->[1] ne 'html') { |
$self->{open_elements}->[-1]->[1] ne 'html') { |
4411 |
|
!!!cp ('t220'); |
4412 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
4413 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4414 |
} |
} |
4438 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
4439 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
4440 |
if ($node->[1] eq 'table') { |
if ($node->[1] eq 'table') { |
4441 |
|
!!!cp ('t221'); |
4442 |
$i = $_; |
$i = $_; |
4443 |
last INSCOPE; |
last INSCOPE; |
4444 |
} elsif ({ |
} elsif ({ |
4445 |
table => 1, html => 1, |
table => 1, html => 1, |
4446 |
}->{$node->[1]}) { |
}->{$node->[1]}) { |
4447 |
|
!!!cp ('t222'); |
4448 |
last INSCOPE; |
last INSCOPE; |
4449 |
} |
} |
4450 |
} # INSCOPE |
} # INSCOPE |
4451 |
unless (defined $i) { |
unless (defined $i) { |
4452 |
|
!!!cp ('t223'); |
4453 |
!!!parse-error (type => 'unmatched end tag:table'); |
!!!parse-error (type => 'unmatched end tag:table'); |
4454 |
## Ignore tokens </table><table> |
## Ignore tokens </table><table> |
4455 |
!!!next-token; |
!!!next-token; |
4462 |
td => 1, th => 1, tr => 1, |
td => 1, th => 1, tr => 1, |
4463 |
tbody => 1, tfoot=> 1, thead => 1, |
tbody => 1, tfoot=> 1, thead => 1, |
4464 |
}->{$self->{open_elements}->[-1]->[1]}) { |
}->{$self->{open_elements}->[-1]->[1]}) { |
4465 |
|
!!!cp ('t224'); |
4466 |
!!!back-token; # <table> |
!!!back-token; # <table> |
4467 |
$token = {type => END_TAG_TOKEN, tag_name => 'table'}; |
$token = {type => END_TAG_TOKEN, tag_name => 'table'}; |
4468 |
!!!back-token; |
!!!back-token; |
4472 |
} |
} |
4473 |
|
|
4474 |
if ($self->{open_elements}->[-1]->[1] ne 'table') { |
if ($self->{open_elements}->[-1]->[1] ne 'table') { |
4475 |
|
!!!cp ('t225'); |
4476 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
4477 |
|
} else { |
4478 |
|
!!!cp ('t226'); |
4479 |
} |
} |
4480 |
|
|
4481 |
splice @{$self->{open_elements}}, $i; |
splice @{$self->{open_elements}}, $i; |
4485 |
## reprocess |
## reprocess |
4486 |
redo B; |
redo B; |
4487 |
} else { |
} else { |
4488 |
|
!!!cp ('t227'); |
4489 |
!!!parse-error (type => 'in table:'.$token->{tag_name}); |
!!!parse-error (type => 'in table:'.$token->{tag_name}); |
4490 |
|
|
4491 |
$insert = $insert_to_foster; |
$insert = $insert_to_foster; |
4499 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
4500 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
4501 |
if ($node->[1] eq $token->{tag_name}) { |
if ($node->[1] eq $token->{tag_name}) { |
4502 |
|
!!!cp ('t228'); |
4503 |
$i = $_; |
$i = $_; |
4504 |
last INSCOPE; |
last INSCOPE; |
4505 |
} elsif ({ |
} elsif ({ |
4506 |
table => 1, html => 1, |
table => 1, html => 1, |
4507 |
}->{$node->[1]}) { |
}->{$node->[1]}) { |
4508 |
|
!!!cp ('t229'); |
4509 |
last INSCOPE; |
last INSCOPE; |
4510 |
} |
} |
4511 |
} # INSCOPE |
} # INSCOPE |
4512 |
unless (defined $i) { |
unless (defined $i) { |
4513 |
|
!!!cp ('t230'); |
4514 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
4515 |
## Ignore the token |
## Ignore the token |
4516 |
!!!next-token; |
!!!next-token; |
4517 |
redo B; |
redo B; |
4518 |
|
} else { |
4519 |
|
!!!cp ('t232'); |
4520 |
} |
} |
4521 |
|
|
4522 |
## Clear back to table row context |
## Clear back to table row context |
4523 |
while (not { |
while (not { |
4524 |
tr => 1, html => 1, |
tr => 1, html => 1, |
4525 |
}->{$self->{open_elements}->[-1]->[1]}) { |
}->{$self->{open_elements}->[-1]->[1]}) { |
4526 |
|
!!!cp ('t231'); |
4527 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
4528 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4529 |
} |
} |
4540 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
4541 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
4542 |
if ($node->[1] eq 'tr') { |
if ($node->[1] eq 'tr') { |
4543 |
|
!!!cp ('t233'); |
4544 |
$i = $_; |
$i = $_; |
4545 |
last INSCOPE; |
last INSCOPE; |
4546 |
} elsif ({ |
} elsif ({ |
4547 |
table => 1, html => 1, |
table => 1, html => 1, |
4548 |
}->{$node->[1]}) { |
}->{$node->[1]}) { |
4549 |
|
!!!cp ('t234'); |
4550 |
last INSCOPE; |
last INSCOPE; |
4551 |
} |
} |
4552 |
} # INSCOPE |
} # INSCOPE |
4553 |
unless (defined $i) { |
unless (defined $i) { |
4554 |
|
!!!cp ('t235'); |
4555 |
!!!parse-error (type => 'unmatched end tag:'.$token->{type}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{type}); |
4556 |
## Ignore the token |
## Ignore the token |
4557 |
!!!next-token; |
!!!next-token; |
4562 |
while (not { |
while (not { |
4563 |
tr => 1, html => 1, |
tr => 1, html => 1, |
4564 |
}->{$self->{open_elements}->[-1]->[1]}) { |
}->{$self->{open_elements}->[-1]->[1]}) { |
4565 |
|
!!!cp ('t236'); |
4566 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
4567 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4568 |
} |
} |
4580 |
if ({ |
if ({ |
4581 |
tbody => 1, thead => 1, tfoot => 1, |
tbody => 1, thead => 1, tfoot => 1, |
4582 |
}->{$node->[1]}) { |
}->{$node->[1]}) { |
4583 |
|
!!!cp ('t237'); |
4584 |
$i = $_; |
$i = $_; |
4585 |
last INSCOPE; |
last INSCOPE; |
4586 |
} elsif ({ |
} elsif ({ |
4587 |
table => 1, html => 1, |
table => 1, html => 1, |
4588 |
}->{$node->[1]}) { |
}->{$node->[1]}) { |
4589 |
|
!!!cp ('t238'); |
4590 |
last INSCOPE; |
last INSCOPE; |
4591 |
} |
} |
4592 |
} # INSCOPE |
} # INSCOPE |
4593 |
unless (defined $i) { |
unless (defined $i) { |
4594 |
|
!!!cp ('t239'); |
4595 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
4596 |
## Ignore the token |
## Ignore the token |
4597 |
!!!next-token; |
!!!next-token; |
4602 |
while (not { |
while (not { |
4603 |
tbody => 1, tfoot => 1, thead => 1, html => 1, |
tbody => 1, tfoot => 1, thead => 1, html => 1, |
4604 |
}->{$self->{open_elements}->[-1]->[1]}) { |
}->{$self->{open_elements}->[-1]->[1]}) { |
4605 |
|
!!!cp ('t240'); |
4606 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
4607 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4608 |
} |
} |
4624 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
4625 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
4626 |
if ($node->[1] eq $token->{tag_name}) { |
if ($node->[1] eq $token->{tag_name}) { |
4627 |
|
!!!cp ('t241'); |
4628 |
$i = $_; |
$i = $_; |
4629 |
last INSCOPE; |
last INSCOPE; |
4630 |
} elsif ({ |
} elsif ({ |
4631 |
table => 1, html => 1, |
table => 1, html => 1, |
4632 |
}->{$node->[1]}) { |
}->{$node->[1]}) { |
4633 |
|
!!!cp ('t242'); |
4634 |
last INSCOPE; |
last INSCOPE; |
4635 |
} |
} |
4636 |
} # INSCOPE |
} # INSCOPE |
4637 |
unless (defined $i) { |
unless (defined $i) { |
4638 |
|
!!!cp ('t243'); |
4639 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
4640 |
## Ignore the token |
## Ignore the token |
4641 |
!!!next-token; |
!!!next-token; |
4648 |
td => 1, th => 1, tr => 1, |
td => 1, th => 1, tr => 1, |
4649 |
tbody => 1, tfoot=> 1, thead => 1, |
tbody => 1, tfoot=> 1, thead => 1, |
4650 |
}->{$self->{open_elements}->[-1]->[1]}) { |
}->{$self->{open_elements}->[-1]->[1]}) { |
4651 |
|
!!!cp ('t244'); |
4652 |
!!!back-token; |
!!!back-token; |
4653 |
$token = {type => END_TAG_TOKEN, |
$token = {type => END_TAG_TOKEN, |
4654 |
tag_name => $self->{open_elements}->[-1]->[1]}; # MUST |
tag_name => $self->{open_elements}->[-1]->[1]}; # MUST |
4656 |
} |
} |
4657 |
|
|
4658 |
if ($self->{open_elements}->[-1]->[1] ne 'table') { |
if ($self->{open_elements}->[-1]->[1] ne 'table') { |
4659 |
|
!!!cp ('t245'); |
4660 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
4661 |
|
} else { |
4662 |
|
!!!cp ('t246'); |
4663 |
} |
} |
4664 |
|
|
4665 |
splice @{$self->{open_elements}}, $i; |
splice @{$self->{open_elements}}, $i; |
4678 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
4679 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
4680 |
if ($node->[1] eq $token->{tag_name}) { |
if ($node->[1] eq $token->{tag_name}) { |
4681 |
|
!!!cp ('t247'); |
4682 |
$i = $_; |
$i = $_; |
4683 |
last INSCOPE; |
last INSCOPE; |
4684 |
} elsif ({ |
} elsif ({ |
4685 |
table => 1, html => 1, |
table => 1, html => 1, |
4686 |
}->{$node->[1]}) { |
}->{$node->[1]}) { |
4687 |
|
!!!cp ('t248'); |
4688 |
last INSCOPE; |
last INSCOPE; |
4689 |
} |
} |
4690 |
} # INSCOPE |
} # INSCOPE |
4691 |
unless (defined $i) { |
unless (defined $i) { |
4692 |
|
!!!cp ('t249'); |
4693 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
4694 |
## Ignore the token |
## Ignore the token |
4695 |
!!!next-token; |
!!!next-token; |
4702 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
4703 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
4704 |
if ($node->[1] eq 'tr') { |
if ($node->[1] eq 'tr') { |
4705 |
|
!!!cp ('t250'); |
4706 |
$i = $_; |
$i = $_; |
4707 |
last INSCOPE; |
last INSCOPE; |
4708 |
} elsif ({ |
} elsif ({ |
4709 |
table => 1, html => 1, |
table => 1, html => 1, |
4710 |
}->{$node->[1]}) { |
}->{$node->[1]}) { |
4711 |
|
!!!cp ('t251'); |
4712 |
last INSCOPE; |
last INSCOPE; |
4713 |
} |
} |
4714 |
} # INSCOPE |
} # INSCOPE |
4715 |
unless (defined $i) { |
unless (defined $i) { |
4716 |
|
!!!cp ('t252'); |
4717 |
!!!parse-error (type => 'unmatched end tag:tr'); |
!!!parse-error (type => 'unmatched end tag:tr'); |
4718 |
## Ignore the token |
## Ignore the token |
4719 |
!!!next-token; |
!!!next-token; |
4724 |
while (not { |
while (not { |
4725 |
tr => 1, html => 1, |
tr => 1, html => 1, |
4726 |
}->{$self->{open_elements}->[-1]->[1]}) { |
}->{$self->{open_elements}->[-1]->[1]}) { |
4727 |
|
!!!cp ('t253'); |
4728 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
4729 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4730 |
} |
} |
4739 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
4740 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
4741 |
if ($node->[1] eq $token->{tag_name}) { |
if ($node->[1] eq $token->{tag_name}) { |
4742 |
|
!!!cp ('t254'); |
4743 |
$i = $_; |
$i = $_; |
4744 |
last INSCOPE; |
last INSCOPE; |
4745 |
} elsif ({ |
} elsif ({ |
4746 |
table => 1, html => 1, |
table => 1, html => 1, |
4747 |
}->{$node->[1]}) { |
}->{$node->[1]}) { |
4748 |
|
!!!cp ('t255'); |
4749 |
last INSCOPE; |
last INSCOPE; |
4750 |
} |
} |
4751 |
} # INSCOPE |
} # INSCOPE |
4752 |
unless (defined $i) { |
unless (defined $i) { |
4753 |
|
!!!cp ('t256'); |
4754 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
4755 |
## Ignore the token |
## Ignore the token |
4756 |
!!!next-token; |
!!!next-token; |
4761 |
while (not { |
while (not { |
4762 |
tbody => 1, tfoot => 1, thead => 1, html => 1, |
tbody => 1, tfoot => 1, thead => 1, html => 1, |
4763 |
}->{$self->{open_elements}->[-1]->[1]}) { |
}->{$self->{open_elements}->[-1]->[1]}) { |
4764 |
|
!!!cp ('t257'); |
4765 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
4766 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4767 |
} |
} |
4776 |
tr => 1, # $self->{insertion_mode} == IN_ROW_IM |
tr => 1, # $self->{insertion_mode} == IN_ROW_IM |
4777 |
tbody => 1, tfoot => 1, thead => 1, # $self->{insertion_mode} == IN_TABLE_IM |
tbody => 1, tfoot => 1, thead => 1, # $self->{insertion_mode} == IN_TABLE_IM |
4778 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
4779 |
|
!!!cp ('t258'); |
4780 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
4781 |
## Ignore the token |
## Ignore the token |
4782 |
!!!next-token; |
!!!next-token; |
4783 |
redo B; |
redo B; |
4784 |
} else { |
} else { |
4785 |
|
!!!cp ('t259'); |
4786 |
!!!parse-error (type => 'in table:/'.$token->{tag_name}); |
!!!parse-error (type => 'in table:/'.$token->{tag_name}); |
4787 |
|
|
4788 |
$insert = $insert_to_foster; |
$insert = $insert_to_foster; |
4796 |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { |
4797 |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($1); |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($1); |
4798 |
unless (length $token->{data}) { |
unless (length $token->{data}) { |
4799 |
|
!!!cp ('t260'); |
4800 |
!!!next-token; |
!!!next-token; |
4801 |
redo B; |
redo B; |
4802 |
} |
} |
4803 |
} |
} |
4804 |
|
|
4805 |
|
!!!cp ('t261'); |
4806 |
# |
# |
4807 |
} elsif ($token->{type} == START_TAG_TOKEN) { |
} elsif ($token->{type} == START_TAG_TOKEN) { |
4808 |
if ($token->{tag_name} eq 'col') { |
if ($token->{tag_name} eq 'col') { |
4809 |
|
!!!cp ('t262'); |
4810 |
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
4811 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4812 |
!!!next-token; |
!!!next-token; |
4813 |
redo B; |
redo B; |
4814 |
} else { |
} else { |
4815 |
|
!!!cp ('t263'); |
4816 |
# |
# |
4817 |
} |
} |
4818 |
} elsif ($token->{type} == END_TAG_TOKEN) { |
} elsif ($token->{type} == END_TAG_TOKEN) { |
4819 |
if ($token->{tag_name} eq 'colgroup') { |
if ($token->{tag_name} eq 'colgroup') { |
4820 |
if ($self->{open_elements}->[-1]->[1] eq 'html') { |
if ($self->{open_elements}->[-1]->[1] eq 'html') { |
4821 |
|
!!!cp ('t264'); |
4822 |
!!!parse-error (type => 'unmatched end tag:colgroup'); |
!!!parse-error (type => 'unmatched end tag:colgroup'); |
4823 |
## Ignore the token |
## Ignore the token |
4824 |
!!!next-token; |
!!!next-token; |
4825 |
redo B; |
redo B; |
4826 |
} else { |
} else { |
4827 |
|
!!!cp ('t265'); |
4828 |
pop @{$self->{open_elements}}; # colgroup |
pop @{$self->{open_elements}}; # colgroup |
4829 |
$self->{insertion_mode} = IN_TABLE_IM; |
$self->{insertion_mode} = IN_TABLE_IM; |
4830 |
!!!next-token; |
!!!next-token; |
4831 |
redo B; |
redo B; |
4832 |
} |
} |
4833 |
} elsif ($token->{tag_name} eq 'col') { |
} elsif ($token->{tag_name} eq 'col') { |
4834 |
|
!!!cp ('t266'); |
4835 |
!!!parse-error (type => 'unmatched end tag:col'); |
!!!parse-error (type => 'unmatched end tag:col'); |
4836 |
## Ignore the token |
## Ignore the token |
4837 |
!!!next-token; |
!!!next-token; |
4838 |
redo B; |
redo B; |
4839 |
} else { |
} else { |
4840 |
|
!!!cp ('t267'); |
4841 |
# |
# |
4842 |
} |
} |
4843 |
} else { |
} else { |
4844 |
|
!!!cp ('t268'); |
4845 |
# |
# |
4846 |
} |
} |
4847 |
|
|
4848 |
## As if </colgroup> |
## As if </colgroup> |
4849 |
if ($self->{open_elements}->[-1]->[1] eq 'html') { |
if ($self->{open_elements}->[-1]->[1] eq 'html') { |
4850 |
|
!!!cp ('t269'); |
4851 |
!!!parse-error (type => 'unmatched end tag:colgroup'); |
!!!parse-error (type => 'unmatched end tag:colgroup'); |
4852 |
## Ignore the token |
## Ignore the token |
4853 |
!!!next-token; |
!!!next-token; |
4854 |
redo B; |
redo B; |
4855 |
} else { |
} else { |
4856 |
|
!!!cp ('t270'); |
4857 |
pop @{$self->{open_elements}}; # colgroup |
pop @{$self->{open_elements}}; # colgroup |
4858 |
$self->{insertion_mode} = IN_TABLE_IM; |
$self->{insertion_mode} = IN_TABLE_IM; |
4859 |
## reprocess |
## reprocess |
4861 |
} |
} |
4862 |
} elsif ($self->{insertion_mode} == IN_SELECT_IM) { |
} elsif ($self->{insertion_mode} == IN_SELECT_IM) { |
4863 |
if ($token->{type} == CHARACTER_TOKEN) { |
if ($token->{type} == CHARACTER_TOKEN) { |
4864 |
|
!!!cp ('t271'); |
4865 |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data}); |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data}); |
4866 |
!!!next-token; |
!!!next-token; |
4867 |
redo B; |
redo B; |
4868 |
} elsif ($token->{type} == START_TAG_TOKEN) { |
} elsif ($token->{type} == START_TAG_TOKEN) { |
4869 |
if ($token->{tag_name} eq 'option') { |
if ($token->{tag_name} eq 'option') { |
4870 |
if ($self->{open_elements}->[-1]->[1] eq 'option') { |
if ($self->{open_elements}->[-1]->[1] eq 'option') { |
4871 |
|
!!!cp ('t272'); |
4872 |
## As if </option> |
## As if </option> |
4873 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4874 |
|
} else { |
4875 |
|
!!!cp ('t273'); |
4876 |
} |
} |
4877 |
|
|
4878 |
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
4880 |
redo B; |
redo B; |
4881 |
} elsif ($token->{tag_name} eq 'optgroup') { |
} elsif ($token->{tag_name} eq 'optgroup') { |
4882 |
if ($self->{open_elements}->[-1]->[1] eq 'option') { |
if ($self->{open_elements}->[-1]->[1] eq 'option') { |
4883 |
|
!!!cp ('t274'); |
4884 |
## As if </option> |
## As if </option> |
4885 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4886 |
|
} else { |
4887 |
|
!!!cp ('t275'); |
4888 |
} |
} |
4889 |
|
|
4890 |
if ($self->{open_elements}->[-1]->[1] eq 'optgroup') { |
if ($self->{open_elements}->[-1]->[1] eq 'optgroup') { |
4891 |
|
!!!cp ('t276'); |
4892 |
## As if </optgroup> |
## As if </optgroup> |
4893 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4894 |
|
} else { |
4895 |
|
!!!cp ('t277'); |
4896 |
} |
} |
4897 |
|
|
4898 |
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
4906 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
4907 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
4908 |
if ($node->[1] eq $token->{tag_name}) { |
if ($node->[1] eq $token->{tag_name}) { |
4909 |
|
!!!cp ('t278'); |
4910 |
$i = $_; |
$i = $_; |
4911 |
last INSCOPE; |
last INSCOPE; |
4912 |
} elsif ({ |
} elsif ({ |
4913 |
table => 1, html => 1, |
table => 1, html => 1, |
4914 |
}->{$node->[1]}) { |
}->{$node->[1]}) { |
4915 |
|
!!!cp ('t279'); |
4916 |
last INSCOPE; |
last INSCOPE; |
4917 |
} |
} |
4918 |
} # INSCOPE |
} # INSCOPE |
4919 |
unless (defined $i) { |
unless (defined $i) { |
4920 |
|
!!!cp ('t280'); |
4921 |
!!!parse-error (type => 'unmatched end tag:select'); |
!!!parse-error (type => 'unmatched end tag:select'); |
4922 |
## Ignore the token |
## Ignore the token |
4923 |
!!!next-token; |
!!!next-token; |
4924 |
redo B; |
redo B; |
4925 |
} |
} |
4926 |
|
|
4927 |
|
!!!cp ('t281'); |
4928 |
splice @{$self->{open_elements}}, $i; |
splice @{$self->{open_elements}}, $i; |
4929 |
|
|
4930 |
$self->_reset_insertion_mode; |
$self->_reset_insertion_mode; |
4932 |
!!!next-token; |
!!!next-token; |
4933 |
redo B; |
redo B; |
4934 |
} else { |
} else { |
4935 |
|
!!!cp ('t282'); |
4936 |
!!!parse-error (type => 'in select:'.$token->{tag_name}); |
!!!parse-error (type => 'in select:'.$token->{tag_name}); |
4937 |
## Ignore the token |
## Ignore the token |
4938 |
!!!next-token; |
!!!next-token; |
4942 |
if ($token->{tag_name} eq 'optgroup') { |
if ($token->{tag_name} eq 'optgroup') { |
4943 |
if ($self->{open_elements}->[-1]->[1] eq 'option' and |
if ($self->{open_elements}->[-1]->[1] eq 'option' and |
4944 |
$self->{open_elements}->[-2]->[1] eq 'optgroup') { |
$self->{open_elements}->[-2]->[1] eq 'optgroup') { |
4945 |
|
!!!cp ('t283'); |
4946 |
## As if </option> |
## As if </option> |
4947 |
splice @{$self->{open_elements}}, -2; |
splice @{$self->{open_elements}}, -2; |
4948 |
} elsif ($self->{open_elements}->[-1]->[1] eq 'optgroup') { |
} elsif ($self->{open_elements}->[-1]->[1] eq 'optgroup') { |
4949 |
|
!!!cp ('t284'); |
4950 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4951 |
} else { |
} else { |
4952 |
|
!!!cp ('t285'); |
4953 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
4954 |
## Ignore the token |
## Ignore the token |
4955 |
} |
} |
4957 |
redo B; |
redo B; |
4958 |
} elsif ($token->{tag_name} eq 'option') { |
} elsif ($token->{tag_name} eq 'option') { |
4959 |
if ($self->{open_elements}->[-1]->[1] eq 'option') { |
if ($self->{open_elements}->[-1]->[1] eq 'option') { |
4960 |
|
!!!cp ('t286'); |
4961 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4962 |
} else { |
} else { |
4963 |
|
!!!cp ('t287'); |
4964 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
4965 |
## Ignore the token |
## Ignore the token |
4966 |
} |
} |
4972 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
4973 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
4974 |
if ($node->[1] eq $token->{tag_name}) { |
if ($node->[1] eq $token->{tag_name}) { |
4975 |
|
!!!cp ('t288'); |
4976 |
$i = $_; |
$i = $_; |
4977 |
last INSCOPE; |
last INSCOPE; |
4978 |
} elsif ({ |
} elsif ({ |
4979 |
table => 1, html => 1, |
table => 1, html => 1, |
4980 |
}->{$node->[1]}) { |
}->{$node->[1]}) { |
4981 |
|
!!!cp ('t289'); |
4982 |
last INSCOPE; |
last INSCOPE; |
4983 |
} |
} |
4984 |
} # INSCOPE |
} # INSCOPE |
4985 |
unless (defined $i) { |
unless (defined $i) { |
4986 |
|
!!!cp ('t290'); |
4987 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
4988 |
## Ignore the token |
## Ignore the token |
4989 |
!!!next-token; |
!!!next-token; |
4990 |
redo B; |
redo B; |
4991 |
} |
} |
4992 |
|
|
4993 |
|
!!!cp ('t291'); |
4994 |
splice @{$self->{open_elements}}, $i; |
splice @{$self->{open_elements}}, $i; |
4995 |
|
|
4996 |
$self->_reset_insertion_mode; |
$self->_reset_insertion_mode; |
5008 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
5009 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
5010 |
if ($node->[1] eq $token->{tag_name}) { |
if ($node->[1] eq $token->{tag_name}) { |
5011 |
|
!!!cp ('t292'); |
5012 |
$i = $_; |
$i = $_; |
5013 |
last INSCOPE; |
last INSCOPE; |
5014 |
} elsif ({ |
} elsif ({ |
5015 |
table => 1, html => 1, |
table => 1, html => 1, |
5016 |
}->{$node->[1]}) { |
}->{$node->[1]}) { |
5017 |
|
!!!cp ('t293'); |
5018 |
last INSCOPE; |
last INSCOPE; |
5019 |
} |
} |
5020 |
} # INSCOPE |
} # INSCOPE |
5021 |
unless (defined $i) { |
unless (defined $i) { |
5022 |
|
!!!cp ('t294'); |
5023 |
## Ignore the token |
## Ignore the token |
5024 |
!!!next-token; |
!!!next-token; |
5025 |
redo B; |
redo B; |
5031 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
5032 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
5033 |
if ($node->[1] eq 'select') { |
if ($node->[1] eq 'select') { |
5034 |
|
!!!cp ('t295'); |
5035 |
$i = $_; |
$i = $_; |
5036 |
last INSCOPE; |
last INSCOPE; |
5037 |
} elsif ({ |
} elsif ({ |
5038 |
table => 1, html => 1, |
table => 1, html => 1, |
5039 |
}->{$node->[1]}) { |
}->{$node->[1]}) { |
5040 |
|
!!!cp ('t296'); |
5041 |
last INSCOPE; |
last INSCOPE; |
5042 |
} |
} |
5043 |
} # INSCOPE |
} # INSCOPE |
5044 |
unless (defined $i) { |
unless (defined $i) { |
5045 |
|
!!!cp ('t297'); |
5046 |
!!!parse-error (type => 'unmatched end tag:select'); |
!!!parse-error (type => 'unmatched end tag:select'); |
5047 |
## Ignore the </select> token |
## Ignore the </select> token |
5048 |
!!!next-token; ## TODO: ok? |
!!!next-token; ## TODO: ok? |
5049 |
redo B; |
redo B; |
5050 |
} |
} |
5051 |
|
|
5052 |
|
!!!cp ('t298'); |
5053 |
splice @{$self->{open_elements}}, $i; |
splice @{$self->{open_elements}}, $i; |
5054 |
|
|
5055 |
$self->_reset_insertion_mode; |
$self->_reset_insertion_mode; |
5057 |
## reprocess |
## reprocess |
5058 |
redo B; |
redo B; |
5059 |
} else { |
} else { |
5060 |
|
!!!cp ('t299'); |
5061 |
!!!parse-error (type => 'in select:/'.$token->{tag_name}); |
!!!parse-error (type => 'in select:/'.$token->{tag_name}); |
5062 |
## Ignore the token |
## Ignore the token |
5063 |
!!!next-token; |
!!!next-token; |
5076 |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($1); |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($1); |
5077 |
|
|
5078 |
unless (length $token->{data}) { |
unless (length $token->{data}) { |
5079 |
|
!!!cp ('t300'); |
5080 |
!!!next-token; |
!!!next-token; |
5081 |
redo B; |
redo B; |
5082 |
} |
} |
5083 |
} |
} |
5084 |
|
|
5085 |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) { |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) { |
5086 |
|
!!!cp ('t301'); |
5087 |
!!!parse-error (type => 'after html:#character'); |
!!!parse-error (type => 'after html:#character'); |
5088 |
|
|
5089 |
## Reprocess in the "main" phase, "after body" insertion mode... |
## Reprocess in the "main" phase, "after body" insertion mode... |
5090 |
|
} else { |
5091 |
|
!!!cp ('t302'); |
5092 |
} |
} |
5093 |
|
|
5094 |
## "after body" insertion mode |
## "after body" insertion mode |
5099 |
redo B; |
redo B; |
5100 |
} elsif ($token->{type} == START_TAG_TOKEN) { |
} elsif ($token->{type} == START_TAG_TOKEN) { |
5101 |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) { |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) { |
5102 |
|
!!!cp ('t303'); |
5103 |
!!!parse-error (type => 'after html:'.$token->{tag_name}); |
!!!parse-error (type => 'after html:'.$token->{tag_name}); |
5104 |
|
|
5105 |
## Reprocess in the "main" phase, "after body" insertion mode... |
## Reprocess in the "main" phase, "after body" insertion mode... |
5106 |
|
} else { |
5107 |
|
!!!cp ('t304'); |
5108 |
} |
} |
5109 |
|
|
5110 |
## "after body" insertion mode |
## "after body" insertion mode |
5115 |
redo B; |
redo B; |
5116 |
} elsif ($token->{type} == END_TAG_TOKEN) { |
} elsif ($token->{type} == END_TAG_TOKEN) { |
5117 |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) { |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) { |
5118 |
|
!!!cp ('t305'); |
5119 |
!!!parse-error (type => 'after html:/'.$token->{tag_name}); |
!!!parse-error (type => 'after html:/'.$token->{tag_name}); |
5120 |
|
|
5121 |
$self->{insertion_mode} = AFTER_BODY_IM; |
$self->{insertion_mode} = AFTER_BODY_IM; |
5122 |
## Reprocess in the "main" phase, "after body" insertion mode... |
## Reprocess in the "main" phase, "after body" insertion mode... |
5123 |
|
} else { |
5124 |
|
!!!cp ('t306'); |
5125 |
} |
} |
5126 |
|
|
5127 |
## "after body" insertion mode |
## "after body" insertion mode |
5128 |
if ($token->{tag_name} eq 'html') { |
if ($token->{tag_name} eq 'html') { |
5129 |
if (defined $self->{inner_html_node}) { |
if (defined $self->{inner_html_node}) { |
5130 |
|
!!!cp ('t307'); |
5131 |
!!!parse-error (type => 'unmatched end tag:html'); |
!!!parse-error (type => 'unmatched end tag:html'); |
5132 |
## Ignore the token |
## Ignore the token |
5133 |
!!!next-token; |
!!!next-token; |
5134 |
redo B; |
redo B; |
5135 |
} else { |
} else { |
5136 |
|
!!!cp ('t308'); |
5137 |
$self->{insertion_mode} = AFTER_HTML_BODY_IM; |
$self->{insertion_mode} = AFTER_HTML_BODY_IM; |
5138 |
!!!next-token; |
!!!next-token; |
5139 |
redo B; |
redo B; |
5140 |
} |
} |
5141 |
} else { |
} else { |
5142 |
|
!!!cp ('t309'); |
5143 |
!!!parse-error (type => 'after body:/'.$token->{tag_name}); |
!!!parse-error (type => 'after body:/'.$token->{tag_name}); |
5144 |
|
|
5145 |
$self->{insertion_mode} = IN_BODY_IM; |
$self->{insertion_mode} = IN_BODY_IM; |
5155 |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($1); |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($1); |
5156 |
|
|
5157 |
unless (length $token->{data}) { |
unless (length $token->{data}) { |
5158 |
|
!!!cp ('t310'); |
5159 |
!!!next-token; |
!!!next-token; |
5160 |
redo B; |
redo B; |
5161 |
} |
} |
5163 |
|
|
5164 |
if ($token->{data} =~ s/^[^\x09\x0A\x0B\x0C\x20]+//) { |
if ($token->{data} =~ s/^[^\x09\x0A\x0B\x0C\x20]+//) { |
5165 |
if ($self->{insertion_mode} == IN_FRAMESET_IM) { |
if ($self->{insertion_mode} == IN_FRAMESET_IM) { |
5166 |
|
!!!cp ('t311'); |
5167 |
!!!parse-error (type => 'in frameset:#character'); |
!!!parse-error (type => 'in frameset:#character'); |
5168 |
} elsif ($self->{insertion_mode} == AFTER_FRAMESET_IM) { |
} elsif ($self->{insertion_mode} == AFTER_FRAMESET_IM) { |
5169 |
|
!!!cp ('t312'); |
5170 |
!!!parse-error (type => 'after frameset:#character'); |
!!!parse-error (type => 'after frameset:#character'); |
5171 |
} else { # "after html frameset" |
} else { # "after html frameset" |
5172 |
|
!!!cp ('t313'); |
5173 |
!!!parse-error (type => 'after html:#character'); |
!!!parse-error (type => 'after html:#character'); |
5174 |
|
|
5175 |
$self->{insertion_mode} = AFTER_FRAMESET_IM; |
$self->{insertion_mode} = AFTER_FRAMESET_IM; |
5179 |
|
|
5180 |
## Ignore the token. |
## Ignore the token. |
5181 |
if (length $token->{data}) { |
if (length $token->{data}) { |
5182 |
|
!!!cp ('t314'); |
5183 |
## reprocess the rest of characters |
## reprocess the rest of characters |
5184 |
} else { |
} else { |
5185 |
|
!!!cp ('t315'); |
5186 |
!!!next-token; |
!!!next-token; |
5187 |
} |
} |
5188 |
redo B; |
redo B; |
5191 |
die qq[$0: Character "$token->{data}"]; |
die qq[$0: Character "$token->{data}"]; |
5192 |
} elsif ($token->{type} == START_TAG_TOKEN) { |
} elsif ($token->{type} == START_TAG_TOKEN) { |
5193 |
if ($self->{insertion_mode} == AFTER_HTML_FRAMESET_IM) { |
if ($self->{insertion_mode} == AFTER_HTML_FRAMESET_IM) { |
5194 |
|
!!!cp ('t316'); |
5195 |
!!!parse-error (type => 'after html:'.$token->{tag_name}); |
!!!parse-error (type => 'after html:'.$token->{tag_name}); |
5196 |
|
|
5197 |
$self->{insertion_mode} = AFTER_FRAMESET_IM; |
$self->{insertion_mode} = AFTER_FRAMESET_IM; |
5198 |
## Process in the "main" phase, "after frameset" insertion mode... |
## Process in the "main" phase, "after frameset" insertion mode... |
5199 |
} |
} else { |
5200 |
|
!!!cp ('t317'); |
5201 |
|
} |
5202 |
|
|
5203 |
if ($token->{tag_name} eq 'frameset' and |
if ($token->{tag_name} eq 'frameset' and |
5204 |
$self->{insertion_mode} == IN_FRAMESET_IM) { |
$self->{insertion_mode} == IN_FRAMESET_IM) { |
5205 |
|
!!!cp ('t318'); |
5206 |
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
5207 |
!!!next-token; |
!!!next-token; |
5208 |
redo B; |
redo B; |
5209 |
} elsif ($token->{tag_name} eq 'frame' and |
} elsif ($token->{tag_name} eq 'frame' and |
5210 |
$self->{insertion_mode} == IN_FRAMESET_IM) { |
$self->{insertion_mode} == IN_FRAMESET_IM) { |
5211 |
|
!!!cp ('t319'); |
5212 |
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
5213 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
5214 |
!!!next-token; |
!!!next-token; |
5215 |
redo B; |
redo B; |
5216 |
} elsif ($token->{tag_name} eq 'noframes') { |
} elsif ($token->{tag_name} eq 'noframes') { |
5217 |
|
!!!cp ('t320'); |
5218 |
## NOTE: As if in body. |
## NOTE: As if in body. |
5219 |
$parse_rcdata->(CDATA_CONTENT_MODEL, $insert_to_current); |
$parse_rcdata->(CDATA_CONTENT_MODEL, $insert_to_current); |
5220 |
redo B; |
redo B; |
5221 |
} else { |
} else { |
5222 |
if ($self->{insertion_mode} == IN_FRAMESET_IM) { |
if ($self->{insertion_mode} == IN_FRAMESET_IM) { |
5223 |
|
!!!cp ('t321'); |
5224 |
!!!parse-error (type => 'in frameset:'.$token->{tag_name}); |
!!!parse-error (type => 'in frameset:'.$token->{tag_name}); |
5225 |
} else { |
} else { |
5226 |
|
!!!cp ('t322'); |
5227 |
!!!parse-error (type => 'after frameset:'.$token->{tag_name}); |
!!!parse-error (type => 'after frameset:'.$token->{tag_name}); |
5228 |
} |
} |
5229 |
## Ignore the token |
## Ignore the token |
5232 |
} |
} |
5233 |
} elsif ($token->{type} == END_TAG_TOKEN) { |
} elsif ($token->{type} == END_TAG_TOKEN) { |
5234 |
if ($self->{insertion_mode} == AFTER_HTML_FRAMESET_IM) { |
if ($self->{insertion_mode} == AFTER_HTML_FRAMESET_IM) { |
5235 |
|
!!!cp ('t323'); |
5236 |
!!!parse-error (type => 'after html:/'.$token->{tag_name}); |
!!!parse-error (type => 'after html:/'.$token->{tag_name}); |
5237 |
|
|
5238 |
$self->{insertion_mode} = AFTER_FRAMESET_IM; |
$self->{insertion_mode} = AFTER_FRAMESET_IM; |
5239 |
## Process in the "main" phase, "after frameset" insertion mode... |
## Process in the "main" phase, "after frameset" insertion mode... |
5240 |
|
} else { |
5241 |
|
!!!cp ('t324'); |
5242 |
} |
} |
5243 |
|
|
5244 |
if ($token->{tag_name} eq 'frameset' and |
if ($token->{tag_name} eq 'frameset' and |
5245 |
$self->{insertion_mode} == IN_FRAMESET_IM) { |
$self->{insertion_mode} == IN_FRAMESET_IM) { |
5246 |
if ($self->{open_elements}->[-1]->[1] eq 'html' and |
if ($self->{open_elements}->[-1]->[1] eq 'html' and |
5247 |
@{$self->{open_elements}} == 1) { |
@{$self->{open_elements}} == 1) { |
5248 |
|
!!!cp ('t325'); |
5249 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
5250 |
## Ignore the token |
## Ignore the token |
5251 |
!!!next-token; |
!!!next-token; |
5252 |
} else { |
} else { |
5253 |
|
!!!cp ('t326'); |
5254 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
5255 |
!!!next-token; |
!!!next-token; |
5256 |
} |
} |
5257 |
|
|
5258 |
if (not defined $self->{inner_html_node} and |
if (not defined $self->{inner_html_node} and |
5259 |
$self->{open_elements}->[-1]->[1] ne 'frameset') { |
$self->{open_elements}->[-1]->[1] ne 'frameset') { |
5260 |
|
!!!cp ('t327'); |
5261 |
$self->{insertion_mode} = AFTER_FRAMESET_IM; |
$self->{insertion_mode} = AFTER_FRAMESET_IM; |
5262 |
|
} else { |
5263 |
|
!!!cp ('t328'); |
5264 |
} |
} |
5265 |
redo B; |
redo B; |
5266 |
} elsif ($token->{tag_name} eq 'html' and |
} elsif ($token->{tag_name} eq 'html' and |
5267 |
$self->{insertion_mode} == AFTER_FRAMESET_IM) { |
$self->{insertion_mode} == AFTER_FRAMESET_IM) { |
5268 |
|
!!!cp ('t329'); |
5269 |
$self->{insertion_mode} = AFTER_HTML_FRAMESET_IM; |
$self->{insertion_mode} = AFTER_HTML_FRAMESET_IM; |
5270 |
!!!next-token; |
!!!next-token; |
5271 |
redo B; |
redo B; |
5272 |
} else { |
} else { |
5273 |
if ($self->{insertion_mode} == IN_FRAMESET_IM) { |
if ($self->{insertion_mode} == IN_FRAMESET_IM) { |
5274 |
|
!!!cp ('t330'); |
5275 |
!!!parse-error (type => 'in frameset:/'.$token->{tag_name}); |
!!!parse-error (type => 'in frameset:/'.$token->{tag_name}); |
5276 |
} else { |
} else { |
5277 |
|
!!!cp ('t331'); |
5278 |
!!!parse-error (type => 'after frameset:/'.$token->{tag_name}); |
!!!parse-error (type => 'after frameset:/'.$token->{tag_name}); |
5279 |
} |
} |
5280 |
## Ignore the token |
## Ignore the token |
5293 |
## "in body" insertion mode |
## "in body" insertion mode |
5294 |
if ($token->{type} == START_TAG_TOKEN) { |
if ($token->{type} == START_TAG_TOKEN) { |
5295 |
if ($token->{tag_name} eq 'script') { |
if ($token->{tag_name} eq 'script') { |
5296 |
|
!!!cp ('t332'); |
5297 |
## NOTE: This is an "as if in head" code clone |
## NOTE: This is an "as if in head" code clone |
5298 |
$script_start_tag->($insert); |
$script_start_tag->($insert); |
5299 |
redo B; |
redo B; |
5300 |
} elsif ($token->{tag_name} eq 'style') { |
} elsif ($token->{tag_name} eq 'style') { |
5301 |
|
!!!cp ('t333'); |
5302 |
## NOTE: This is an "as if in head" code clone |
## NOTE: This is an "as if in head" code clone |
5303 |
$parse_rcdata->(CDATA_CONTENT_MODEL, $insert); |
$parse_rcdata->(CDATA_CONTENT_MODEL, $insert); |
5304 |
redo B; |
redo B; |
5305 |
} elsif ({ |
} elsif ({ |
5306 |
base => 1, link => 1, |
base => 1, link => 1, |
5307 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
5308 |
|
!!!cp ('t334'); |
5309 |
## NOTE: This is an "as if in head" code clone, only "-t" differs |
## NOTE: This is an "as if in head" code clone, only "-t" differs |
5310 |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
5311 |
pop @{$self->{open_elements}}; ## ISSUE: This step is missing in the spec. |
pop @{$self->{open_elements}}; ## ISSUE: This step is missing in the spec. |
5318 |
|
|
5319 |
unless ($self->{confident}) { |
unless ($self->{confident}) { |
5320 |
if ($token->{attributes}->{charset}) { ## TODO: And if supported |
if ($token->{attributes}->{charset}) { ## TODO: And if supported |
5321 |
|
!!!cp ('t335'); |
5322 |
$self->{change_encoding} |
$self->{change_encoding} |
5323 |
->($self, $token->{attributes}->{charset}->{value}); |
->($self, $token->{attributes}->{charset}->{value}); |
5324 |
|
|
5333 |
[\x09-\x0D\x20]*= |
[\x09-\x0D\x20]*= |
5334 |
[\x09-\x0D\x20]*(?>"([^"]*)"|'([^']*)'| |
[\x09-\x0D\x20]*(?>"([^"]*)"|'([^']*)'| |
5335 |
([^"'\x09-\x0D\x20][^\x09-\x0D\x20]*))/x) { |
([^"'\x09-\x0D\x20][^\x09-\x0D\x20]*))/x) { |
5336 |
|
!!!cp ('t336'); |
5337 |
$self->{change_encoding} |
$self->{change_encoding} |
5338 |
->($self, defined $1 ? $1 : defined $2 ? $2 : $3); |
->($self, defined $1 ? $1 : defined $2 ? $2 : $3); |
5339 |
$meta_el->[0]->get_attribute_node_ns (undef, 'content') |
$meta_el->[0]->get_attribute_node_ns (undef, 'content') |
5344 |
} |
} |
5345 |
} else { |
} else { |
5346 |
if ($token->{attributes}->{charset}) { |
if ($token->{attributes}->{charset}) { |
5347 |
|
!!!cp ('t337'); |
5348 |
$meta_el->[0]->get_attribute_node_ns (undef, 'charset') |
$meta_el->[0]->get_attribute_node_ns (undef, 'charset') |
5349 |
->set_user_data (manakai_has_reference => |
->set_user_data (manakai_has_reference => |
5350 |
$token->{attributes}->{charset} |
$token->{attributes}->{charset} |
5351 |
->{has_reference}); |
->{has_reference}); |
5352 |
} |
} |
5353 |
if ($token->{attributes}->{content}) { |
if ($token->{attributes}->{content}) { |
5354 |
|
!!!cp ('t338'); |
5355 |
$meta_el->[0]->get_attribute_node_ns (undef, 'content') |
$meta_el->[0]->get_attribute_node_ns (undef, 'content') |
5356 |
->set_user_data (manakai_has_reference => |
->set_user_data (manakai_has_reference => |
5357 |
$token->{attributes}->{content} |
$token->{attributes}->{content} |
5362 |
!!!next-token; |
!!!next-token; |
5363 |
redo B; |
redo B; |
5364 |
} elsif ($token->{tag_name} eq 'title') { |
} elsif ($token->{tag_name} eq 'title') { |
5365 |
|
!!!cp ('t341'); |
5366 |
!!!parse-error (type => 'in body:title'); |
!!!parse-error (type => 'in body:title'); |
5367 |
## NOTE: This is an "as if in head" code clone |
## NOTE: This is an "as if in head" code clone |
5368 |
$parse_rcdata->(RCDATA_CONTENT_MODEL, sub { |
$parse_rcdata->(RCDATA_CONTENT_MODEL, sub { |
5369 |
if (defined $self->{head_element}) { |
if (defined $self->{head_element}) { |
5370 |
|
!!!cp ('t339'); |
5371 |
$self->{head_element}->append_child ($_[0]); |
$self->{head_element}->append_child ($_[0]); |
5372 |
} else { |
} else { |
5373 |
|
!!!cp ('t340'); |
5374 |
$insert->($_[0]); |
$insert->($_[0]); |
5375 |
} |
} |
5376 |
}); |
}); |
5380 |
|
|
5381 |
if (@{$self->{open_elements}} == 1 or |
if (@{$self->{open_elements}} == 1 or |
5382 |
$self->{open_elements}->[1]->[1] ne 'body') { |
$self->{open_elements}->[1]->[1] ne 'body') { |
5383 |
|
!!!cp ('t342'); |
5384 |
## Ignore the token |
## Ignore the token |
5385 |
} else { |
} else { |
5386 |
my $body_el = $self->{open_elements}->[1]->[0]; |
my $body_el = $self->{open_elements}->[1]->[0]; |
5387 |
for my $attr_name (keys %{$token->{attributes}}) { |
for my $attr_name (keys %{$token->{attributes}}) { |
5388 |
unless ($body_el->has_attribute_ns (undef, $attr_name)) { |
unless ($body_el->has_attribute_ns (undef, $attr_name)) { |
5389 |
|
!!!cp ('t343'); |
5390 |
$body_el->set_attribute_ns |
$body_el->set_attribute_ns |
5391 |
(undef, [undef, $attr_name], |
(undef, [undef, $attr_name], |
5392 |
$token->{attributes}->{$attr_name}->{value}); |
$token->{attributes}->{$attr_name}->{value}); |
5404 |
## has a p element in scope |
## has a p element in scope |
5405 |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
5406 |
if ($_->[1] eq 'p') { |
if ($_->[1] eq 'p') { |
5407 |
|
!!!cp ('t344'); |
5408 |
!!!back-token; |
!!!back-token; |
5409 |
$token = {type => END_TAG_TOKEN, tag_name => 'p'}; |
$token = {type => END_TAG_TOKEN, tag_name => 'p'}; |
5410 |
redo B; |
redo B; |
5412 |
table => 1, caption => 1, td => 1, th => 1, |
table => 1, caption => 1, td => 1, th => 1, |
5413 |
button => 1, marquee => 1, object => 1, html => 1, |
button => 1, marquee => 1, object => 1, html => 1, |
5414 |
}->{$_->[1]}) { |
}->{$_->[1]}) { |
5415 |
|
!!!cp ('t345'); |
5416 |
last INSCOPE; |
last INSCOPE; |
5417 |
} |
} |
5418 |
} # INSCOPE |
} # INSCOPE |
5423 |
if ($token->{type} == CHARACTER_TOKEN) { |
if ($token->{type} == CHARACTER_TOKEN) { |
5424 |
$token->{data} =~ s/^\x0A//; |
$token->{data} =~ s/^\x0A//; |
5425 |
unless (length $token->{data}) { |
unless (length $token->{data}) { |
5426 |
|
!!!cp ('t346'); |
5427 |
!!!next-token; |
!!!next-token; |
5428 |
|
} else { |
5429 |
|
!!!cp ('t349'); |
5430 |
} |
} |
5431 |
|
} else { |
5432 |
|
!!!cp ('t348'); |
5433 |
} |
} |
5434 |
} else { |
} else { |
5435 |
|
!!!cp ('t347'); |
5436 |
!!!next-token; |
!!!next-token; |
5437 |
} |
} |
5438 |
redo B; |
redo B; |
5439 |
} elsif ($token->{tag_name} eq 'form') { |
} elsif ($token->{tag_name} eq 'form') { |
5440 |
if (defined $self->{form_element}) { |
if (defined $self->{form_element}) { |
5441 |
|
!!!cp ('t350'); |
5442 |
!!!parse-error (type => 'in form:form'); |
!!!parse-error (type => 'in form:form'); |
5443 |
## Ignore the token |
## Ignore the token |
5444 |
!!!next-token; |
!!!next-token; |
5447 |
## has a p element in scope |
## has a p element in scope |
5448 |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
5449 |
if ($_->[1] eq 'p') { |
if ($_->[1] eq 'p') { |
5450 |
|
!!!cp ('t351'); |
5451 |
!!!back-token; |
!!!back-token; |
5452 |
$token = {type => END_TAG_TOKEN, tag_name => 'p'}; |
$token = {type => END_TAG_TOKEN, tag_name => 'p'}; |
5453 |
redo B; |
redo B; |
5455 |
table => 1, caption => 1, td => 1, th => 1, |
table => 1, caption => 1, td => 1, th => 1, |
5456 |
button => 1, marquee => 1, object => 1, html => 1, |
button => 1, marquee => 1, object => 1, html => 1, |
5457 |
}->{$_->[1]}) { |
}->{$_->[1]}) { |
5458 |
|
!!!cp ('t352'); |
5459 |
last INSCOPE; |
last INSCOPE; |
5460 |
} |
} |
5461 |
} # INSCOPE |
} # INSCOPE |
5469 |
## has a p element in scope |
## has a p element in scope |
5470 |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
5471 |
if ($_->[1] eq 'p') { |
if ($_->[1] eq 'p') { |
5472 |
|
!!!cp ('t353'); |
5473 |
!!!back-token; |
!!!back-token; |
5474 |
$token = {type => END_TAG_TOKEN, tag_name => 'p'}; |
$token = {type => END_TAG_TOKEN, tag_name => 'p'}; |
5475 |
redo B; |
redo B; |
5477 |
table => 1, caption => 1, td => 1, th => 1, |
table => 1, caption => 1, td => 1, th => 1, |
5478 |
button => 1, marquee => 1, object => 1, html => 1, |
button => 1, marquee => 1, object => 1, html => 1, |
5479 |
}->{$_->[1]}) { |
}->{$_->[1]}) { |
5480 |
|
!!!cp ('t354'); |
5481 |
last INSCOPE; |
last INSCOPE; |
5482 |
} |
} |
5483 |
} # INSCOPE |
} # INSCOPE |
5489 |
## Step 2 |
## Step 2 |
5490 |
if ($node->[1] eq 'li') { |
if ($node->[1] eq 'li') { |
5491 |
if ($i != -1) { |
if ($i != -1) { |
5492 |
|
!!!cp ('t355'); |
5493 |
!!!parse-error (type => 'end tag missing:'. |
!!!parse-error (type => 'end tag missing:'. |
5494 |
$self->{open_elements}->[-1]->[1]); |
$self->{open_elements}->[-1]->[1]); |
5495 |
|
} else { |
5496 |
|
!!!cp ('t356'); |
5497 |
} |
} |
5498 |
splice @{$self->{open_elements}}, $i; |
splice @{$self->{open_elements}}, $i; |
5499 |
last LI; |
last LI; |
5500 |
|
} else { |
5501 |
|
!!!cp ('t357'); |
5502 |
} |
} |
5503 |
|
|
5504 |
## Step 3 |
## Step 3 |
5507 |
($special_category->{$node->[1]} or |
($special_category->{$node->[1]} or |
5508 |
$scoping_category->{$node->[1]}) and |
$scoping_category->{$node->[1]}) and |
5509 |
$node->[1] ne 'address' and $node->[1] ne 'div') { |
$node->[1] ne 'address' and $node->[1] ne 'div') { |
5510 |
|
!!!cp ('t358'); |
5511 |
last LI; |
last LI; |
5512 |
} |
} |
5513 |
|
|
5514 |
|
!!!cp ('t359'); |
5515 |
## Step 4 |
## Step 4 |
5516 |
$i--; |
$i--; |
5517 |
$node = $self->{open_elements}->[$i]; |
$node = $self->{open_elements}->[$i]; |
5525 |
## has a p element in scope |
## has a p element in scope |
5526 |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
5527 |
if ($_->[1] eq 'p') { |
if ($_->[1] eq 'p') { |
5528 |
|
!!!cp ('t360'); |
5529 |
!!!back-token; |
!!!back-token; |
5530 |
$token = {type => END_TAG_TOKEN, tag_name => 'p'}; |
$token = {type => END_TAG_TOKEN, tag_name => 'p'}; |
5531 |
redo B; |
redo B; |
5533 |
table => 1, caption => 1, td => 1, th => 1, |
table => 1, caption => 1, td => 1, th => 1, |
5534 |
button => 1, marquee => 1, object => 1, html => 1, |
button => 1, marquee => 1, object => 1, html => 1, |
5535 |
}->{$_->[1]}) { |
}->{$_->[1]}) { |
5536 |
|
!!!cp ('t361'); |
5537 |
last INSCOPE; |
last INSCOPE; |
5538 |
} |
} |
5539 |
} # INSCOPE |
} # INSCOPE |
5545 |
## Step 2 |
## Step 2 |
5546 |
if ($node->[1] eq 'dt' or $node->[1] eq 'dd') { |
if ($node->[1] eq 'dt' or $node->[1] eq 'dd') { |
5547 |
if ($i != -1) { |
if ($i != -1) { |
5548 |
|
!!!cp ('t362'); |
5549 |
!!!parse-error (type => 'end tag missing:'. |
!!!parse-error (type => 'end tag missing:'. |
5550 |
$self->{open_elements}->[-1]->[1]); |
$self->{open_elements}->[-1]->[1]); |
5551 |
|
} else { |
5552 |
|
!!!cp ('t363'); |
5553 |
} |
} |
5554 |
splice @{$self->{open_elements}}, $i; |
splice @{$self->{open_elements}}, $i; |
5555 |
last LI; |
last LI; |
5556 |
|
} else { |
5557 |
|
!!!cp ('t364'); |
5558 |
} |
} |
5559 |
|
|
5560 |
## Step 3 |
## Step 3 |
5563 |
($special_category->{$node->[1]} or |
($special_category->{$node->[1]} or |
5564 |
$scoping_category->{$node->[1]}) and |
$scoping_category->{$node->[1]}) and |
5565 |
$node->[1] ne 'address' and $node->[1] ne 'div') { |
$node->[1] ne 'address' and $node->[1] ne 'div') { |
5566 |
|
!!!cp ('t365'); |
5567 |
last LI; |
last LI; |
5568 |
} |
} |
5569 |
|
|
5570 |
|
!!!cp ('t366'); |
5571 |
## Step 4 |
## Step 4 |
5572 |
$i--; |
$i--; |
5573 |
$node = $self->{open_elements}->[$i]; |
$node = $self->{open_elements}->[$i]; |
5581 |
## has a p element in scope |
## has a p element in scope |
5582 |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
5583 |
if ($_->[1] eq 'p') { |
if ($_->[1] eq 'p') { |
5584 |
|
!!!cp ('t367'); |
5585 |
!!!back-token; |
!!!back-token; |
5586 |
$token = {type => END_TAG_TOKEN, tag_name => 'p'}; |
$token = {type => END_TAG_TOKEN, tag_name => 'p'}; |
5587 |
redo B; |
redo B; |
5589 |
table => 1, caption => 1, td => 1, th => 1, |
table => 1, caption => 1, td => 1, th => 1, |
5590 |
button => 1, marquee => 1, object => 1, html => 1, |
button => 1, marquee => 1, object => 1, html => 1, |
5591 |
}->{$_->[1]}) { |
}->{$_->[1]}) { |
5592 |
|
!!!cp ('t368'); |
5593 |
last INSCOPE; |
last INSCOPE; |
5594 |
} |
} |
5595 |
} # INSCOPE |
} # INSCOPE |
5607 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
5608 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
5609 |
if ($node->[1] eq 'p') { |
if ($node->[1] eq 'p') { |
5610 |
|
!!!cp ('t369'); |
5611 |
!!!back-token; |
!!!back-token; |
5612 |
$token = {type => END_TAG_TOKEN, tag_name => 'p'}; |
$token = {type => END_TAG_TOKEN, tag_name => 'p'}; |
5613 |
redo B; |
redo B; |
5615 |
table => 1, caption => 1, td => 1, th => 1, |
table => 1, caption => 1, td => 1, th => 1, |
5616 |
button => 1, marquee => 1, object => 1, html => 1, |
button => 1, marquee => 1, object => 1, html => 1, |
5617 |
}->{$node->[1]}) { |
}->{$node->[1]}) { |
5618 |
|
!!!cp ('t370'); |
5619 |
last INSCOPE; |
last INSCOPE; |
5620 |
} |
} |
5621 |
} # INSCOPE |
} # INSCOPE |
5651 |
AFE: for my $i (reverse 0..$#$active_formatting_elements) { |
AFE: for my $i (reverse 0..$#$active_formatting_elements) { |
5652 |
my $node = $active_formatting_elements->[$i]; |
my $node = $active_formatting_elements->[$i]; |
5653 |
if ($node->[1] eq 'a') { |
if ($node->[1] eq 'a') { |
5654 |
|
!!!cp ('t371'); |
5655 |
!!!parse-error (type => 'in a:a'); |
!!!parse-error (type => 'in a:a'); |
5656 |
|
|
5657 |
!!!back-token; |
!!!back-token; |
5660 |
|
|
5661 |
AFE2: for (reverse 0..$#$active_formatting_elements) { |
AFE2: for (reverse 0..$#$active_formatting_elements) { |
5662 |
if ($active_formatting_elements->[$_]->[0] eq $node->[0]) { |
if ($active_formatting_elements->[$_]->[0] eq $node->[0]) { |
5663 |
|
!!!cp ('t372'); |
5664 |
splice @$active_formatting_elements, $_, 1; |
splice @$active_formatting_elements, $_, 1; |
5665 |
last AFE2; |
last AFE2; |
5666 |
} |
} |
5667 |
} # AFE2 |
} # AFE2 |
5668 |
OE: for (reverse 0..$#{$self->{open_elements}}) { |
OE: for (reverse 0..$#{$self->{open_elements}}) { |
5669 |
if ($self->{open_elements}->[$_]->[0] eq $node->[0]) { |
if ($self->{open_elements}->[$_]->[0] eq $node->[0]) { |
5670 |
|
!!!cp ('t373'); |
5671 |
splice @{$self->{open_elements}}, $_, 1; |
splice @{$self->{open_elements}}, $_, 1; |
5672 |
last OE; |
last OE; |
5673 |
} |
} |
5674 |
} # OE |
} # OE |
5675 |
last AFE; |
last AFE; |
5676 |
} elsif ($node->[0] eq '#marker') { |
} elsif ($node->[0] eq '#marker') { |
5677 |
|
!!!cp ('t374'); |
5678 |
last AFE; |
last AFE; |
5679 |
} |
} |
5680 |
} # AFE |
} # AFE |
5691 |
s => 1, small => 1, strile => 1, |
s => 1, small => 1, strile => 1, |
5692 |
strong => 1, tt => 1, u => 1, |
strong => 1, tt => 1, u => 1, |
5693 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
5694 |
|
!!!cp ('t375'); |
5695 |
$reconstruct_active_formatting_elements->($insert_to_current); |
$reconstruct_active_formatting_elements->($insert_to_current); |
5696 |
|
|
5697 |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
5706 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
5707 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
5708 |
if ($node->[1] eq 'nobr') { |
if ($node->[1] eq 'nobr') { |
5709 |
|
!!!cp ('t376'); |
5710 |
!!!parse-error (type => 'in nobr:nobr'); |
!!!parse-error (type => 'in nobr:nobr'); |
5711 |
!!!back-token; |
!!!back-token; |
5712 |
$token = {type => END_TAG_TOKEN, tag_name => 'nobr'}; |
$token = {type => END_TAG_TOKEN, tag_name => 'nobr'}; |
5715 |
table => 1, caption => 1, td => 1, th => 1, |
table => 1, caption => 1, td => 1, th => 1, |
5716 |
button => 1, marquee => 1, object => 1, html => 1, |
button => 1, marquee => 1, object => 1, html => 1, |
5717 |
}->{$node->[1]}) { |
}->{$node->[1]}) { |
5718 |
|
!!!cp ('t377'); |
5719 |
last INSCOPE; |
last INSCOPE; |
5720 |
} |
} |
5721 |
} # INSCOPE |
} # INSCOPE |
5730 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
5731 |
my $node = $self->{open_elements}->[$_]; |
my $node = $self->{open_elements}->[$_]; |
5732 |
if ($node->[1] eq 'button') { |
if ($node->[1] eq 'button') { |
5733 |
|
!!!cp ('t378'); |
5734 |
!!!parse-error (type => 'in button:button'); |
!!!parse-error (type => 'in button:button'); |
5735 |
!!!back-token; |
!!!back-token; |
5736 |
$token = {type => END_TAG_TOKEN, tag_name => 'button'}; |
$token = {type => END_TAG_TOKEN, tag_name => 'button'}; |
5739 |
table => 1, caption => 1, td => 1, th => 1, |
table => 1, caption => 1, td => 1, th => 1, |
5740 |
button => 1, marquee => 1, object => 1, html => 1, |
button => 1, marquee => 1, object => 1, html => 1, |
5741 |
}->{$node->[1]}) { |
}->{$node->[1]}) { |
5742 |
|
!!!cp ('t379'); |
5743 |
last INSCOPE; |
last INSCOPE; |
5744 |
} |
} |
5745 |
} # INSCOPE |
} # INSCOPE |
5753 |
redo B; |
redo B; |
5754 |
} elsif ($token->{tag_name} eq 'marquee' or |
} elsif ($token->{tag_name} eq 'marquee' or |
5755 |
$token->{tag_name} eq 'object') { |
$token->{tag_name} eq 'object') { |
5756 |
|
!!!cp ('t380'); |
5757 |
$reconstruct_active_formatting_elements->($insert_to_current); |
$reconstruct_active_formatting_elements->($insert_to_current); |
5758 |
|
|
5759 |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
5762 |
!!!next-token; |
!!!next-token; |
5763 |
redo B; |
redo B; |
5764 |
} elsif ($token->{tag_name} eq 'xmp') { |
} elsif ($token->{tag_name} eq 'xmp') { |
5765 |
|
!!!cp ('t381'); |
5766 |
$reconstruct_active_formatting_elements->($insert_to_current); |
$reconstruct_active_formatting_elements->($insert_to_current); |
5767 |
$parse_rcdata->(CDATA_CONTENT_MODEL, $insert); |
$parse_rcdata->(CDATA_CONTENT_MODEL, $insert); |
5768 |
redo B; |
redo B; |
5770 |
## has a p element in scope |
## has a p element in scope |
5771 |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
5772 |
if ($_->[1] eq 'p') { |
if ($_->[1] eq 'p') { |
5773 |
|
!!!cp ('t382'); |
5774 |
!!!back-token; |
!!!back-token; |
5775 |
$token = {type => END_TAG_TOKEN, tag_name => 'p'}; |
$token = {type => END_TAG_TOKEN, tag_name => 'p'}; |
5776 |
redo B; |
redo B; |
5778 |
table => 1, caption => 1, td => 1, th => 1, |
table => 1, caption => 1, td => 1, th => 1, |
5779 |
button => 1, marquee => 1, object => 1, html => 1, |
button => 1, marquee => 1, object => 1, html => 1, |
5780 |
}->{$_->[1]}) { |
}->{$_->[1]}) { |
5781 |
|
!!!cp ('t383'); |
5782 |
last INSCOPE; |
last INSCOPE; |
5783 |
} |
} |
5784 |
} # INSCOPE |
} # INSCOPE |
5795 |
image => 1, |
image => 1, |
5796 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
5797 |
if ($token->{tag_name} eq 'image') { |
if ($token->{tag_name} eq 'image') { |
5798 |
|
!!!cp ('t384'); |
5799 |
!!!parse-error (type => 'image'); |
!!!parse-error (type => 'image'); |
5800 |
$token->{tag_name} = 'img'; |
$token->{tag_name} = 'img'; |
5801 |
|
} else { |
5802 |
|
!!!cp ('t385'); |
5803 |
} |
} |
5804 |
|
|
5805 |
## NOTE: There is an "as if <br>" code clone. |
## NOTE: There is an "as if <br>" code clone. |
5814 |
## has a p element in scope |
## has a p element in scope |
5815 |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
INSCOPE: for (reverse @{$self->{open_elements}}) { |
5816 |
if ($_->[1] eq 'p') { |
if ($_->[1] eq 'p') { |
5817 |
|
!!!cp ('t386'); |
5818 |
!!!back-token; |
!!!back-token; |
5819 |
$token = {type => END_TAG_TOKEN, tag_name => 'p'}; |
$token = {type => END_TAG_TOKEN, tag_name => 'p'}; |
5820 |
redo B; |
redo B; |
5822 |
table => 1, caption => 1, td => 1, th => 1, |
table => 1, caption => 1, td => 1, th => 1, |
5823 |
button => 1, marquee => 1, object => 1, html => 1, |
button => 1, marquee => 1, object => 1, html => 1, |
5824 |
}->{$_->[1]}) { |
}->{$_->[1]}) { |
5825 |
|
!!!cp ('t387'); |
5826 |
last INSCOPE; |
last INSCOPE; |
5827 |
} |
} |
5828 |
} # INSCOPE |
} # INSCOPE |
5833 |
!!!next-token; |
!!!next-token; |
5834 |
redo B; |
redo B; |
5835 |
} elsif ($token->{tag_name} eq 'input') { |
} elsif ($token->{tag_name} eq 'input') { |
5836 |
|
!!!cp ('t388'); |
5837 |
$reconstruct_active_formatting_elements->($insert_to_current); |
$reconstruct_active_formatting_elements->($insert_to_current); |
5838 |
|
|
5839 |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
5846 |
!!!parse-error (type => 'isindex'); |
!!!parse-error (type => 'isindex'); |
5847 |
|
|
5848 |
if (defined $self->{form_element}) { |
if (defined $self->{form_element}) { |
5849 |
|
!!!cp ('t389'); |
5850 |
## Ignore the token |
## Ignore the token |
5851 |
!!!next-token; |
!!!next-token; |
5852 |
redo B; |
redo B; |
5866 |
{type => START_TAG_TOKEN, tag_name => 'label'}, |
{type => START_TAG_TOKEN, tag_name => 'label'}, |
5867 |
); |
); |
5868 |
if ($prompt_attr) { |
if ($prompt_attr) { |
5869 |
|
!!!cp ('t390'); |
5870 |
push @tokens, {type => CHARACTER_TOKEN, data => $prompt_attr->{value}}; |
push @tokens, {type => CHARACTER_TOKEN, data => $prompt_attr->{value}}; |
5871 |
} else { |
} else { |
5872 |
|
!!!cp ('t391'); |
5873 |
push @tokens, {type => CHARACTER_TOKEN, |
push @tokens, {type => CHARACTER_TOKEN, |
5874 |
data => 'This is a searchable index. Insert your search keywords here: '}; # SHOULD |
data => 'This is a searchable index. Insert your search keywords here: '}; # SHOULD |
5875 |
## TODO: make this configurable |
## TODO: make this configurable |
5901 |
if ($token->{type} == CHARACTER_TOKEN) { |
if ($token->{type} == CHARACTER_TOKEN) { |
5902 |
$token->{data} =~ s/^\x0A//; |
$token->{data} =~ s/^\x0A//; |
5903 |
unless (length $token->{data}) { |
unless (length $token->{data}) { |
5904 |
|
!!!cp ('t392'); |
5905 |
!!!next-token; |
!!!next-token; |
5906 |
|
} else { |
5907 |
|
!!!cp ('t393'); |
5908 |
} |
} |
5909 |
|
} else { |
5910 |
|
!!!cp ('t394'); |
5911 |
} |
} |
5912 |
while ($token->{type} == CHARACTER_TOKEN) { |
while ($token->{type} == CHARACTER_TOKEN) { |
5913 |
|
!!!cp ('t395'); |
5914 |
$text .= $token->{data}; |
$text .= $token->{data}; |
5915 |
!!!next-token; |
!!!next-token; |
5916 |
} |
} |
5917 |
if (length $text) { |
if (length $text) { |
5918 |
|
!!!cp ('t396'); |
5919 |
$el->manakai_append_text ($text); |
$el->manakai_append_text ($text); |
5920 |
} |
} |
5921 |
|
|
5923 |
|
|
5924 |
if ($token->{type} == END_TAG_TOKEN and |
if ($token->{type} == END_TAG_TOKEN and |
5925 |
$token->{tag_name} eq $tag_name) { |
$token->{tag_name} eq $tag_name) { |
5926 |
|
!!!cp ('t397'); |
5927 |
## Ignore the token |
## Ignore the token |
5928 |
} else { |
} else { |
5929 |
|
!!!cp ('t398'); |
5930 |
!!!parse-error (type => 'in RCDATA:#'.$token->{type}); |
!!!parse-error (type => 'in RCDATA:#'.$token->{type}); |
5931 |
} |
} |
5932 |
!!!next-token; |
!!!next-token; |
5937 |
noframes => 1, |
noframes => 1, |
5938 |
noscript => 0, ## TODO: 1 if scripting is enabled |
noscript => 0, ## TODO: 1 if scripting is enabled |
5939 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
5940 |
|
!!!cp ('t399'); |
5941 |
## NOTE: There is an "as if in body" code clone. |
## NOTE: There is an "as if in body" code clone. |
5942 |
$parse_rcdata->(CDATA_CONTENT_MODEL, $insert); |
$parse_rcdata->(CDATA_CONTENT_MODEL, $insert); |
5943 |
redo B; |
redo B; |
5944 |
} elsif ($token->{tag_name} eq 'select') { |
} elsif ($token->{tag_name} eq 'select') { |
5945 |
|
!!!cp ('t400'); |
5946 |
$reconstruct_active_formatting_elements->($insert_to_current); |
$reconstruct_active_formatting_elements->($insert_to_current); |
5947 |
|
|
5948 |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
5956 |
tbody => 1, td => 1, tfoot => 1, th => 1, |
tbody => 1, td => 1, tfoot => 1, th => 1, |
5957 |
thead => 1, tr => 1, |
thead => 1, tr => 1, |
5958 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
5959 |
|
!!!cp ('t401'); |
5960 |
!!!parse-error (type => 'in body:'.$token->{tag_name}); |
!!!parse-error (type => 'in body:'.$token->{tag_name}); |
5961 |
## Ignore the token |
## Ignore the token |
5962 |
!!!next-token; |
!!!next-token; |
5964 |
|
|
5965 |
## ISSUE: An issue on HTML5 new elements in the spec. |
## ISSUE: An issue on HTML5 new elements in the spec. |
5966 |
} else { |
} else { |
5967 |
|
!!!cp ('t402'); |
5968 |
$reconstruct_active_formatting_elements->($insert_to_current); |
$reconstruct_active_formatting_elements->($insert_to_current); |
5969 |
|
|
5970 |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
5982 |
th => 1, tr => 1, body => 1, html => 1, |
th => 1, tr => 1, body => 1, html => 1, |
5983 |
tbody => 1, tfoot => 1, thead => 1, |
tbody => 1, tfoot => 1, thead => 1, |
5984 |
}->{$_->[1]}) { |
}->{$_->[1]}) { |
5985 |
|
!!!cp ('t403'); |
5986 |
!!!parse-error (type => 'not closed:'.$_->[1]); |
!!!parse-error (type => 'not closed:'.$_->[1]); |
5987 |
|
} else { |
5988 |
|
!!!cp ('t404'); |
5989 |
} |
} |
5990 |
} |
} |
5991 |
|
|
5993 |
!!!next-token; |
!!!next-token; |
5994 |
redo B; |
redo B; |
5995 |
} else { |
} else { |
5996 |
|
!!!cp ('t405'); |
5997 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
5998 |
## Ignore the token |
## Ignore the token |
5999 |
!!!next-token; |
!!!next-token; |
6003 |
if (@{$self->{open_elements}} > 1 and $self->{open_elements}->[1]->[1] eq 'body') { |
if (@{$self->{open_elements}} > 1 and $self->{open_elements}->[1]->[1] eq 'body') { |
6004 |
## ISSUE: There is an issue in the spec. |
## ISSUE: There is an issue in the spec. |
6005 |
if ($self->{open_elements}->[-1]->[1] ne 'body') { |
if ($self->{open_elements}->[-1]->[1] ne 'body') { |
6006 |
|
!!!cp ('t406'); |
6007 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[1]->[1]); |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[1]->[1]); |
6008 |
|
} else { |
6009 |
|
!!!cp ('t407'); |
6010 |
} |
} |
6011 |
$self->{insertion_mode} = AFTER_BODY_IM; |
$self->{insertion_mode} = AFTER_BODY_IM; |
6012 |
## reprocess |
## reprocess |
6013 |
redo B; |
redo B; |
6014 |
} else { |
} else { |
6015 |
|
!!!cp ('t408'); |
6016 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
6017 |
## Ignore the token |
## Ignore the token |
6018 |
!!!next-token; |
!!!next-token; |
6040 |
td => 1, th => 1, tr => 1, |
td => 1, th => 1, tr => 1, |
6041 |
tbody => 1, tfoot=> 1, thead => 1, |
tbody => 1, tfoot=> 1, thead => 1, |
6042 |
}->{$self->{open_elements}->[-1]->[1]}) { |
}->{$self->{open_elements}->[-1]->[1]}) { |
6043 |
|
!!!cp ('t409'); |
6044 |
!!!back-token; |
!!!back-token; |
6045 |
$token = {type => END_TAG_TOKEN, |
$token = {type => END_TAG_TOKEN, |
6046 |
tag_name => $self->{open_elements}->[-1]->[1]}; # MUST |
tag_name => $self->{open_elements}->[-1]->[1]}; # MUST |
6047 |
redo B; |
redo B; |
6048 |
} |
} |
6049 |
|
|
6050 |
|
!!!cp ('t410'); |
6051 |
$i = $_; |
$i = $_; |
6052 |
last INSCOPE unless $token->{tag_name} eq 'p'; |
last INSCOPE unless $token->{tag_name} eq 'p'; |
6053 |
} elsif ({ |
} elsif ({ |
6054 |
table => 1, caption => 1, td => 1, th => 1, |
table => 1, caption => 1, td => 1, th => 1, |
6055 |
button => 1, marquee => 1, object => 1, html => 1, |
button => 1, marquee => 1, object => 1, html => 1, |
6056 |
}->{$node->[1]}) { |
}->{$node->[1]}) { |
6057 |
|
!!!cp ('t411'); |
6058 |
last INSCOPE; |
last INSCOPE; |
6059 |
} |
} |
6060 |
} # INSCOPE |
} # INSCOPE |
6061 |
|
|
6062 |
if ($self->{open_elements}->[-1]->[1] ne $token->{tag_name}) { |
if ($self->{open_elements}->[-1]->[1] ne $token->{tag_name}) { |
6063 |
if (defined $i) { |
if (defined $i) { |
6064 |
|
!!!cp ('t412'); |
6065 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
6066 |
} else { |
} else { |
6067 |
|
!!!cp ('t413'); |
6068 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
6069 |
} |
} |
6070 |
} |
} |
6071 |
|
|
6072 |
if (defined $i) { |
if (defined $i) { |
6073 |
|
!!!cp ('t414'); |
6074 |
splice @{$self->{open_elements}}, $i; |
splice @{$self->{open_elements}}, $i; |
6075 |
} elsif ($token->{tag_name} eq 'p') { |
} elsif ($token->{tag_name} eq 'p') { |
6076 |
|
!!!cp ('t415'); |
6077 |
## As if <p>, then reprocess the current token |
## As if <p>, then reprocess the current token |
6078 |
my $el; |
my $el; |
6079 |
!!!create-element ($el, 'p'); |
!!!create-element ($el, 'p'); |
6080 |
$insert->($el); |
$insert->($el); |
6081 |
|
} else { |
6082 |
|
!!!cp ('t416'); |
6083 |
} |
} |
6084 |
$clear_up_to_marker->() |
$clear_up_to_marker->() |
6085 |
if { |
if { |
6098 |
td => 1, th => 1, tr => 1, |
td => 1, th => 1, tr => 1, |
6099 |
tbody => 1, tfoot=> 1, thead => 1, |
tbody => 1, tfoot=> 1, thead => 1, |
6100 |
}->{$self->{open_elements}->[-1]->[1]}) { |
}->{$self->{open_elements}->[-1]->[1]}) { |
6101 |
|
!!!cp ('t417'); |
6102 |
!!!back-token; |
!!!back-token; |
6103 |
$token = {type => END_TAG_TOKEN, |
$token = {type => END_TAG_TOKEN, |
6104 |
tag_name => $self->{open_elements}->[-1]->[1]}; # MUST |
tag_name => $self->{open_elements}->[-1]->[1]}; # MUST |
6105 |
redo B; |
redo B; |
6106 |
} |
} |
6107 |
|
|
6108 |
|
!!!cp ('t418'); |
6109 |
last INSCOPE; |
last INSCOPE; |
6110 |
} elsif ({ |
} elsif ({ |
6111 |
table => 1, caption => 1, td => 1, th => 1, |
table => 1, caption => 1, td => 1, th => 1, |
6112 |
button => 1, marquee => 1, object => 1, html => 1, |
button => 1, marquee => 1, object => 1, html => 1, |
6113 |
}->{$node->[1]}) { |
}->{$node->[1]}) { |
6114 |
|
!!!cp ('t419'); |
6115 |
last INSCOPE; |
last INSCOPE; |
6116 |
} |
} |
6117 |
} # INSCOPE |
} # INSCOPE |
6118 |
|
|
6119 |
if ($self->{open_elements}->[-1]->[1] eq $token->{tag_name}) { |
if ($self->{open_elements}->[-1]->[1] eq $token->{tag_name}) { |
6120 |
|
!!!cp ('t420'); |
6121 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
6122 |
} else { |
} else { |
6123 |
|
!!!cp ('t421'); |
6124 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
6125 |
} |
} |
6126 |
|
|
6143 |
td => 1, th => 1, tr => 1, |
td => 1, th => 1, tr => 1, |
6144 |
tbody => 1, tfoot=> 1, thead => 1, |
tbody => 1, tfoot=> 1, thead => 1, |
6145 |
}->{$self->{open_elements}->[-1]->[1]}) { |
}->{$self->{open_elements}->[-1]->[1]}) { |
6146 |
|
!!!cp ('t422'); |
6147 |
!!!back-token; |
!!!back-token; |
6148 |
$token = {type => END_TAG_TOKEN, |
$token = {type => END_TAG_TOKEN, |
6149 |
tag_name => $self->{open_elements}->[-1]->[1]}; # MUST |
tag_name => $self->{open_elements}->[-1]->[1]}; # MUST |
6150 |
redo B; |
redo B; |
6151 |
} |
} |
6152 |
|
|
6153 |
|
!!!cp ('t423'); |
6154 |
$i = $_; |
$i = $_; |
6155 |
last INSCOPE; |
last INSCOPE; |
6156 |
} elsif ({ |
} elsif ({ |
6157 |
table => 1, caption => 1, td => 1, th => 1, |
table => 1, caption => 1, td => 1, th => 1, |
6158 |
button => 1, marquee => 1, object => 1, html => 1, |
button => 1, marquee => 1, object => 1, html => 1, |
6159 |
}->{$node->[1]}) { |
}->{$node->[1]}) { |
6160 |
|
!!!cp ('t424'); |
6161 |
last INSCOPE; |
last INSCOPE; |
6162 |
} |
} |
6163 |
} # INSCOPE |
} # INSCOPE |
6164 |
|
|
6165 |
if ($self->{open_elements}->[-1]->[1] ne $token->{tag_name}) { |
if ($self->{open_elements}->[-1]->[1] ne $token->{tag_name}) { |
6166 |
|
!!!cp ('t425'); |
6167 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
6168 |
|
} else { |
6169 |
|
!!!cp ('t426'); |
6170 |
} |
} |
6171 |
|
|
6172 |
splice @{$self->{open_elements}}, $i if defined $i; |
splice @{$self->{open_elements}}, $i if defined $i; |
6178 |
nobr => 1, s => 1, small => 1, strile => 1, |
nobr => 1, s => 1, small => 1, strile => 1, |
6179 |
strong => 1, tt => 1, u => 1, |
strong => 1, tt => 1, u => 1, |
6180 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
6181 |
|
!!!cp ('t427'); |
6182 |
$formatting_end_tag->($token->{tag_name}); |
$formatting_end_tag->($token->{tag_name}); |
6183 |
redo B; |
redo B; |
6184 |
} elsif ($token->{tag_name} eq 'br') { |
} elsif ($token->{tag_name} eq 'br') { |
6185 |
|
!!!cp ('t428'); |
6186 |
!!!parse-error (type => 'unmatched end tag:br'); |
!!!parse-error (type => 'unmatched end tag:br'); |
6187 |
|
|
6188 |
## As if <br> |
## As if <br> |
6207 |
table => 1, textarea => 1, wbr => 1, |
table => 1, textarea => 1, wbr => 1, |
6208 |
noscript => 0, ## TODO: if scripting is enabled |
noscript => 0, ## TODO: if scripting is enabled |
6209 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
6210 |
|
!!!cp ('t429'); |
6211 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
6212 |
## Ignore the token |
## Ignore the token |
6213 |
!!!next-token; |
!!!next-token; |
6230 |
td => 1, th => 1, tr => 1, |
td => 1, th => 1, tr => 1, |
6231 |
tbody => 1, tfoot => 1, thead => 1, |
tbody => 1, tfoot => 1, thead => 1, |
6232 |
}->{$self->{open_elements}->[-1]->[1]}) { |
}->{$self->{open_elements}->[-1]->[1]}) { |
6233 |
|
!!!cp ('t430'); |
6234 |
!!!back-token; |
!!!back-token; |
6235 |
$token = {type => END_TAG_TOKEN, |
$token = {type => END_TAG_TOKEN, |
6236 |
tag_name => $self->{open_elements}->[-1]->[1]}; # MUST |
tag_name => $self->{open_elements}->[-1]->[1]}; # MUST |
6239 |
|
|
6240 |
## Step 2 |
## Step 2 |
6241 |
if ($token->{tag_name} ne $self->{open_elements}->[-1]->[1]) { |
if ($token->{tag_name} ne $self->{open_elements}->[-1]->[1]) { |
6242 |
|
!!!cp ('t431'); |
6243 |
## NOTE: <x><y></x> |
## NOTE: <x><y></x> |
6244 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
6245 |
|
} else { |
6246 |
|
!!!cp ('t432'); |
6247 |
} |
} |
6248 |
|
|
6249 |
## Step 3 |
## Step 3 |
6257 |
#not $phrasing_category->{$node->[1]} and |
#not $phrasing_category->{$node->[1]} and |
6258 |
($special_category->{$node->[1]} or |
($special_category->{$node->[1]} or |
6259 |
$scoping_category->{$node->[1]})) { |
$scoping_category->{$node->[1]})) { |
6260 |
|
!!!cp ('t433'); |
6261 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
6262 |
## Ignore the token |
## Ignore the token |
6263 |
!!!next-token; |
!!!next-token; |
6264 |
last S2; |
last S2; |
6265 |
} |
} |
6266 |
|
|
6267 |
|
!!!cp ('t434'); |
6268 |
} |
} |
6269 |
|
|
6270 |
## Step 4 |
## Step 4 |
6343 |
if ($self->{next_char} == 0x000A) { # LF |
if ($self->{next_char} == 0x000A) { # LF |
6344 |
$line++; |
$line++; |
6345 |
$column = 0; |
$column = 0; |
6346 |
|
!!!cp ('i1'); |
6347 |
} elsif ($self->{next_char} == 0x000D) { # CR |
} elsif ($self->{next_char} == 0x000D) { # CR |
6348 |
$i++ if substr ($$s, $i, 1) eq "\x0A"; |
$i++ if substr ($$s, $i, 1) eq "\x0A"; |
6349 |
$self->{next_char} = 0x000A; # LF # MUST |
$self->{next_char} = 0x000A; # LF # MUST |
6350 |
$line++; |
$line++; |
6351 |
$column = 0; |
$column = 0; |
6352 |
|
!!!cp ('i2'); |
6353 |
} elsif ($self->{next_char} > 0x10FFFF) { |
} elsif ($self->{next_char} > 0x10FFFF) { |
6354 |
$self->{next_char} = 0xFFFD; # REPLACEMENT CHARACTER # MUST |
$self->{next_char} = 0xFFFD; # REPLACEMENT CHARACTER # MUST |
6355 |
|
!!!cp ('i3'); |
6356 |
} elsif ($self->{next_char} == 0x0000) { # NULL |
} elsif ($self->{next_char} == 0x0000) { # NULL |
6357 |
|
!!!cp ('i4'); |
6358 |
!!!parse-error (type => 'NULL'); |
!!!parse-error (type => 'NULL'); |
6359 |
$self->{next_char} = 0xFFFD; # REPLACEMENT CHARACTER # MUST |
$self->{next_char} = 0xFFFD; # REPLACEMENT CHARACTER # MUST |
6360 |
} |
} |
6415 |
my $nsuri = $anode->namespace_uri; |
my $nsuri = $anode->namespace_uri; |
6416 |
if (defined $nsuri and $nsuri eq 'http://www.w3.org/1999/xhtml') { |
if (defined $nsuri and $nsuri eq 'http://www.w3.org/1999/xhtml') { |
6417 |
if ($anode->manakai_local_name eq 'form') { |
if ($anode->manakai_local_name eq 'form') { |
6418 |
|
!!!cp ('i5'); |
6419 |
$p->{form_element} = $anode; |
$p->{form_element} = $anode; |
6420 |
last AN; |
last AN; |
6421 |
} |
} |