/[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.218 by wakaba, Sat Jul 25 03:38:42 2009 UTC revision 1.224 by wakaba, Sun Aug 16 05:15:09 2009 UTC
# Line 1419  sub _tree_construction_main ($) { Line 1419  sub _tree_construction_main ($) {
1419      ## Step 3      ## Step 3
1420      ## TODO: Mark as "already executed", if ...      ## TODO: Mark as "already executed", if ...
1421    
1422      ## Step 4      ## Step 4 (HTML5 revision 2702)
1423      $insert->($script_el);      $insert->($script_el);
   
     ## ISSUE: $script_el is not put into the stack  
1424      push @{$self->{open_elements}}, [$script_el, $el_category->{script}];      push @{$self->{open_elements}}, [$script_el, $el_category->{script}];
1425    
1426      ## Step 5      ## Step 5
# Line 1874  sub _tree_construction_main ($) { Line 1872  sub _tree_construction_main ($) {
1872          } elsif ({          } elsif ({
1873                    b => 1, big => 1, blockquote => 1, body => 1, br => 1,                    b => 1, big => 1, blockquote => 1, body => 1, br => 1,
1874                    center => 1, code => 1, dd => 1, div => 1, dl => 1, dt => 1,                    center => 1, code => 1, dd => 1, div => 1, dl => 1, dt => 1,
1875                    em => 1, embed => 1, font => 1, h1 => 1, h2 => 1, h3 => 1,                    em => 1, embed => 1, h1 => 1, h2 => 1, h3 => 1,
1876                    h4 => 1, h5 => 1, h6 => 1, head => 1, hr => 1, i => 1,                    h4 => 1, h5 => 1, h6 => 1, head => 1, hr => 1, i => 1,
1877                    img => 1, li => 1, listing => 1, menu => 1, meta => 1,                    img => 1, li => 1, listing => 1, menu => 1, meta => 1,
1878                    nobr => 1, ol => 1, p => 1, pre => 1, ruby => 1, s => 1,                    nobr => 1, ol => 1, p => 1, pre => 1, ruby => 1, s => 1,
1879                    small => 1, span => 1, strong => 1, strike => 1, sub => 1,                    small => 1, span => 1, strong => 1, strike => 1, sub => 1,
1880                    sup => 1, table => 1, tt => 1, u => 1, ul => 1, var => 1,                    sup => 1, table => 1, tt => 1, u => 1, ul => 1, var => 1,
1881                   }->{$token->{tag_name}}) {                   }->{$token->{tag_name}} or
1882                     ($token->{tag_name} eq 'font' and
1883                      ($token->{attributes}->{color} or
1884                       $token->{attributes}->{face} or
1885                       $token->{attributes}->{size}))) {
1886            !!!cp ('t87.2');            !!!cp ('t87.2');
1887            !!!parse-error (type => 'not closed',            !!!parse-error (type => 'not closed',
1888                            text => $self->{open_elements}->[-1]->[0]                            text => $self->{open_elements}->[-1]->[0]
# Line 1956  sub _tree_construction_main ($) { Line 1958  sub _tree_construction_main ($) {
1958          }          }
1959        } elsif ($token->{type} == END_TAG_TOKEN) {        } elsif ($token->{type} == END_TAG_TOKEN) {
1960          ## NOTE: "using the rules for secondary insertion mode" then "continue"          ## NOTE: "using the rules for secondary insertion mode" then "continue"
1961          !!!cp ('t87.5');          if ($token->{tag_name} eq 'script') {
1962          #            !!!cp ('t87.41');
1963              #
1964              ## XXXscript: Execute script here.
1965            } else {
1966              !!!cp ('t87.5');
1967              #
1968            }
1969        } elsif ($token->{type} == END_OF_FILE_TOKEN) {        } elsif ($token->{type} == END_OF_FILE_TOKEN) {
1970          !!!cp ('t87.6');          !!!cp ('t87.6');
1971          !!!parse-error (type => 'not closed',          !!!parse-error (type => 'not closed',
# Line 2492  sub _tree_construction_main ($) { Line 2500  sub _tree_construction_main ($) {
2500                ## Ignore the token                ## Ignore the token
2501                !!!next-token;                !!!next-token;
2502                next B;                next B;
2503              } elsif ($token->{tag_name} eq 'br') {          } elsif ($token->{tag_name} eq 'br') {
2504                if ($self->{insertion_mode} == BEFORE_HEAD_IM) {            if ($self->{insertion_mode} == BEFORE_HEAD_IM) {
2505                  !!!cp ('t142.2');              !!!cp ('t142.2');
2506                  ## (before head) as if <head>, (in head) as if </head>              ## (before head) as if <head>, (in head) as if </head>
2507                  !!!create-element ($self->{head_element}, $HTML_NS, 'head',, $token);              !!!create-element ($self->{head_element}, $HTML_NS, 'head',, $token);
2508                  $self->{open_elements}->[-1]->[0]->append_child ($self->{head_element});              $self->{open_elements}->[-1]->[0]->append_child ($self->{head_element});
2509                  $self->{insertion_mode} = AFTER_HEAD_IM;              $self->{insertion_mode} = AFTER_HEAD_IM;
2510        
2511                  ## Reprocess in the "after head" insertion mode...              ## Reprocess in the "after head" insertion mode...
2512                } elsif ($self->{insertion_mode} == IN_HEAD_IM) {            } elsif ($self->{insertion_mode} == IN_HEAD_IM) {
2513                  !!!cp ('t143.2');              !!!cp ('t143.2');
2514                  ## As if </head>              ## As if </head>
2515                  pop @{$self->{open_elements}};              pop @{$self->{open_elements}};
2516                  $self->{insertion_mode} = AFTER_HEAD_IM;              $self->{insertion_mode} = AFTER_HEAD_IM;
2517        
2518                  ## Reprocess in the "after head" insertion mode...              ## Reprocess in the "after head" insertion mode...
2519                } elsif ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) {            } elsif ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) {
2520                  !!!cp ('t143.3');              !!!cp ('t143.3');
2521                  ## NOTE: Two parse errors for <head><noscript></br>              ## NOTE: Two parse errors for <head><noscript></br>
2522                  !!!parse-error (type => 'unmatched end tag',              !!!parse-error (type => 'unmatched end tag',
2523                                  text => 'br', token => $token);                              text => 'br', token => $token);
2524                  ## As if </noscript>              ## As if </noscript>
2525                  pop @{$self->{open_elements}};              pop @{$self->{open_elements}};
2526                  $self->{insertion_mode} = IN_HEAD_IM;              $self->{insertion_mode} = IN_HEAD_IM;
2527    
2528                  ## Reprocess in the "in head" insertion mode...              ## Reprocess in the "in head" insertion mode...
2529                  ## As if </head>              ## As if </head>
2530                  pop @{$self->{open_elements}};              pop @{$self->{open_elements}};
2531                  $self->{insertion_mode} = AFTER_HEAD_IM;              $self->{insertion_mode} = AFTER_HEAD_IM;
2532    
2533                  ## Reprocess in the "after head" insertion mode...              ## Reprocess in the "after head" insertion mode...
2534                } elsif ($self->{insertion_mode} == AFTER_HEAD_IM) {            } elsif ($self->{insertion_mode} == AFTER_HEAD_IM) {
2535                  !!!cp ('t143.4');              !!!cp ('t143.4');
2536                  #              #
2537                } else {            } else {
2538                  die "$0: $self->{insertion_mode}: Unknown insertion mode";              die "$0: $self->{insertion_mode}: Unknown insertion mode";
2539                }            }
2540    
2541                ## ISSUE: does not agree with IE7 - it doesn't ignore </br>.            #
2542                !!!parse-error (type => 'unmatched end tag',          } else { ## Other end tags
                               text => 'br', token => $token);  
               ## Ignore the token  
               !!!next-token;  
               next B;  
             } else {  
2543                !!!cp ('t145');                !!!cp ('t145');
2544                !!!parse-error (type => 'unmatched end tag',                !!!parse-error (type => 'unmatched end tag',
2545                                text => $token->{tag_name}, token => $token);                                text => $token->{tag_name}, token => $token);
# Line 2580  sub _tree_construction_main ($) { Line 2583  sub _tree_construction_main ($) {
2583              !!!insert-element ('body',, $token);              !!!insert-element ('body',, $token);
2584              $self->{insertion_mode} = IN_BODY_IM;              $self->{insertion_mode} = IN_BODY_IM;
2585              ## reprocess              ## reprocess
2586              next B;          next B;
2587        } elsif ($token->{type} == END_OF_FILE_TOKEN) {        } elsif ($token->{type} == END_OF_FILE_TOKEN) {
2588          if ($self->{insertion_mode} == BEFORE_HEAD_IM) {          if ($self->{insertion_mode} == BEFORE_HEAD_IM) {
2589            !!!cp ('t149.1');            !!!cp ('t149.1');
# Line 3846  sub _tree_construction_main ($) { Line 3849  sub _tree_construction_main ($) {
3849                     tbody => 1, tfoot => 1, thead => 1,                     tbody => 1, tfoot => 1, thead => 1,
3850                     tr => 1, td => 1, th => 1,                     tr => 1, td => 1, th => 1,
3851                    }->{$token->{tag_name}})) {                    }->{$token->{tag_name}})) {
3852            ## TODO: The type below is not good - <select> is replaced by </select>  
3853            !!!parse-error (type => 'not closed', text => 'select',            ## 1. Parse error.
3854                            token => $token);            if ($token->{tag_name} eq 'select') {
3855            ## NOTE: As if the token were </select> (<select> case) or                !!!parse-error (type => 'select in select', ## XXX: documentation
3856            ## as if there were </select> (otherwise).                                token => $token);
3857            ## have an element in table scope            } else {
3858                !!!parse-error (type => 'not closed', text => 'select',
3859                                token => $token);
3860              }
3861    
3862              ## 2./<select>-1. Unless "have an element in table scope" (select):
3863            my $i;            my $i;
3864            INSCOPE: for (reverse 0..$#{$self->{open_elements}}) {            INSCOPE: for (reverse 0..$#{$self->{open_elements}}) {
3865              my $node = $self->{open_elements}->[$_];              my $node = $self->{open_elements}->[$_];
# Line 3866  sub _tree_construction_main ($) { Line 3874  sub _tree_construction_main ($) {
3874            } # INSCOPE            } # INSCOPE
3875            unless (defined $i) {            unless (defined $i) {
3876              !!!cp ('t280');              !!!cp ('t280');
3877              !!!parse-error (type => 'unmatched end tag',              if ($token->{tag_name} eq 'select') {
3878                              text => 'select', token => $token);                ## NOTE: This error would be raised when
3879              ## Ignore the token                ## |select.innerHTML = '<select>'| is executed; in this
3880                  ## case two errors, "select in select" and "unmatched
3881                  ## end tags" are reported to the user, the latter might
3882                  ## be confusing but this is what the spec requires.
3883                  !!!parse-error (type => 'unmatched end tag',
3884                                  text => 'select',
3885                                  token => $token);
3886                }
3887                ## Ignore the token.
3888              !!!nack ('t280.1');              !!!nack ('t280.1');
3889              !!!next-token;              !!!next-token;
3890              next B;              next B;
3891            }            }
3892    
3893              ## 3. Otherwise, as if there were <select>:
3894                                
3895            !!!cp ('t281');            !!!cp ('t281');
3896            splice @{$self->{open_elements}}, $i;            splice @{$self->{open_elements}}, $i;
# Line 4834  sub _tree_construction_main ($) { Line 4852  sub _tree_construction_main ($) {
4852            next B;            next B;
4853          }          }
4854        } elsif ($token->{tag_name} eq 'textarea') {        } elsif ($token->{tag_name} eq 'textarea') {
4855          ## Step 1          ## 1. Insert
4856          !!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token);          !!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token);
4857                    
4858          ## Step 2          ## Step 2 # XXX
4859          ## TODO: $self->{form_element} if defined          ## TODO: $self->{form_element} if defined
4860    
4861          ## Step 3          ## 2. Drop U+000A LINE FEED
4862          $self->{ignore_newline} = 1;          $self->{ignore_newline} = 1;
4863    
4864          ## Step 4          ## 3. RCDATA
         ## ISSUE: This step is wrong. (r2302 enbugged)  
   
         ## Step 5  
4865          $self->{content_model} = RCDATA_CONTENT_MODEL;          $self->{content_model} = RCDATA_CONTENT_MODEL;
4866          delete $self->{escape}; # MUST          delete $self->{escape}; # MUST
4867    
4868          ## Step 6-7          ## 4., 6. Insertion mode
4869          $self->{insertion_mode} |= IN_CDATA_RCDATA_IM;          $self->{insertion_mode} |= IN_CDATA_RCDATA_IM;
4870    
4871            ## XXX: 5. frameset-ok flag
4872    
4873          !!!nack ('t392.1');          !!!nack ('t392.1');
4874          !!!next-token;          !!!next-token;
4875          next B;          next B;
# Line 5048  sub _tree_construction_main ($) { Line 5065  sub _tree_construction_main ($) {
5065          } # INSCOPE          } # INSCOPE
5066    
5067          for (@{$self->{open_elements}}) {          for (@{$self->{open_elements}}) {
5068            unless ($_->[1] & ALL_END_TAG_OPTIONAL_EL) {            unless ($_->[1] & ALL_END_TAG_OPTIONAL_EL ||
5069                      $_->[1] == OPTGROUP_EL ||
5070                      $_->[1] == OPTION_EL ||
5071                      $_->[1] == RUBY_COMPONENT_EL) {
5072              !!!cp ('t403');              !!!cp ('t403');
5073              !!!parse-error (type => 'not closed',              !!!parse-error (type => 'not closed',
5074                              text => $_->[0]->manakai_local_name,                              text => $_->[0]->manakai_local_name,

Legend:
Removed from v.1.218  
changed lines
  Added in v.1.224

[email protected]
ViewVC Help
Powered by ViewVC 1.1.24