/[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.193 by wakaba, Sat Oct 4 04:06:33 2008 UTC revision 1.195 by wakaba, Sat Oct 4 06:30:34 2008 UTC
# Line 66  sub TABLE_ROWS_EL () { Line 66  sub TABLE_ROWS_EL () {
66  }  }
67    
68  ## NOTE: Used in "generate implied end tags" algorithm.  ## NOTE: Used in "generate implied end tags" algorithm.
69  ## NOTE: There is a code where a modified version of END_TAG_OPTIONAL_EL  ## NOTE: There is a code where a modified version of
70  ## is used in "generate implied end tags" implementation (search for the  ## END_TAG_OPTIONAL_EL is used in "generate implied end tags"
71  ## function mae).  ## implementation (search for the algorithm name).
72  sub END_TAG_OPTIONAL_EL () {  sub END_TAG_OPTIONAL_EL () {
73    DD_EL |    DD_EL |
74    DT_EL |    DT_EL |
75    LI_EL |    LI_EL |
76      OPTION_EL |
77      OPTGROUP_EL |
78    P_EL |    P_EL |
79    RUBY_COMPONENT_EL    RUBY_COMPONENT_EL
80  }  }
# Line 4655  sub _tree_construction_main ($) { Line 4657  sub _tree_construction_main ($) {
4657                  !!!cp ('t101');                  !!!cp ('t101');
4658                }                }
4659                !!!insert-element ($token->{tag_name}, $token->{attributes}, $token);                !!!insert-element ($token->{tag_name}, $token->{attributes}, $token);
4660                pop @{$self->{open_elements}}; ## ISSUE: This step is missing in the spec.                pop @{$self->{open_elements}};
4661                pop @{$self->{open_elements}} # <head>                pop @{$self->{open_elements}} # <head>
4662                    if $self->{insertion_mode} == AFTER_HEAD_IM;                    if $self->{insertion_mode} == AFTER_HEAD_IM;
4663                !!!nack ('t101.1');                !!!nack ('t101.1');
4664                !!!next-token;                !!!next-token;
4665                next B;                next B;
4666              } elsif ($token->{tag_name} eq 'link') {          } elsif ($token->{tag_name} eq 'link') {
4667                ## NOTE: There is a "as if in head" code clone.            ## NOTE: There is a "as if in head" code clone.
4668                if ($self->{insertion_mode} == AFTER_HEAD_IM) {            if ($self->{insertion_mode} == AFTER_HEAD_IM) {
4669                  !!!cp ('t102');              !!!cp ('t102');
4670                  !!!parse-error (type => 'after head',              !!!parse-error (type => 'after head',
4671                                  text => $token->{tag_name}, token => $token);                              text => $token->{tag_name}, token => $token);
4672                  push @{$self->{open_elements}},              push @{$self->{open_elements}},
4673                      [$self->{head_element}, $el_category->{head}];                  [$self->{head_element}, $el_category->{head}];
4674                } else {            } else {
4675                  !!!cp ('t103');              !!!cp ('t103');
4676                }            }
4677                !!!insert-element ($token->{tag_name}, $token->{attributes}, $token);            !!!insert-element ($token->{tag_name}, $token->{attributes}, $token);
4678                pop @{$self->{open_elements}}; ## ISSUE: This step is missing in the spec.            pop @{$self->{open_elements}};
4679                pop @{$self->{open_elements}} # <head>            pop @{$self->{open_elements}} # <head>
4680                    if $self->{insertion_mode} == AFTER_HEAD_IM;                if $self->{insertion_mode} == AFTER_HEAD_IM;
4681                !!!ack ('t103.1');            !!!ack ('t103.1');
4682                !!!next-token;            !!!next-token;
4683                next B;            next B;
4684            } elsif ($token->{tag_name} eq 'command' or
4685                     $token->{tag_name} eq 'eventsource') {
4686              if ($self->{insertion_mode} == IN_HEAD_IM) {
4687                ## NOTE: If the insertion mode at the time of the emission
4688                ## of the token was "before head", $self->{insertion_mode}
4689                ## is already changed to |IN_HEAD_IM|.
4690    
4691                ## NOTE: There is a "as if in head" code clone.
4692                !!!insert-element ($token->{tag_name}, $token->{attributes}, $token);
4693                pop @{$self->{open_elements}};
4694                pop @{$self->{open_elements}} # <head>
4695                    if $self->{insertion_mode} == AFTER_HEAD_IM;
4696                !!!ack ('t103.2');
4697                !!!next-token;
4698                next B;
4699              } else {
4700                ## NOTE: "in head noscript" or "after head" insertion mode
4701                ## - in these cases, these tags are treated as same as
4702                ## normal in-body tags.
4703                !!!cp ('t103.3');
4704                #
4705              }
4706              } elsif ($token->{tag_name} eq 'meta') {              } elsif ($token->{tag_name} eq 'meta') {
4707                ## NOTE: There is a "as if in head" code clone.                ## NOTE: There is a "as if in head" code clone.
4708                if ($self->{insertion_mode} == AFTER_HEAD_IM) {                if ($self->{insertion_mode} == AFTER_HEAD_IM) {
# Line 6796  sub _tree_construction_main ($) { Line 6820  sub _tree_construction_main ($) {
6820          $parse_rcdata->(CDATA_CONTENT_MODEL);          $parse_rcdata->(CDATA_CONTENT_MODEL);
6821          next B;          next B;
6822        } elsif ({        } elsif ({
6823                  base => 1, link => 1,                  base => 1, command => 1, eventsource => 1, link => 1,
6824                 }->{$token->{tag_name}}) {                 }->{$token->{tag_name}}) {
6825          !!!cp ('t334');          !!!cp ('t334');
6826          ## 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
6827          !!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token);          !!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token);
6828          pop @{$self->{open_elements}}; ## ISSUE: This step is missing in the spec.          pop @{$self->{open_elements}};
6829          !!!ack ('t334.1');          !!!ack ('t334.1');
6830          !!!next-token;          !!!next-token;
6831          next B;          next B;
6832        } elsif ($token->{tag_name} eq 'meta') {        } elsif ($token->{tag_name} eq 'meta') {
6833          ## 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
6834          !!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token);          !!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token);
6835          my $meta_el = pop @{$self->{open_elements}}; ## ISSUE: This step is missing in the spec.          my $meta_el = pop @{$self->{open_elements}};
6836    
6837          unless ($self->{confident}) {          unless ($self->{confident}) {
6838            if ($token->{attributes}->{charset}) {            if ($token->{attributes}->{charset}) {
# Line 6887  sub _tree_construction_main ($) { Line 6911  sub _tree_construction_main ($) {
6911          !!!next-token;          !!!next-token;
6912          next B;          next B;
6913        } elsif ({        } elsif ({
6914                  address => 1, blockquote => 1, center => 1, dir => 1,                  ## NOTE: Start tags for non-phrasing flow content elements
6915                  div => 1, dl => 1, fieldset => 1,  
6916                  h1 => 1, h2 => 1, h3 => 1, h4 => 1, h5 => 1, h6 => 1,                  ## NOTE: The normal one
6917                  menu => 1, ol => 1, p => 1, ul => 1,                  address => 1, article => 1, aside => 1, blockquote => 1,
6918                    center => 1, datagrid => 1, details => 1, dialog => 1,
6919                    dir => 1, div => 1, dl => 1, fieldset => 1, figure => 1,
6920                    footer => 1, h1 => 1, h2 => 1, h3 => 1, h4 => 1, h5 => 1,
6921                    h6 => 1, header => 1, menu => 1, nav => 1, ol => 1, p => 1,
6922                    section => 1, ul => 1,
6923                    ## NOTE: As normal, but drops leading newline
6924                  pre => 1, listing => 1,                  pre => 1, listing => 1,
6925                    ## NOTE: As normal, but interacts with the form element pointer
6926                  form => 1,                  form => 1,
6927                    
6928                  table => 1,                  table => 1,
6929                  hr => 1,                  hr => 1,
6930                 }->{$token->{tag_name}}) {                 }->{$token->{tag_name}}) {
# Line 6959  sub _tree_construction_main ($) { Line 6991  sub _tree_construction_main ($) {
6991            !!!next-token;            !!!next-token;
6992          }          }
6993          next B;          next B;
6994        } elsif ({li => 1, dt => 1, dd => 1}->{$token->{tag_name}}) {        } elsif ({
6995                    ## NOTE: As normal, but imply </li> when there's another <li>
6996                    li => 1,
6997                    ## NOTE: As normal, but imply </dt> or </dd> when ...
6998                    dt => 1, dd => 1,
6999                   }->{$token->{tag_name}}) {
7000          ## has a p element in scope          ## has a p element in scope
7001          INSCOPE: for (reverse @{$self->{open_elements}}) {          INSCOPE: for (reverse @{$self->{open_elements}}) {
7002            if ($_->[1] & P_EL) {            if ($_->[1] & P_EL) {
# Line 7034  sub _tree_construction_main ($) { Line 7071  sub _tree_construction_main ($) {
7071          !!!next-token;          !!!next-token;
7072          next B;          next B;
7073        } elsif ($token->{tag_name} eq 'plaintext') {        } elsif ($token->{tag_name} eq 'plaintext') {
7074            ## NOTE: As normal, but effectively ends parsing
7075    
7076          ## has a p element in scope          ## has a p element in scope
7077          INSCOPE: for (reverse @{$self->{open_elements}}) {          INSCOPE: for (reverse @{$self->{open_elements}}) {
7078            if ($_->[1] & P_EL) {            if ($_->[1] & P_EL) {
# Line 7470  sub _tree_construction_main ($) { Line 7509  sub _tree_construction_main ($) {
7509            next B;            next B;
7510          }          }
7511        } elsif ({        } elsif ({
7512                  address => 1, blockquote => 1, center => 1, dir => 1,                  ## NOTE: End tags for non-phrasing flow content elements
7513                  div => 1, dl => 1, fieldset => 1, listing => 1,  
7514                  menu => 1, ol => 1, pre => 1, ul => 1,                  ## NOTE: The normal ones
7515                    address => 1, article => 1, aside => 1, blockquote => 1,
7516                    center => 1, datagrid => 1, details => 1, dialog => 1,
7517                    dir => 1, div => 1, dl => 1, fieldset => 1, figure => 1,
7518                    footer => 1, header => 1, listing => 1, menu => 1, nav => 1,
7519                    ol => 1, pre => 1, section => 1, ul => 1,
7520    
7521                    ## NOTE: As normal, but ... optional tags
7522                  dd => 1, dt => 1, li => 1,                  dd => 1, dt => 1, li => 1,
7523    
7524                  applet => 1, button => 1, marquee => 1, object => 1,                  applet => 1, button => 1, marquee => 1, object => 1,
7525                 }->{$token->{tag_name}}) {                 }->{$token->{tag_name}}) {
7526          ## has an element in scope          ## has an element in scope
# Line 7502  sub _tree_construction_main ($) { Line 7549  sub _tree_construction_main ($) {
7549                    dd => ($token->{tag_name} ne 'dd'),                    dd => ($token->{tag_name} ne 'dd'),
7550                    dt => ($token->{tag_name} ne 'dt'),                    dt => ($token->{tag_name} ne 'dt'),
7551                    li => ($token->{tag_name} ne 'li'),                    li => ($token->{tag_name} ne 'li'),
7552                      option => 1,
7553                      optgroup => 1,
7554                    p => 1,                    p => 1,
7555                    rt => 1,                    rt => 1,
7556                    rp => 1,                    rp => 1,
# Line 7534  sub _tree_construction_main ($) { Line 7583  sub _tree_construction_main ($) {
7583          !!!next-token;          !!!next-token;
7584          next B;          next B;
7585        } elsif ($token->{tag_name} eq 'form') {        } elsif ($token->{tag_name} eq 'form') {
7586            ## NOTE: As normal, but interacts with the form element pointer
7587    
7588          undef $self->{form_element};          undef $self->{form_element};
7589    
7590          ## has an element in scope          ## has an element in scope
# Line 7581  sub _tree_construction_main ($) { Line 7632  sub _tree_construction_main ($) {
7632          !!!next-token;          !!!next-token;
7633          next B;          next B;
7634        } elsif ({        } elsif ({
7635                    ## NOTE: As normal, except acts as a closer for any ...
7636                  h1 => 1, h2 => 1, h3 => 1, h4 => 1, h5 => 1, h6 => 1,                  h1 => 1, h2 => 1, h3 => 1, h4 => 1, h5 => 1, h6 => 1,
7637                 }->{$token->{tag_name}}) {                 }->{$token->{tag_name}}) {
7638          ## has an element in scope          ## has an element in scope
# Line 7626  sub _tree_construction_main ($) { Line 7678  sub _tree_construction_main ($) {
7678          !!!next-token;          !!!next-token;
7679          next B;          next B;
7680        } elsif ($token->{tag_name} eq 'p') {        } elsif ($token->{tag_name} eq 'p') {
7681            ## NOTE: As normal, except </p> implies <p> and ...
7682    
7683          ## has an element in scope          ## has an element in scope
7684          my $i;          my $i;
7685          INSCOPE: for (reverse 0..$#{$self->{open_elements}}) {          INSCOPE: for (reverse 0..$#{$self->{open_elements}}) {
# Line 7710  sub _tree_construction_main ($) { Line 7764  sub _tree_construction_main ($) {
7764          ## Ignore the token          ## Ignore the token
7765          !!!next-token;          !!!next-token;
7766          next B;          next B;
           
         ## ISSUE: Issue on HTML5 new elements in spec  
           
7767        } else {        } else {
7768            if ($token->{tag_name} eq 'sarcasm') {
7769              sleep 0.001; # take a deep breath
7770            }
7771    
7772          ## Step 1          ## Step 1
7773          my $node_i = -1;          my $node_i = -1;
7774          my $node = $self->{open_elements}->[$node_i];          my $node = $self->{open_elements}->[$node_i];

Legend:
Removed from v.1.193  
changed lines
  Added in v.1.195

[email protected]
ViewVC Help
Powered by ViewVC 1.1.24