/[suikacvs]/markup/html/whatpm/Whatpm/HTML.pm.src
Suika

Diff of /markup/html/whatpm/Whatpm/HTML.pm.src

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.28 by wakaba, Mon Jun 25 00:14:40 2007 UTC revision 1.33 by wakaba, Sat Jul 7 13:41:05 2007 UTC
# Line 7  our $VERSION=do{my @r=(q$Revision$=~/\d+ Line 7  our $VERSION=do{my @r=(q$Revision$=~/\d+
7  ## doc.write ('');  ## doc.write ('');
8  ## alert (doc.compatMode);  ## alert (doc.compatMode);
9    
10    ## ISSUE: HTML5 revision 967 says that the encoding layer MUST NOT
11    ## strip BOM and the HTML layer MUST ignore it.  Whether we can do it
12    ## is not yet clear.
13    ## "{U+FEFF}..." in UTF-16BE/UTF-16LE is three or four characters?
14    ## "{U+FEFF}..." in GB18030?
15    
16  my $permitted_slash_tag_name = {  my $permitted_slash_tag_name = {
17    base => 1,    base => 1,
18    link => 1,    link => 1,
# Line 327  sub _get_next_token ($) { Line 333  sub _get_next_token ($) {
333        if ($self->{content_model_flag} eq 'RCDATA' or        if ($self->{content_model_flag} eq 'RCDATA' or
334            $self->{content_model_flag} eq 'CDATA') {            $self->{content_model_flag} eq 'CDATA') {
335          if (defined $self->{last_emitted_start_tag_name}) {          if (defined $self->{last_emitted_start_tag_name}) {
336              ## NOTE: <http://krijnhoetmer.nl/irc-logs/whatwg/20070626#l-564>
337            my @next_char;            my @next_char;
338            TAGNAME: for (my $i = 0; $i < length $self->{last_emitted_start_tag_name}; $i++) {            TAGNAME: for (my $i = 0; $i < length $self->{last_emitted_start_tag_name}; $i++) {
339              push @next_char, $self->{next_input_character};              push @next_char, $self->{next_input_character};
# Line 698  sub _get_next_token ($) { Line 705  sub _get_next_token ($) {
705            #            #
706          } else {          } else {
707            !!!parse-error (type => 'nestc');            !!!parse-error (type => 'nestc');
708              ## TODO: Different error type for <aa / bb> than <aa/>
709          }          }
710          $self->{state} = 'before attribute name';          $self->{state} = 'before attribute name';
711          # next-input-character is already done          # next-input-character is already done
# Line 1018  sub _get_next_token ($) { Line 1026  sub _get_next_token ($) {
1026          }          }
1027        }        }
1028    
1029        !!!parse-error (type => 'bogus comment open');        !!!parse-error (type => 'bogus comment');
1030        $self->{next_input_character} = shift @next_char;        $self->{next_input_character} = shift @next_char;
1031        !!!back-next-input-character (@next_char);        !!!back-next-input-character (@next_char);
1032        $self->{state} = 'bogus comment';        $self->{state} = 'bogus comment';
# Line 1077  sub _get_next_token ($) { Line 1085  sub _get_next_token ($) {
1085          redo A;          redo A;
1086        } else {        } else {
1087          $self->{current_token}->{data} # comment          $self->{current_token}->{data} # comment
1088              .= chr ($self->{next_input_character});              .= '-' . chr ($self->{next_input_character});
1089          $self->{state} = 'comment';          $self->{state} = 'comment';
1090          !!!next-input-character;          !!!next-input-character;
1091          redo A;          redo A;
# Line 1487  sub _get_next_token ($) { Line 1495  sub _get_next_token ($) {
1495    
1496          redo A;          redo A;
1497        } else {        } else {
1498          !!!parse-error (type => 'string after PUBLIC literal');          !!!parse-error (type => 'string after SYSTEM');
1499          $self->{state} = 'bogus DOCTYPE';          $self->{state} = 'bogus DOCTYPE';
1500          !!!next-input-character;          !!!next-input-character;
1501          redo A;          redo A;
# Line 1655  sub _tokenize_attempt_to_consume_an_enti Line 1663  sub _tokenize_attempt_to_consume_an_enti
1663            !!!parse-error (type => 'CR character reference');            !!!parse-error (type => 'CR character reference');
1664            $code = 0x000A;            $code = 0x000A;
1665          } elsif (0x80 <= $code and $code <= 0x9F) {          } elsif (0x80 <= $code and $code <= 0x9F) {
1666            !!!parse-error (type => sprintf 'c1 entity:U+%04X', $code);            !!!parse-error (type => sprintf 'C1 character reference:U+%04X', $code);
1667            $code = $c1_entity_char->{$code};            $code = $c1_entity_char->{$code};
1668          }          }
1669    
# Line 1690  sub _tokenize_attempt_to_consume_an_enti Line 1698  sub _tokenize_attempt_to_consume_an_enti
1698          !!!parse-error (type => 'CR character reference');          !!!parse-error (type => 'CR character reference');
1699          $code = 0x000A;          $code = 0x000A;
1700        } elsif (0x80 <= $code and $code <= 0x9F) {        } elsif (0x80 <= $code and $code <= 0x9F) {
1701          !!!parse-error (type => sprintf 'c1 entity:U+%04X', $code);          !!!parse-error (type => sprintf 'C1 character reference:U+%04X', $code);
1702          $code = $c1_entity_char->{$code};          $code = $c1_entity_char->{$code};
1703        }        }
1704                
# Line 1744  sub _tokenize_attempt_to_consume_an_enti Line 1752  sub _tokenize_attempt_to_consume_an_enti
1752      if ($match > 0) {      if ($match > 0) {
1753        return {type => 'character', data => $value};        return {type => 'character', data => $value};
1754      } elsif ($match < 0) {      } elsif ($match < 0) {
1755        !!!parse-error (type => 'refc');        !!!parse-error (type => 'no refc');
1756        return {type => 'character', data => $value};        return {type => 'character', data => $value};
1757      } else {      } else {
1758        !!!parse-error (type => 'bare ero');        !!!parse-error (type => 'bare ero');
# Line 2029  sub _reset_insertion_mode ($) { Line 2037  sub _reset_insertion_mode ($) {
2037            
2038      ## Step 3      ## Step 3
2039      S3: {      S3: {
2040        $last = 1 if $self->{open_elements}->[0]->[0] eq $node->[0];        ## ISSUE: Oops! "If node is the first node in the stack of open
2041        if (defined $self->{inner_html_node}) {        ## elements, then set last to true. If the context element of the
2042          if ($self->{inner_html_node}->[1] eq 'td' or        ## HTML fragment parsing algorithm is neither a td element nor a
2043              $self->{inner_html_node}->[1] eq 'th') {        ## th element, then set node to the context element. (fragment case)":
2044            #        ## The second "if" is in the scope of the first "if"!?
2045          } else {        if ($self->{open_elements}->[0]->[0] eq $node->[0]) {
2046            $node = $self->{inner_html_node};          $last = 1;
2047            if (defined $self->{inner_html_node}) {
2048              if ($self->{inner_html_node}->[1] eq 'td' or
2049                  $self->{inner_html_node}->[1] eq 'th') {
2050                #
2051              } else {
2052                $node = $self->{inner_html_node};
2053              }
2054          }          }
2055        }        }
2056            
# Line 2494  sub _tree_construction_main ($) { Line 2509  sub _tree_construction_main ($) {
2509        } elsif ($token->{tag_name} eq 'title') {        } elsif ($token->{tag_name} eq 'title') {
2510          !!!parse-error (type => 'in body:title');          !!!parse-error (type => 'in body:title');
2511          ## NOTE: This is an "as if in head" code clone          ## NOTE: This is an "as if in head" code clone
2512          $parse_rcdata->('RCDATA', $insert);          $parse_rcdata->('RCDATA', sub {
2513              if (defined $self->{head_element}) {
2514                $self->{head_element}->append_child ($_[0]);
2515              } else {
2516                $insert->($_[0]);
2517              }
2518            });
2519          return;          return;
2520        } elsif ($token->{tag_name} eq 'body') {        } elsif ($token->{tag_name} eq 'body') {
2521          !!!parse-error (type => 'in body:body');          !!!parse-error (type => 'in body:body');
# Line 2787  sub _tree_construction_main ($) { Line 2808  sub _tree_construction_main ($) {
2808          INSCOPE: for (reverse 0..$#{$self->{open_elements}}) {          INSCOPE: for (reverse 0..$#{$self->{open_elements}}) {
2809            my $node = $self->{open_elements}->[$_];            my $node = $self->{open_elements}->[$_];
2810            if ($node->[1] eq 'nobr') {            if ($node->[1] eq 'nobr') {
2811                !!!parse-error (type => 'not closed:nobr');
2812              !!!back-token;              !!!back-token;
2813              $token = {type => 'end tag', tag_name => 'nobr'};              $token = {type => 'end tag', tag_name => 'nobr'};
2814              return;              return;
# Line 2870  sub _tree_construction_main ($) { Line 2892  sub _tree_construction_main ($) {
2892            !!!parse-error (type => 'image');            !!!parse-error (type => 'image');
2893            $token->{tag_name} = 'img';            $token->{tag_name} = 'img';
2894          }          }
2895            
2896            ## NOTE: There is an "as if <br>" code clone.
2897          $reconstruct_active_formatting_elements->($insert_to_current);          $reconstruct_active_formatting_elements->($insert_to_current);
2898                    
2899          !!!insert-element-t ($token->{tag_name}, $token->{attributes});          !!!insert-element-t ($token->{tag_name}, $token->{attributes});
# Line 3028  sub _tree_construction_main ($) { Line 3051  sub _tree_construction_main ($) {
3051              unless ({              unless ({
3052                         dd => 1, dt => 1, li => 1, p => 1, td => 1,                         dd => 1, dt => 1, li => 1, p => 1, td => 1,
3053                         th => 1, tr => 1, body => 1, html => 1,                         th => 1, tr => 1, body => 1, html => 1,
3054                         tbody => 1, tfoot => 1, thead => 1,
3055                      }->{$_->[1]}) {                      }->{$_->[1]}) {
3056                !!!parse-error (type => 'not closed:'.$_->[1]);                !!!parse-error (type => 'not closed:'.$_->[1]);
3057              }              }
# Line 3077  sub _tree_construction_main ($) { Line 3101  sub _tree_construction_main ($) {
3101                   li => ($token->{tag_name} ne 'li'),                   li => ($token->{tag_name} ne 'li'),
3102                   p => ($token->{tag_name} ne 'p'),                   p => ($token->{tag_name} ne 'p'),
3103                   td => 1, th => 1, tr => 1,                   td => 1, th => 1, tr => 1,
3104                     tbody => 1, tfoot=> 1, thead => 1,
3105                  }->{$self->{open_elements}->[-1]->[1]}) {                  }->{$self->{open_elements}->[-1]->[1]}) {
3106                !!!back-token;                !!!back-token;
3107                $token = {type => 'end tag',                $token = {type => 'end tag',
# Line 3094  sub _tree_construction_main ($) { Line 3119  sub _tree_construction_main ($) {
3119          } # INSCOPE          } # INSCOPE
3120                    
3121          if ($self->{open_elements}->[-1]->[1] ne $token->{tag_name}) {          if ($self->{open_elements}->[-1]->[1] ne $token->{tag_name}) {
3122            !!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]);            if (defined $i) {
3123                !!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]);
3124              } else {
3125                !!!parse-error (type => 'unmatched end tag:'.$token->{tag_name});
3126              }
3127          }          }
3128                    
3129          splice @{$self->{open_elements}}, $i if defined $i;          if (defined $i) {
3130              splice @{$self->{open_elements}}, $i;
3131            } elsif ($token->{tag_name} eq 'p') {
3132              ## As if <p>, then reprocess the current token
3133              my $el;
3134              !!!create-element ($el, 'p');
3135              $insert->($el);
3136            }
3137          $clear_up_to_marker->()          $clear_up_to_marker->()
3138            if {            if {
3139              button => 1, marquee => 1, object => 1,              button => 1, marquee => 1, object => 1,
# Line 3113  sub _tree_construction_main ($) { Line 3149  sub _tree_construction_main ($) {
3149              if ({              if ({
3150                   dd => 1, dt => 1, li => 1, p => 1,                   dd => 1, dt => 1, li => 1, p => 1,
3151                   td => 1, th => 1, tr => 1,                   td => 1, th => 1, tr => 1,
3152                     tbody => 1, tfoot=> 1, thead => 1,
3153                  }->{$self->{open_elements}->[-1]->[1]}) {                  }->{$self->{open_elements}->[-1]->[1]}) {
3154                !!!back-token;                !!!back-token;
3155                $token = {type => 'end tag',                $token = {type => 'end tag',
# Line 3151  sub _tree_construction_main ($) { Line 3188  sub _tree_construction_main ($) {
3188              if ({              if ({
3189                   dd => 1, dt => 1, li => 1, p => 1,                   dd => 1, dt => 1, li => 1, p => 1,
3190                   td => 1, th => 1, tr => 1,                   td => 1, th => 1, tr => 1,
3191                     tbody => 1, tfoot=> 1, thead => 1,
3192                  }->{$self->{open_elements}->[-1]->[1]}) {                  }->{$self->{open_elements}->[-1]->[1]}) {
3193                !!!back-token;                !!!back-token;
3194                $token = {type => 'end tag',                $token = {type => 'end tag',
# Line 3181  sub _tree_construction_main ($) { Line 3219  sub _tree_construction_main ($) {
3219                  strong => 1, tt => 1, u => 1,                  strong => 1, tt => 1, u => 1,
3220                 }->{$token->{tag_name}}) {                 }->{$token->{tag_name}}) {
3221          $formatting_end_tag->($token->{tag_name});          $formatting_end_tag->($token->{tag_name});
3222  ## TODO: <http://html5.org/tools/web-apps-tracker?from=883&to=884>          return;
3223          } elsif ($token->{tag_name} eq 'br') {
3224            !!!parse-error (type => 'unmatched end tag:br');
3225    
3226            ## As if <br>
3227            $reconstruct_active_formatting_elements->($insert_to_current);
3228            
3229            my $el;
3230            !!!create-element ($el, 'br');
3231            $insert->($el);
3232            
3233            ## Ignore the token.
3234            !!!next-token;
3235          return;          return;
3236        } elsif ({        } elsif ({
3237                  caption => 1, col => 1, colgroup => 1, frame => 1,                  caption => 1, col => 1, colgroup => 1, frame => 1,
3238                  frameset => 1, head => 1, option => 1, optgroup => 1,                  frameset => 1, head => 1, option => 1, optgroup => 1,
3239                  tbody => 1, td => 1, tfoot => 1, th => 1,                  tbody => 1, td => 1, tfoot => 1, th => 1,
3240                  thead => 1, tr => 1,                  thead => 1, tr => 1,
3241                  area => 1, basefont => 1, bgsound => 1, br => 1,                  area => 1, basefont => 1, bgsound => 1,
3242                  embed => 1, hr => 1, iframe => 1, image => 1,                  embed => 1, hr => 1, iframe => 1, image => 1,
3243                  img => 1, input => 1, isindex => 1, noembed => 1,                  img => 1, input => 1, isindex => 1, noembed => 1,
3244                  noframes => 1, param => 1, select => 1, spacer => 1,                  noframes => 1, param => 1, select => 1, spacer => 1,
# Line 3215  sub _tree_construction_main ($) { Line 3265  sub _tree_construction_main ($) {
3265              if ({              if ({
3266                   dd => 1, dt => 1, li => 1, p => 1,                   dd => 1, dt => 1, li => 1, p => 1,
3267                   td => 1, th => 1, tr => 1,                   td => 1, th => 1, tr => 1,
3268                     tbody => 1, tfoot=> 1, thead => 1,
3269                  }->{$self->{open_elements}->[-1]->[1]}) {                  }->{$self->{open_elements}->[-1]->[1]}) {
3270                !!!back-token;                !!!back-token;
3271                $token = {type => 'end tag',                $token = {type => 'end tag',
# Line 3286  sub _tree_construction_main ($) { Line 3337  sub _tree_construction_main ($) {
3337          ## Generate implied end tags          ## Generate implied end tags
3338          if ({          if ({
3339               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,
3340                 tbody => 1, tfoot=> 1, thead => 1,
3341              }->{$self->{open_elements}->[-1]->[1]}) {              }->{$self->{open_elements}->[-1]->[1]}) {
3342            !!!back-token;            !!!back-token;
3343            $token = {type => 'end tag', tag_name => $self->{open_elements}->[-1]->[1]};            $token = {type => 'end tag', tag_name => $self->{open_elements}->[-1]->[1]};
# Line 3345  sub _tree_construction_main ($) { Line 3397  sub _tree_construction_main ($) {
3397              }              }
3398              redo B;              redo B;
3399            } elsif ($token->{type} eq 'end tag') {            } elsif ($token->{type} eq 'end tag') {
3400              if ({head => 1, body => 1, html => 1}->{$token->{tag_name}}) {              if ({
3401                     head => 1, body => 1, html => 1,
3402                     p => 1, br => 1,
3403                    }->{$token->{tag_name}}) {
3404                ## As if <head>                ## As if <head>
3405                !!!create-element ($self->{head_element}, 'head');                !!!create-element ($self->{head_element}, 'head');
3406                $self->{open_elements}->[-1]->[0]->append_child ($self->{head_element});                $self->{open_elements}->[-1]->[0]->append_child ($self->{head_element});
# Line 3403  sub _tree_construction_main ($) { Line 3458  sub _tree_construction_main ($) {
3458                  !!!parse-error (type => 'after head:'.$token->{tag_name});                  !!!parse-error (type => 'after head:'.$token->{tag_name});
3459                  push @{$self->{open_elements}}, [$self->{head_element}, 'head'];                  push @{$self->{open_elements}}, [$self->{head_element}, 'head'];
3460                }                }
3461                $parse_rcdata->('RCDATA', $insert_to_current);                my $parent = defined $self->{head_element} ? $self->{head_element}
3462                      : $self->{open_elements}->[-1]->[0];
3463                  $parse_rcdata->('RCDATA', sub { $parent->append_child ($_[0]) });
3464                pop @{$self->{open_elements}}                pop @{$self->{open_elements}}
3465                    if $self->{insertion_mode} eq 'after head';                    if $self->{insertion_mode} eq 'after head';
3466                redo B;                redo B;
# Line 3427  sub _tree_construction_main ($) { Line 3484  sub _tree_construction_main ($) {
3484                  !!!next-token;                  !!!next-token;
3485                  redo B;                  redo B;
3486                } elsif ($self->{insertion_mode} eq 'in head noscript') {                } elsif ($self->{insertion_mode} eq 'in head noscript') {
3487                  !!!parse-error (type => 'noscript in noscript');                  !!!parse-error (type => 'in noscript:noscript');
3488                  ## Ignore the token                  ## Ignore the token
3489                  redo B;                  redo B;
3490                } else {                } else {
# Line 3479  sub _tree_construction_main ($) { Line 3536  sub _tree_construction_main ($) {
3536                !!!next-token;                !!!next-token;
3537                redo B;                redo B;
3538              } elsif ($self->{insertion_mode} eq 'in head' and              } elsif ($self->{insertion_mode} eq 'in head' and
3539                       ($token->{tag_name} eq 'body' or                       {
3540                        $token->{tag_name} eq 'html')) {                        body => 1, html => 1,
3541                          p => 1, br => 1,
3542                         }->{$token->{tag_name}}) {
3543                  #
3544                } elsif ($self->{insertion_mode} eq 'in head noscript' and
3545                         {
3546                          p => 1, br => 1,
3547                         }->{$token->{tag_name}}) {
3548                #                #
3549              } elsif ($self->{insertion_mode} ne 'after head') {              } elsif ($self->{insertion_mode} ne 'after head') {
3550                !!!parse-error (type => 'unmatched end tag:'.$token->{tag_name});                !!!parse-error (type => 'unmatched end tag:'.$token->{tag_name});
# Line 3664  sub _tree_construction_main ($) { Line 3728  sub _tree_construction_main ($) {
3728                if ({                if ({
3729                     dd => 1, dt => 1, li => 1, p => 1,                     dd => 1, dt => 1, li => 1, p => 1,
3730                     td => 1, th => 1, tr => 1,                     td => 1, th => 1, tr => 1,
3731                       tbody => 1, tfoot=> 1, thead => 1,
3732                    }->{$self->{open_elements}->[-1]->[1]}) {                    }->{$self->{open_elements}->[-1]->[1]}) {
3733                  !!!back-token; # <table>                  !!!back-token; # <table>
3734                  $token = {type => 'end tag', tag_name => 'table'};                  $token = {type => 'end tag', tag_name => 'table'};
# Line 3712  sub _tree_construction_main ($) { Line 3777  sub _tree_construction_main ($) {
3777                if ({                if ({
3778                     dd => 1, dt => 1, li => 1, p => 1,                     dd => 1, dt => 1, li => 1, p => 1,
3779                     td => 1, th => 1, tr => 1,                     td => 1, th => 1, tr => 1,
3780                       tbody => 1, tfoot=> 1, thead => 1,
3781                    }->{$self->{open_elements}->[-1]->[1]}) {                    }->{$self->{open_elements}->[-1]->[1]}) {
3782                  !!!back-token;                  !!!back-token;
3783                  $token = {type => 'end tag',                  $token = {type => 'end tag',
# Line 3795  sub _tree_construction_main ($) { Line 3861  sub _tree_construction_main ($) {
3861                if ({                if ({
3862                     dd => 1, dt => 1, li => 1, p => 1,                     dd => 1, dt => 1, li => 1, p => 1,
3863                     td => 1, th => 1, tr => 1,                     td => 1, th => 1, tr => 1,
3864                       tbody => 1, tfoot=> 1, thead => 1,
3865                    }->{$self->{open_elements}->[-1]->[1]}) {                    }->{$self->{open_elements}->[-1]->[1]}) {
3866                  !!!back-token; # <?>                  !!!back-token; # <?>
3867                  $token = {type => 'end tag', tag_name => 'caption'};                  $token = {type => 'end tag', tag_name => 'caption'};
# Line 3845  sub _tree_construction_main ($) { Line 3912  sub _tree_construction_main ($) {
3912                if ({                if ({
3913                     dd => 1, dt => 1, li => 1, p => 1,                     dd => 1, dt => 1, li => 1, p => 1,
3914                     td => 1, th => 1, tr => 1,                     td => 1, th => 1, tr => 1,
3915                       tbody => 1, tfoot=> 1, thead => 1,
3916                    }->{$self->{open_elements}->[-1]->[1]}) {                    }->{$self->{open_elements}->[-1]->[1]}) {
3917                  !!!back-token;                  !!!back-token;
3918                  $token = {type => 'end tag',                  $token = {type => 'end tag',
# Line 3892  sub _tree_construction_main ($) { Line 3960  sub _tree_construction_main ($) {
3960                if ({                if ({
3961                     dd => 1, dt => 1, li => 1, p => 1,                     dd => 1, dt => 1, li => 1, p => 1,
3962                     td => 1, th => 1, tr => 1,                     td => 1, th => 1, tr => 1,
3963                       tbody => 1, tfoot=> 1, thead => 1,
3964                    }->{$self->{open_elements}->[-1]->[1]}) {                    }->{$self->{open_elements}->[-1]->[1]}) {
3965                  !!!back-token; # </table>                  !!!back-token; # </table>
3966                  $token = {type => 'end tag', tag_name => 'caption'};                  $token = {type => 'end tag', tag_name => 'caption'};
# Line 4157  sub _tree_construction_main ($) { Line 4226  sub _tree_construction_main ($) {
4226                if ({                if ({
4227                     dd => 1, dt => 1, li => 1, p => 1,                     dd => 1, dt => 1, li => 1, p => 1,
4228                     td => 1, th => 1, tr => 1,                     td => 1, th => 1, tr => 1,
4229                       tbody => 1, tfoot=> 1, thead => 1,
4230                    }->{$self->{open_elements}->[-1]->[1]}) {                    }->{$self->{open_elements}->[-1]->[1]}) {
4231                  !!!back-token; # <table>                  !!!back-token; # <table>
4232                  $token = {type => 'end tag', tag_name => 'table'};                  $token = {type => 'end tag', tag_name => 'table'};
# Line 4425  sub _tree_construction_main ($) { Line 4495  sub _tree_construction_main ($) {
4495                if ({                if ({
4496                     dd => 1, dt => 1, li => 1, p => 1,                     dd => 1, dt => 1, li => 1, p => 1,
4497                     td => 1, th => 1, tr => 1,                     td => 1, th => 1, tr => 1,
4498                       tbody => 1, tfoot=> 1, thead => 1,
4499                    }->{$self->{open_elements}->[-1]->[1]}) {                    }->{$self->{open_elements}->[-1]->[1]}) {
4500                  !!!back-token; # <table>                  !!!back-token; # <table>
4501                  $token = {type => 'end tag', tag_name => 'table'};                  $token = {type => 'end tag', tag_name => 'table'};
# Line 4666  sub _tree_construction_main ($) { Line 4737  sub _tree_construction_main ($) {
4737                     td => ($token->{tag_name} eq 'th'),                     td => ($token->{tag_name} eq 'th'),
4738                     th => ($token->{tag_name} eq 'td'),                     th => ($token->{tag_name} eq 'td'),
4739                     tr => 1,                     tr => 1,
4740                       tbody => 1, tfoot=> 1, thead => 1,
4741                    }->{$self->{open_elements}->[-1]->[1]}) {                    }->{$self->{open_elements}->[-1]->[1]}) {
4742                  !!!back-token;                  !!!back-token;
4743                  $token = {type => 'end tag',                  $token = {type => 'end tag',
# Line 5018  sub _tree_construction_main ($) { Line 5090  sub _tree_construction_main ($) {
5090            }            }
5091                        
5092            if (defined $token->{tag_name}) {            if (defined $token->{tag_name}) {
5093              !!!parse-error (type => 'in frameset:'.$token->{tag_name});              !!!parse-error (type => 'in frameset:'.($token->{type} eq 'end tag' ? '/' : '').$token->{tag_name});
5094            } else {            } else {
5095              !!!parse-error (type => 'in frameset:#'.$token->{type});              !!!parse-error (type => 'in frameset:#'.$token->{type});
5096            }            }
# Line 5062  sub _tree_construction_main ($) { Line 5134  sub _tree_construction_main ($) {
5134            }            }
5135                        
5136            if (defined $token->{tag_name}) {            if (defined $token->{tag_name}) {
5137              !!!parse-error (type => 'after frameset:'.$token->{tag_name});              !!!parse-error (type => 'after frameset:'.($token->{tag_name} eq 'end tag' ? '/' : '').$token->{tag_name});
5138            } else {            } else {
5139              !!!parse-error (type => 'after frameset:#'.$token->{type});              !!!parse-error (type => 'after frameset:#'.$token->{type});
5140            }            }
# Line 5112  sub _tree_construction_main ($) { Line 5184  sub _tree_construction_main ($) {
5184          redo B;          redo B;
5185        } elsif ($token->{type} eq 'start tag' or        } elsif ($token->{type} eq 'start tag' or
5186                 $token->{type} eq 'end tag') {                 $token->{type} eq 'end tag') {
5187          !!!parse-error (type => 'after html:'.$token->{tag_name});          !!!parse-error (type => 'after html:'.($token->{type} eq 'end tag' ? '/' : '').$token->{tag_name});
5188          $phase = 'main';          $phase = 'main';
5189          ## reprocess          ## reprocess
5190          redo B;          redo B;

Legend:
Removed from v.1.28  
changed lines
  Added in v.1.33

[email protected]
ViewVC Help
Powered by ViewVC 1.1.24