/[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.217 by wakaba, Sun Jul 5 05:13:13 2009 UTC revision 1.234 by wakaba, Sun Sep 6 02:20:52 2009 UTC
# Line 179  my $el_category = { Line 179  my $el_category = {
179    dt => DTDD_EL,    dt => DTDD_EL,
180    em => FORMATTING_EL,    em => FORMATTING_EL,
181    embed => MISC_SPECIAL_EL,    embed => MISC_SPECIAL_EL,
   eventsource => MISC_SPECIAL_EL,  
182    fieldset => MISC_SPECIAL_EL,    fieldset => MISC_SPECIAL_EL,
183    figure => MISC_SPECIAL_EL,    figure => MISC_SPECIAL_EL,
184    font => FORMATTING_EL,    font => FORMATTING_EL,
# Line 203  my $el_category = { Line 202  my $el_category = {
202    #image => MISC_SPECIAL_EL, ## NOTE: Commented out in the spec.    #image => MISC_SPECIAL_EL, ## NOTE: Commented out in the spec.
203    input => MISC_SPECIAL_EL,    input => MISC_SPECIAL_EL,
204    isindex => MISC_SPECIAL_EL,    isindex => MISC_SPECIAL_EL,
205      ## XXX keygen? (Whether a void element is in Special or not does not
206      ## affect to the processing, however.)
207    li => LI_EL,    li => LI_EL,
208    link => MISC_SPECIAL_EL,    link => MISC_SPECIAL_EL,
209    listing => MISC_SPECIAL_EL,    listing => MISC_SPECIAL_EL,
# Line 911  sub _tree_construction_initial ($) { Line 912  sub _tree_construction_initial ($) {
912    
913    INITIAL: {    INITIAL: {
914      if ($token->{type} == DOCTYPE_TOKEN) {      if ($token->{type} == DOCTYPE_TOKEN) {
915        ## NOTE: Conformance checkers MAY, instead of reporting "not HTML5"        ## NOTE: Conformance checkers MAY, instead of reporting "not
916        ## error, switch to a conformance checking mode for another        ## HTML5" error, switch to a conformance checking mode for
917        ## language.        ## another language.  (We don't support such mode switchings; it
918          ## is nonsense to do anything different from what browsers do.)
919        my $doctype_name = $token->{name};        my $doctype_name = $token->{name};
920        $doctype_name = '' unless defined $doctype_name;        $doctype_name = '' unless defined $doctype_name;
921        $doctype_name =~ tr/a-z/A-Z/; # ASCII case-insensitive        my $doctype = $self->{document}->create_document_type_definition
922        if (not defined $token->{name} or # <!DOCTYPE>            ($doctype_name);
923            defined $token->{sysid}) {  
924          $doctype_name =~ tr/A-Z/a-z/; # ASCII case-insensitive
925          if ($doctype_name ne 'html') {
926          !!!cp ('t1');          !!!cp ('t1');
927          !!!parse-error (type => 'not HTML5', token => $token);          !!!parse-error (type => 'not HTML5', token => $token);
928        } elsif ($doctype_name ne 'HTML') {        } elsif (defined $token->{pubid}) {
929          !!!cp ('t2');          !!!cp ('t2');
930            ## XXX Obsolete permitted DOCTYPEs
931          !!!parse-error (type => 'not HTML5', token => $token);          !!!parse-error (type => 'not HTML5', token => $token);
932        } elsif (defined $token->{pubid}) {        } elsif (defined $token->{sysid}) {
933          if ($token->{pubid} eq 'XSLT-compat') {          if ($token->{sysid} eq 'about:legacy-compat') {
934            !!!cp ('t1.2');            !!!cp ('t1.2'); ## <!DOCTYPE HTML SYSTEM "about:legacy-compat">
935            !!!parse-error (type => 'XSLT-compat', token => $token,            !!!parse-error (type => 'XSLT-compat', token => $token,
936                            level => $self->{level}->{should});                            level => $self->{level}->{should});
937          } else {          } else {
938            !!!parse-error (type => 'not HTML5', token => $token);            !!!parse-error (type => 'not HTML5', token => $token);
939          }          }
940        } else {        } else { ## <!DOCTYPE HTML>
941          !!!cp ('t3');          !!!cp ('t3');
942          #          #
943        }        }
944                
       my $doctype = $self->{document}->create_document_type_definition  
         ($token->{name}); ## ISSUE: If name is missing (e.g. <!DOCTYPE>)?  
945        ## NOTE: Default value for both |public_id| and |system_id| attributes        ## NOTE: Default value for both |public_id| and |system_id| attributes
946        ## are empty strings, so that we don't set any value in missing cases.        ## are empty strings, so that we don't set any value in missing cases.
947        $doctype->public_id ($token->{pubid}) if defined $token->{pubid};        $doctype->public_id ($token->{pubid}) if defined $token->{pubid};
948        $doctype->system_id ($token->{sysid}) if defined $token->{sysid};        $doctype->system_id ($token->{sysid}) if defined $token->{sysid};
949    
950        ## NOTE: Other DocumentType attributes are null or empty lists.        ## NOTE: Other DocumentType attributes are null or empty lists.
951        ## In Firefox3, |internalSubset| attribute is set to the empty        ## In Firefox3, |internalSubset| attribute is set to the empty
952        ## string, while |null| is an allowed value for the attribute        ## string, while |null| is an allowed value for the attribute
953        ## according to DOM3 Core.        ## according to DOM3 Core.
954        $self->{document}->append_child ($doctype);        $self->{document}->append_child ($doctype);
955                
956        if ($token->{quirks} or $doctype_name ne 'HTML') {        if ($token->{quirks} or $doctype_name ne 'html') {
957          !!!cp ('t4');          !!!cp ('t4');
958          $self->{document}->manakai_compat_mode ('quirks');          $self->{document}->manakai_compat_mode ('quirks');
959        } elsif (defined $token->{pubid}) {        } elsif (defined $token->{pubid}) {
# Line 1419  sub _tree_construction_main ($) { Line 1423  sub _tree_construction_main ($) {
1423      ## Step 3      ## Step 3
1424      ## TODO: Mark as "already executed", if ...      ## TODO: Mark as "already executed", if ...
1425    
1426      ## Step 4      ## Step 4 (HTML5 revision 2702)
1427      $insert->($script_el);      $insert->($script_el);
   
     ## ISSUE: $script_el is not put into the stack  
1428      push @{$self->{open_elements}}, [$script_el, $el_category->{script}];      push @{$self->{open_elements}}, [$script_el, $el_category->{script}];
1429    
1430      ## Step 5      ## Step 5
# Line 1437  sub _tree_construction_main ($) { Line 1439  sub _tree_construction_main ($) {
1439    }; # $script_start_tag    }; # $script_start_tag
1440    
1441    ## NOTE: $open_tables->[-1]->[0] is the "current table" element node.    ## NOTE: $open_tables->[-1]->[0] is the "current table" element node.
1442    ## NOTE: $open_tables->[-1]->[1] is the "tainted" flag.    ## NOTE: $open_tables->[-1]->[1] is the "tainted" flag (OBSOLETE; unused).
1443    ## NOTE: $open_tables->[-1]->[2] is set false when non-Text node inserted.    ## NOTE: $open_tables->[-1]->[2] is set false when non-Text node inserted.
1444    my $open_tables = [[$self->{open_elements}->[0]->[0]]];    my $open_tables = [[$self->{open_elements}->[0]->[0]]];
1445    
# Line 1607  sub _tree_construction_main ($) { Line 1609  sub _tree_construction_main ($) {
1609                
1610        ## Step 8        ## Step 8
1611        if ($common_ancestor_node->[1] & TABLE_ROWS_EL) {        if ($common_ancestor_node->[1] & TABLE_ROWS_EL) {
1612            ## Foster parenting.
1613          my $foster_parent_element;          my $foster_parent_element;
1614          my $next_sibling;          my $next_sibling;
1615          OE: for (reverse 0..$#{$self->{open_elements}}) {          OE: for (reverse 0..$#{$self->{open_elements}}) {
1616            if ($self->{open_elements}->[$_]->[1] == TABLE_EL) {            if ($self->{open_elements}->[$_]->[1] == TABLE_EL) {
1617                               my $parent = $self->{open_elements}->[$_]->[0]->parent_node;              !!!cp ('t65.2');
1618                               if (defined $parent and $parent->node_type == 1) {              $foster_parent_element = $self->{open_elements}->[$_ - 1]->[0];
1619                                 !!!cp ('t65.1');              $next_sibling = $self->{open_elements}->[$_]->[0];
1620                                 $foster_parent_element = $parent;              undef $next_sibling
1621                                 $next_sibling = $self->{open_elements}->[$_]->[0];                  unless $next_sibling->parent_node eq $foster_parent_element;
1622                               } else {              last OE;
1623                                 !!!cp ('t65.2');            }
1624                                 $foster_parent_element          } # OE
1625                                   = $self->{open_elements}->[$_ - 1]->[0];          $foster_parent_element ||= $self->{open_elements}->[0]->[0];
1626                               }  
                              last OE;  
                            }  
                          } # OE  
                          $foster_parent_element = $self->{open_elements}->[0]->[0]  
                            unless defined $foster_parent_element;  
1627          $foster_parent_element->insert_before ($last_node->[0], $next_sibling);          $foster_parent_element->insert_before ($last_node->[0], $next_sibling);
1628          $open_tables->[-1]->[1] = 1; # tainted          $open_tables->[-1]->[1] = 1; # tainted
1629        } else {        } else {
# Line 1681  sub _tree_construction_main ($) { Line 1679  sub _tree_construction_main ($) {
1679      $self->{open_elements}->[-1]->[0]->append_child ($_[0]);      $self->{open_elements}->[-1]->[0]->append_child ($_[0]);
1680    }; # $insert_to_current    }; # $insert_to_current
1681    
1682      ## Foster parenting.  Note that there are three "foster parenting"
1683      ## code in the parser: for elements (this one), for texts, and for
1684      ## elements in the AAA code.
1685    my $insert_to_foster = sub {    my $insert_to_foster = sub {
1686      my $child = shift;      my $child = shift;
1687      if ($self->{open_elements}->[-1]->[1] & TABLE_ROWS_EL) {      if ($self->{open_elements}->[-1]->[1] & TABLE_ROWS_EL) {
# Line 1689  sub _tree_construction_main ($) { Line 1690  sub _tree_construction_main ($) {
1690        my $next_sibling;        my $next_sibling;
1691        OE: for (reverse 0..$#{$self->{open_elements}}) {        OE: for (reverse 0..$#{$self->{open_elements}}) {
1692          if ($self->{open_elements}->[$_]->[1] == TABLE_EL) {          if ($self->{open_elements}->[$_]->[1] == TABLE_EL) {
1693                               my $parent = $self->{open_elements}->[$_]->[0]->parent_node;            !!!cp ('t71');
1694                               if (defined $parent and $parent->node_type == 1) {            $foster_parent_element = $self->{open_elements}->[$_ - 1]->[0];
1695                                 !!!cp ('t70');            $next_sibling = $self->{open_elements}->[$_]->[0];
1696                                 $foster_parent_element = $parent;            undef $next_sibling
1697                                 $next_sibling = $self->{open_elements}->[$_]->[0];                unless $next_sibling->parent_node eq $foster_parent_element;
1698                               } else {            last OE;
1699                                 !!!cp ('t71');          }
1700                                 $foster_parent_element        } # OE
1701                                   = $self->{open_elements}->[$_ - 1]->[0];        $foster_parent_element ||= $self->{open_elements}->[0]->[0];
1702                               }  
1703                               last OE;        $foster_parent_element->insert_before ($child, $next_sibling);
                            }  
                          } # OE  
                          $foster_parent_element = $self->{open_elements}->[0]->[0]  
                            unless defined $foster_parent_element;  
                          $foster_parent_element->insert_before  
                            ($child, $next_sibling);  
1704        $open_tables->[-1]->[1] = 1; # tainted        $open_tables->[-1]->[1] = 1; # tainted
1705      } else {      } else {
1706        !!!cp ('t72');        !!!cp ('t72');
# Line 1733  sub _tree_construction_main ($) { Line 1728  sub _tree_construction_main ($) {
1728    ## document.write ("b")</script>|    ## document.write ("b")</script>|
1729    
1730    B: while (1) {    B: while (1) {
1731    
1732        ## The "in table text" insertion mode.
1733        if ($self->{insertion_mode} & TABLE_IMS and
1734            not $self->{insertion_mode} & IN_FOREIGN_CONTENT_IM and
1735            not $self->{insertion_mode} & IN_CDATA_RCDATA_IM) {
1736          C: {
1737            my $s;
1738            if ($token->{type} == CHARACTER_TOKEN) {
1739              !!!cp ('t194');
1740              $self->{pending_chars} ||= [];
1741              push @{$self->{pending_chars}}, $token;
1742              !!!next-token;
1743              next B;
1744            } else {
1745              if ($self->{pending_chars}) {
1746                $s = join '', map { $_->{data} } @{$self->{pending_chars}};
1747                delete $self->{pending_chars};
1748                if ($s =~ /[^\x09\x0A\x0C\x0D\x20]/) {
1749                  !!!cp ('t195');
1750                  #
1751                } else {
1752                  !!!cp ('t195.1');
1753                  #$self->{open_elements}->[-1]->[0]->manakai_append_text ($s);
1754                  $self->{open_elements}->[-1]->[0]->append_child
1755                      ($self->{document}->create_text_node ($s));
1756                  last C;
1757                }
1758              } else {
1759                !!!cp ('t195.2');
1760                last C;
1761              }
1762            }
1763    
1764            ## Foster parenting.
1765            !!!parse-error (type => 'in table:#text', token => $token);
1766    
1767            ## NOTE: As if in body, but insert into the foster parent element.
1768            $reconstruct_active_formatting_elements->($insert_to_foster);
1769                
1770            if ($self->{open_elements}->[-1]->[1] & TABLE_ROWS_EL) {
1771              # MUST
1772              my $foster_parent_element;
1773              my $next_sibling;
1774              OE: for (reverse 0..$#{$self->{open_elements}}) {
1775                if ($self->{open_elements}->[$_]->[1] == TABLE_EL) {
1776                  !!!cp ('t197');
1777                  $foster_parent_element = $self->{open_elements}->[$_ - 1]->[0];
1778                  $next_sibling = $self->{open_elements}->[$_]->[0];
1779                  undef $next_sibling
1780                    unless $next_sibling->parent_node eq $foster_parent_element;
1781                  last OE;
1782                }
1783              } # OE
1784              $foster_parent_element ||= $self->{open_elements}->[0]->[0];
1785    
1786              !!!cp ('t199');
1787              $foster_parent_element->insert_before
1788                  ($self->{document}->create_text_node ($s), $next_sibling);
1789    
1790              $open_tables->[-1]->[1] = 1; # tainted
1791              $open_tables->[-1]->[2] = 1; # ~node inserted
1792            } else {
1793              ## NOTE: Fragment case or in a foster parent'ed element
1794              ## (e.g. |<table><span>a|).  In fragment case, whether the
1795              ## character is appended to existing node or a new node is
1796              ## created is irrelevant, since the foster parent'ed nodes
1797              ## are discarded and fragment parsing does not invoke any
1798              ## script.
1799              !!!cp ('t200');
1800              $self->{open_elements}->[-1]->[0]->manakai_append_text ($s);
1801            }
1802          } # C
1803        } # TABLE_IMS
1804    
1805      if ($token->{type} == DOCTYPE_TOKEN) {      if ($token->{type} == DOCTYPE_TOKEN) {
1806        !!!cp ('t73');        !!!cp ('t73');
1807        !!!parse-error (type => 'in html:#DOCTYPE', token => $token);        !!!parse-error (type => 'in html:#DOCTYPE', token => $token);
# Line 1874  sub _tree_construction_main ($) { Line 1943  sub _tree_construction_main ($) {
1943          } elsif ({          } elsif ({
1944                    b => 1, big => 1, blockquote => 1, body => 1, br => 1,                    b => 1, big => 1, blockquote => 1, body => 1, br => 1,
1945                    center => 1, code => 1, dd => 1, div => 1, dl => 1, dt => 1,                    center => 1, code => 1, dd => 1, div => 1, dl => 1, dt => 1,
1946                    em => 1, embed => 1, font => 1, h1 => 1, h2 => 1, h3 => 1,                    em => 1, embed => 1, h1 => 1, h2 => 1, h3 => 1,
1947                    h4 => 1, h5 => 1, h6 => 1, head => 1, hr => 1, i => 1,                    h4 => 1, h5 => 1, h6 => 1, head => 1, hr => 1, i => 1,
1948                    img => 1, li => 1, listing => 1, menu => 1, meta => 1,                    img => 1, li => 1, listing => 1, menu => 1, meta => 1,
1949                    nobr => 1, ol => 1, p => 1, pre => 1, ruby => 1, s => 1,                    nobr => 1, ol => 1, p => 1, pre => 1, ruby => 1, s => 1,
1950                    small => 1, span => 1, strong => 1, strike => 1, sub => 1,                    small => 1, span => 1, strong => 1, strike => 1, sub => 1,
1951                    sup => 1, table => 1, tt => 1, u => 1, ul => 1, var => 1,                    sup => 1, table => 1, tt => 1, u => 1, ul => 1, var => 1,
1952                   }->{$token->{tag_name}}) {                   }->{$token->{tag_name}} or
1953                     ($token->{tag_name} eq 'font' and
1954                      ($token->{attributes}->{color} or
1955                       $token->{attributes}->{face} or
1956                       $token->{attributes}->{size}))) {
1957            !!!cp ('t87.2');            !!!cp ('t87.2');
1958            !!!parse-error (type => 'not closed',            !!!parse-error (type => 'not closed',
1959                            text => $self->{open_elements}->[-1]->[0]                            text => $self->{open_elements}->[-1]->[0]
# Line 1956  sub _tree_construction_main ($) { Line 2029  sub _tree_construction_main ($) {
2029          }          }
2030        } elsif ($token->{type} == END_TAG_TOKEN) {        } elsif ($token->{type} == END_TAG_TOKEN) {
2031          ## NOTE: "using the rules for secondary insertion mode" then "continue"          ## NOTE: "using the rules for secondary insertion mode" then "continue"
2032          !!!cp ('t87.5');          if ($token->{tag_name} eq 'script') {
2033          #            !!!cp ('t87.41');
2034              #
2035              ## XXXscript: Execute script here.
2036            } else {
2037              !!!cp ('t87.5');
2038              #
2039            }
2040        } elsif ($token->{type} == END_OF_FILE_TOKEN) {        } elsif ($token->{type} == END_OF_FILE_TOKEN) {
2041          !!!cp ('t87.6');          !!!cp ('t87.6');
2042          !!!parse-error (type => 'not closed',          !!!parse-error (type => 'not closed',
# Line 2141  sub _tree_construction_main ($) { Line 2220  sub _tree_construction_main ($) {
2220            !!!ack ('t103.1');            !!!ack ('t103.1');
2221            !!!next-token;            !!!next-token;
2222            next B;            next B;
2223          } elsif ($token->{tag_name} eq 'command' or          } elsif ($token->{tag_name} eq 'command') {
                  $token->{tag_name} eq 'eventsource') {  
2224            if ($self->{insertion_mode} == IN_HEAD_IM) {            if ($self->{insertion_mode} == IN_HEAD_IM) {
2225              ## NOTE: If the insertion mode at the time of the emission              ## NOTE: If the insertion mode at the time of the emission
2226              ## of the token was "before head", $self->{insertion_mode}              ## of the token was "before head", $self->{insertion_mode}
# Line 2257  sub _tree_construction_main ($) { Line 2335  sub _tree_construction_main ($) {
2335    
2336            ## NOTE: There is a "as if in head" code clone.            ## NOTE: There is a "as if in head" code clone.
2337            $parse_rcdata->(RCDATA_CONTENT_MODEL);            $parse_rcdata->(RCDATA_CONTENT_MODEL);
2338            ## ISSUE: A spec bug [Bug 6038]  
2339              ## NOTE: At this point the stack of open elements contain
2340              ## the |head| element (index == -2) and the |script| element
2341              ## (index == -1).  In the "after head" insertion mode the
2342              ## |head| element is inserted only for the purpose of
2343              ## providing the context for the |script| element, and
2344              ## therefore we can now and have to remove the element from
2345              ## the stack.
2346            splice @{$self->{open_elements}}, -2, 1, () # <head>            splice @{$self->{open_elements}}, -2, 1, () # <head>
2347                if ($self->{insertion_mode} & IM_MASK) == AFTER_HEAD_IM;                if ($self->{insertion_mode} & IM_MASK) == AFTER_HEAD_IM;
2348            next B;            next B;
# Line 2492  sub _tree_construction_main ($) { Line 2577  sub _tree_construction_main ($) {
2577                ## Ignore the token                ## Ignore the token
2578                !!!next-token;                !!!next-token;
2579                next B;                next B;
2580              } elsif ($token->{tag_name} eq 'br') {          } elsif ($token->{tag_name} eq 'br') {
2581                if ($self->{insertion_mode} == BEFORE_HEAD_IM) {            if ($self->{insertion_mode} == BEFORE_HEAD_IM) {
2582                  !!!cp ('t142.2');              !!!cp ('t142.2');
2583                  ## (before head) as if <head>, (in head) as if </head>              ## (before head) as if <head>, (in head) as if </head>
2584                  !!!create-element ($self->{head_element}, $HTML_NS, 'head',, $token);              !!!create-element ($self->{head_element}, $HTML_NS, 'head',, $token);
2585                  $self->{open_elements}->[-1]->[0]->append_child ($self->{head_element});              $self->{open_elements}->[-1]->[0]->append_child ($self->{head_element});
2586                  $self->{insertion_mode} = AFTER_HEAD_IM;              $self->{insertion_mode} = AFTER_HEAD_IM;
2587        
2588                  ## Reprocess in the "after head" insertion mode...              ## Reprocess in the "after head" insertion mode...
2589                } elsif ($self->{insertion_mode} == IN_HEAD_IM) {            } elsif ($self->{insertion_mode} == IN_HEAD_IM) {
2590                  !!!cp ('t143.2');              !!!cp ('t143.2');
2591                  ## As if </head>              ## As if </head>
2592                  pop @{$self->{open_elements}};              pop @{$self->{open_elements}};
2593                  $self->{insertion_mode} = AFTER_HEAD_IM;              $self->{insertion_mode} = AFTER_HEAD_IM;
2594        
2595                  ## Reprocess in the "after head" insertion mode...              ## Reprocess in the "after head" insertion mode...
2596                } elsif ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) {            } elsif ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) {
2597                  !!!cp ('t143.3');              !!!cp ('t143.3');
2598                  ## NOTE: Two parse errors for <head><noscript></br>              ## NOTE: Two parse errors for <head><noscript></br>
2599                  !!!parse-error (type => 'unmatched end tag',              !!!parse-error (type => 'unmatched end tag',
2600                                  text => 'br', token => $token);                              text => 'br', token => $token);
2601                  ## As if </noscript>              ## As if </noscript>
2602                  pop @{$self->{open_elements}};              pop @{$self->{open_elements}};
2603                  $self->{insertion_mode} = IN_HEAD_IM;              $self->{insertion_mode} = IN_HEAD_IM;
2604    
2605                  ## Reprocess in the "in head" insertion mode...              ## Reprocess in the "in head" insertion mode...
2606                  ## As if </head>              ## As if </head>
2607                  pop @{$self->{open_elements}};              pop @{$self->{open_elements}};
2608                  $self->{insertion_mode} = AFTER_HEAD_IM;              $self->{insertion_mode} = AFTER_HEAD_IM;
2609    
2610                  ## Reprocess in the "after head" insertion mode...              ## Reprocess in the "after head" insertion mode...
2611                } elsif ($self->{insertion_mode} == AFTER_HEAD_IM) {            } elsif ($self->{insertion_mode} == AFTER_HEAD_IM) {
2612                  !!!cp ('t143.4');              !!!cp ('t143.4');
2613                  #              #
2614                } else {            } else {
2615                  die "$0: $self->{insertion_mode}: Unknown insertion mode";              die "$0: $self->{insertion_mode}: Unknown insertion mode";
2616                }            }
2617    
2618                ## ISSUE: does not agree with IE7 - it doesn't ignore </br>.            #
2619                !!!parse-error (type => 'unmatched end tag',          } else { ## Other end tags
                               text => 'br', token => $token);  
               ## Ignore the token  
               !!!next-token;  
               next B;  
             } else {  
2620                !!!cp ('t145');                !!!cp ('t145');
2621                !!!parse-error (type => 'unmatched end tag',                !!!parse-error (type => 'unmatched end tag',
2622                                text => $token->{tag_name}, token => $token);                                text => $token->{tag_name}, token => $token);
# Line 2580  sub _tree_construction_main ($) { Line 2660  sub _tree_construction_main ($) {
2660              !!!insert-element ('body',, $token);              !!!insert-element ('body',, $token);
2661              $self->{insertion_mode} = IN_BODY_IM;              $self->{insertion_mode} = IN_BODY_IM;
2662              ## reprocess              ## reprocess
2663              next B;          next B;
2664        } elsif ($token->{type} == END_OF_FILE_TOKEN) {        } elsif ($token->{type} == END_OF_FILE_TOKEN) {
2665          if ($self->{insertion_mode} == BEFORE_HEAD_IM) {          if ($self->{insertion_mode} == BEFORE_HEAD_IM) {
2666            !!!cp ('t149.1');            !!!cp ('t149.1');
# Line 3008  sub _tree_construction_main ($) { Line 3088  sub _tree_construction_main ($) {
3088        $insert = $insert_to_current;        $insert = $insert_to_current;
3089        #        #
3090      } elsif ($self->{insertion_mode} & TABLE_IMS) {      } elsif ($self->{insertion_mode} & TABLE_IMS) {
3091        if ($token->{type} == CHARACTER_TOKEN) {        if ($token->{type} == START_TAG_TOKEN) {
         if (not $open_tables->[-1]->[1] and # tainted  
             $token->{data} =~ s/^([\x09\x0A\x0C\x20]+)//) {  
           $self->{open_elements}->[-1]->[0]->manakai_append_text ($1);  
                 
           unless (length $token->{data}) {  
             !!!cp ('t194');  
             !!!next-token;  
             next B;  
           } else {  
             !!!cp ('t195');  
           }  
         }  
   
         !!!parse-error (type => 'in table:#text', token => $token);  
   
         ## NOTE: As if in body, but insert into the foster parent element.  
         $reconstruct_active_formatting_elements->($insert_to_foster);  
               
         if ($self->{open_elements}->[-1]->[1] & TABLE_ROWS_EL) {  
           # MUST  
           my $foster_parent_element;  
           my $next_sibling;  
           my $prev_sibling;  
           OE: for (reverse 0..$#{$self->{open_elements}}) {  
             if ($self->{open_elements}->[$_]->[1] == TABLE_EL) {  
               my $parent = $self->{open_elements}->[$_]->[0]->parent_node;  
               if (defined $parent and $parent->node_type == 1) {  
                 $foster_parent_element = $parent;  
                 !!!cp ('t196');  
                 $next_sibling = $self->{open_elements}->[$_]->[0];  
                 $prev_sibling = $next_sibling->previous_sibling;  
                 #  
               } else {  
                 !!!cp ('t197');  
                 $foster_parent_element = $self->{open_elements}->[$_ - 1]->[0];  
                 $prev_sibling = $foster_parent_element->last_child;  
                 #  
               }  
               last OE;  
             }  
           } # OE  
           $foster_parent_element = $self->{open_elements}->[0]->[0] and  
           $prev_sibling = $foster_parent_element->last_child  
               unless defined $foster_parent_element;  
           undef $prev_sibling unless $open_tables->[-1]->[2]; # ~node inserted  
           if (defined $prev_sibling and  
               $prev_sibling->node_type == 3) {  
             !!!cp ('t198');  
             $prev_sibling->manakai_append_text ($token->{data});  
           } else {  
             !!!cp ('t199');  
             $foster_parent_element->insert_before  
                 ($self->{document}->create_text_node ($token->{data}),  
                  $next_sibling);  
           }  
           $open_tables->[-1]->[1] = 1; # tainted  
           $open_tables->[-1]->[2] = 1; # ~node inserted  
         } else {  
           ## NOTE: Fragment case or in a foster parent'ed element  
           ## (e.g. |<table><span>a|).  In fragment case, whether the  
           ## character is appended to existing node or a new node is  
           ## created is irrelevant, since the foster parent'ed nodes  
           ## are discarded and fragment parsing does not invoke any  
           ## script.  
           !!!cp ('t200');  
           $self->{open_elements}->[-1]->[0]->manakai_append_text  
               ($token->{data});  
         }  
               
         !!!next-token;  
         next B;  
       } elsif ($token->{type} == START_TAG_TOKEN) {  
3092          if ({          if ({
3093               tr => (($self->{insertion_mode} & IM_MASK) != IN_ROW_IM),               tr => (($self->{insertion_mode} & IM_MASK) != IN_ROW_IM),
3094               th => 1, td => 1,               th => 1, td => 1,
# Line 3348  sub _tree_construction_main ($) { Line 3356  sub _tree_construction_main ($) {
3356            !!!ack-later;            !!!ack-later;
3357            next B;            next B;
3358          } elsif ($token->{tag_name} eq 'style') {          } elsif ($token->{tag_name} eq 'style') {
3359            if (not $open_tables->[-1]->[1]) { # tainted            !!!cp ('t227.8');
3360              !!!cp ('t227.8');            ## NOTE: This is a "as if in head" code clone.
3361              ## NOTE: This is a "as if in head" code clone.            $parse_rcdata->(CDATA_CONTENT_MODEL);
3362              $parse_rcdata->(CDATA_CONTENT_MODEL);            $open_tables->[-1]->[2] = 0 if @$open_tables; # ~node inserted
3363              $open_tables->[-1]->[2] = 0 if @$open_tables; # ~node inserted            next B;
             next B;  
           } else {  
             !!!cp ('t227.7');  
             #  
           }  
3364          } elsif ($token->{tag_name} eq 'script') {          } elsif ($token->{tag_name} eq 'script') {
3365            if (not $open_tables->[-1]->[1]) { # tainted            !!!cp ('t227.6');
3366              !!!cp ('t227.6');            ## NOTE: This is a "as if in head" code clone.
3367              ## NOTE: This is a "as if in head" code clone.            $script_start_tag->();
3368              $script_start_tag->();            $open_tables->[-1]->[2] = 0 if @$open_tables; # ~node inserted
3369              $open_tables->[-1]->[2] = 0 if @$open_tables; # ~node inserted            next B;
             next B;  
           } else {  
             !!!cp ('t227.5');  
             #  
           }  
3370          } elsif ($token->{tag_name} eq 'input') {          } elsif ($token->{tag_name} eq 'input') {
3371            if (not $open_tables->[-1]->[1]) { # tainted            if ($token->{attributes}->{type}) {
3372              if ($token->{attributes}->{type}) { ## TODO: case              my $type = $token->{attributes}->{type}->{value};
3373                my $type = lc $token->{attributes}->{type}->{value};              $type =~ tr/A-Z/a-z/; ## ASCII case-insensitive.
3374                if ($type eq 'hidden') {              if ($type eq 'hidden') {
3375                  !!!cp ('t227.3');                !!!cp ('t227.3');
3376                  !!!parse-error (type => 'in table',                !!!parse-error (type => 'in table',
3377                                  text => $token->{tag_name}, token => $token);                                text => $token->{tag_name}, token => $token);
3378    
3379                  !!!insert-element ($token->{tag_name}, $token->{attributes}, $token);                !!!insert-element ($token->{tag_name}, $token->{attributes}, $token);
3380                  $open_tables->[-1]->[2] = 0 if @$open_tables; # ~node inserted                $open_tables->[-1]->[2] = 0 if @$open_tables; # ~node inserted
3381    
3382                  ## TODO: form element pointer                ## TODO: form element pointer
3383    
3384                  pop @{$self->{open_elements}};                pop @{$self->{open_elements}};
3385    
3386                  !!!next-token;                !!!next-token;
3387                  !!!ack ('t227.2.1');                !!!ack ('t227.2.1');
3388                  next B;                next B;
               } else {  
                 !!!cp ('t227.2');  
                 #  
               }  
3389              } else {              } else {
3390                !!!cp ('t227.1');                !!!cp ('t227.1');
3391                #                #
# Line 3846  sub _tree_construction_main ($) { Line 3840  sub _tree_construction_main ($) {
3840                     tbody => 1, tfoot => 1, thead => 1,                     tbody => 1, tfoot => 1, thead => 1,
3841                     tr => 1, td => 1, th => 1,                     tr => 1, td => 1, th => 1,
3842                    }->{$token->{tag_name}})) {                    }->{$token->{tag_name}})) {
3843            ## TODO: The type below is not good - <select> is replaced by </select>  
3844            !!!parse-error (type => 'not closed', text => 'select',            ## 1. Parse error.
3845                            token => $token);            if ($token->{tag_name} eq 'select') {
3846            ## NOTE: As if the token were </select> (<select> case) or                !!!parse-error (type => 'select in select', ## XXX: documentation
3847            ## as if there were </select> (otherwise).                                token => $token);
3848            ## have an element in table scope            } else {
3849                !!!parse-error (type => 'not closed', text => 'select',
3850                                token => $token);
3851              }
3852    
3853              ## 2./<select>-1. Unless "have an element in table scope" (select):
3854            my $i;            my $i;
3855            INSCOPE: for (reverse 0..$#{$self->{open_elements}}) {            INSCOPE: for (reverse 0..$#{$self->{open_elements}}) {
3856              my $node = $self->{open_elements}->[$_];              my $node = $self->{open_elements}->[$_];
# Line 3866  sub _tree_construction_main ($) { Line 3865  sub _tree_construction_main ($) {
3865            } # INSCOPE            } # INSCOPE
3866            unless (defined $i) {            unless (defined $i) {
3867              !!!cp ('t280');              !!!cp ('t280');
3868              !!!parse-error (type => 'unmatched end tag',              if ($token->{tag_name} eq 'select') {
3869                              text => 'select', token => $token);                ## NOTE: This error would be raised when
3870              ## Ignore the token                ## |select.innerHTML = '<select>'| is executed; in this
3871                  ## case two errors, "select in select" and "unmatched
3872                  ## end tags" are reported to the user, the latter might
3873                  ## be confusing but this is what the spec requires.
3874                  !!!parse-error (type => 'unmatched end tag',
3875                                  text => 'select',
3876                                  token => $token);
3877                }
3878                ## Ignore the token.
3879              !!!nack ('t280.1');              !!!nack ('t280.1');
3880              !!!next-token;              !!!next-token;
3881              next B;              next B;
3882            }            }
3883    
3884              ## 3. Otherwise, as if there were <select>:
3885                                
3886            !!!cp ('t281');            !!!cp ('t281');
3887            splice @{$self->{open_elements}}, $i;            splice @{$self->{open_elements}}, $i;
# Line 3889  sub _tree_construction_main ($) { Line 3898  sub _tree_construction_main ($) {
3898              ## Reprocess the token.              ## Reprocess the token.
3899              next B;              next B;
3900            }            }
3901            } elsif ($token->{tag_name} eq 'script') {
3902              !!!cp ('t281.3');
3903              ## NOTE: This is an "as if in head" code clone
3904              $script_start_tag->();
3905              next B;
3906          } else {          } else {
3907            !!!cp ('t282');            !!!cp ('t282');
3908            !!!parse-error (type => 'in select',            !!!parse-error (type => 'in select',
# Line 4300  sub _tree_construction_main ($) { Line 4314  sub _tree_construction_main ($) {
4314          $parse_rcdata->(CDATA_CONTENT_MODEL);          $parse_rcdata->(CDATA_CONTENT_MODEL);
4315          next B;          next B;
4316        } elsif ({        } elsif ({
4317                  base => 1, command => 1, eventsource => 1, link => 1,                  base => 1, command => 1, link => 1,
4318                 }->{$token->{tag_name}}) {                 }->{$token->{tag_name}}) {
4319          !!!cp ('t334');          !!!cp ('t334');
4320          ## 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
# Line 4408  sub _tree_construction_main ($) { Line 4422  sub _tree_construction_main ($) {
4422                  table => 1,                  table => 1,
4423                  hr => 1,                  hr => 1,
4424                 }->{$token->{tag_name}}) {                 }->{$token->{tag_name}}) {
4425    
4426            ## 1. When there is an opening |form| element:
4427          if ($token->{tag_name} eq 'form' and defined $self->{form_element}) {          if ($token->{tag_name} eq 'form' and defined $self->{form_element}) {
4428            !!!cp ('t350');            !!!cp ('t350');
4429            !!!parse-error (type => 'in form:form', token => $token);            !!!parse-error (type => 'in form:form', token => $token);
# Line 4417  sub _tree_construction_main ($) { Line 4433  sub _tree_construction_main ($) {
4433            next B;            next B;
4434          }          }
4435    
4436            ## 2. Close the |p| element, if any.
4437          if ($token->{tag_name} ne 'table' or # The Hixie Quirk          if ($token->{tag_name} ne 'table' or # The Hixie Quirk
4438              $self->{document}->manakai_compat_mode ne 'quirks') {              $self->{document}->manakai_compat_mode ne 'quirks') {
4439            ## has a p element in scope            ## has a p element in scope
# Line 4433  sub _tree_construction_main ($) { Line 4450  sub _tree_construction_main ($) {
4450              }              }
4451            } # INSCOPE            } # INSCOPE
4452          }          }
4453              
4454            ## 3. Close the opening <hn> element, if any.
4455            if ({h1 => 1, h2 => 1, h3 => 1,
4456                 h4 => 1, h5 => 1, h6 => 1}->{$token->{tag_name}}) {
4457              if ($self->{open_elements}->[-1]->[1] == HEADING_EL) {
4458                !!!parse-error (type => 'not closed',
4459                                text => $self->{open_elements}->[-1]->[0]->manakai_local_name,
4460                                token => $token);
4461                pop @{$self->{open_elements}};
4462              }
4463            }
4464    
4465            ## 4. Insertion.
4466          !!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token);          !!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token);
4467          if ($token->{tag_name} eq 'pre' or $token->{tag_name} eq 'listing') {          if ($token->{tag_name} eq 'pre' or $token->{tag_name} eq 'listing') {
4468            !!!nack ('t346.1');            !!!nack ('t346.1');
# Line 4477  sub _tree_construction_main ($) { Line 4506  sub _tree_construction_main ($) {
4506        } elsif ($token->{tag_name} eq 'li') {        } elsif ($token->{tag_name} eq 'li') {
4507          ## NOTE: As normal, but imply </li> when there's another <li> ...          ## NOTE: As normal, but imply </li> when there's another <li> ...
4508    
4509          ## NOTE: Special, Scope (<li><foo><li> == <li><foo><li/></foo></li>)          ## NOTE: Special, Scope (<li><foo><li> == <li><foo><li/></foo></li>)::
4510            ## Interpreted as <li><foo/></li><li/> (non-conforming)            ## Interpreted as <li><foo/></li><li/> (non-conforming):
4511            ## blockquote (O9.27), center (O), dd (Fx3, O, S3.1.2, IE7),            ## blockquote (O9.27), center (O), dd (Fx3, O, S3.1.2, IE7),
4512            ## dt (Fx, O, S, IE), dl (O), fieldset (O, S, IE), form (Fx, O, S),            ## dt (Fx, O, S, IE), dl (O), fieldset (O, S, IE), form (Fx, O, S),
4513            ## hn (O), pre (O), applet (O, S), button (O, S), marquee (Fx, O, S),            ## hn (O), pre (O), applet (O, S), button (O, S), marquee (Fx, O, S),
4514            ## object (Fx)            ## object (Fx)
4515            ## Generate non-tree (non-conforming)            ## Generate non-tree (non-conforming):
4516            ## basefont (IE7 (where basefont is non-void)), center (IE),            ## basefont (IE7 (where basefont is non-void)), center (IE),
4517            ## form (IE), hn (IE)            ## form (IE), hn (IE)
4518          ## address, div, p (<li><foo><li> == <li><foo/></li><li/>)          ## address, div, p (<li><foo><li> == <li><foo/></li><li/>)::
4519            ## Interpreted as <li><foo><li/></foo></li> (non-conforming)            ## Interpreted as <li><foo><li/></foo></li> (non-conforming):
4520            ## div (Fx, S)            ## div (Fx, S)
4521    
4522          my $non_optional;          my $non_optional;
# Line 4834  sub _tree_construction_main ($) { Line 4863  sub _tree_construction_main ($) {
4863            next B;            next B;
4864          }          }
4865        } elsif ($token->{tag_name} eq 'textarea') {        } elsif ($token->{tag_name} eq 'textarea') {
4866          ## Step 1          ## 1. Insert
4867          !!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token);          !!!insert-element-t ($token->{tag_name}, $token->{attributes}, $token);
4868                    
4869          ## Step 2          ## Step 2 # XXX
4870          ## TODO: $self->{form_element} if defined          ## TODO: $self->{form_element} if defined
4871    
4872          ## Step 3          ## 2. Drop U+000A LINE FEED
4873          $self->{ignore_newline} = 1;          $self->{ignore_newline} = 1;
4874    
4875          ## Step 4          ## 3. RCDATA
         ## ISSUE: This step is wrong. (r2302 enbugged)  
   
         ## Step 5  
4876          $self->{content_model} = RCDATA_CONTENT_MODEL;          $self->{content_model} = RCDATA_CONTENT_MODEL;
4877          delete $self->{escape}; # MUST          delete $self->{escape}; # MUST
4878    
4879          ## Step 6-7          ## 4., 6. Insertion mode
4880          $self->{insertion_mode} |= IN_CDATA_RCDATA_IM;          $self->{insertion_mode} |= IN_CDATA_RCDATA_IM;
4881    
4882            ## XXX: 5. frameset-ok flag
4883    
4884          !!!nack ('t392.1');          !!!nack ('t392.1');
4885          !!!next-token;          !!!next-token;
4886          next B;          next B;
# Line 4998  sub _tree_construction_main ($) { Line 5026  sub _tree_construction_main ($) {
5026          } elsif ({          } elsif ({
5027                    area => 1, basefont => 1, bgsound => 1, br => 1,                    area => 1, basefont => 1, bgsound => 1, br => 1,
5028                    embed => 1, img => 1, spacer => 1, wbr => 1,                    embed => 1, img => 1, spacer => 1, wbr => 1,
5029                      keygen => 1,
5030                   }->{$token->{tag_name}}) {                   }->{$token->{tag_name}}) {
5031            !!!cp ('t388.1');            !!!cp ('t388.1');
5032            pop @{$self->{open_elements}};            pop @{$self->{open_elements}};
# Line 5024  sub _tree_construction_main ($) { Line 5053  sub _tree_construction_main ($) {
5053        }        }
5054      } elsif ($token->{type} == END_TAG_TOKEN) {      } elsif ($token->{type} == END_TAG_TOKEN) {
5055        if ($token->{tag_name} eq 'body') {        if ($token->{tag_name} eq 'body') {
5056          ## has a |body| element in scope  
5057            ## 1. If not "have an element in scope":
5058            ## "has a |body| element in scope"
5059          my $i;          my $i;
5060          INSCOPE: {          INSCOPE: {
5061            for (reverse @{$self->{open_elements}}) {            for (reverse @{$self->{open_elements}}) {
# Line 5047  sub _tree_construction_main ($) { Line 5078  sub _tree_construction_main ($) {
5078            next B;            next B;
5079          } # INSCOPE          } # INSCOPE
5080    
5081            ## 2. If unclosed elements:
5082          for (@{$self->{open_elements}}) {          for (@{$self->{open_elements}}) {
5083            unless ($_->[1] & ALL_END_TAG_OPTIONAL_EL) {            unless ($_->[1] & ALL_END_TAG_OPTIONAL_EL ||
5084                      $_->[1] == OPTGROUP_EL ||
5085                      $_->[1] == OPTION_EL ||
5086                      $_->[1] == RUBY_COMPONENT_EL) {
5087              !!!cp ('t403');              !!!cp ('t403');
5088              !!!parse-error (type => 'not closed',              !!!parse-error (type => 'not closed',
5089                              text => $_->[0]->manakai_local_name,                              text => $_->[0]->manakai_local_name,
# Line 5059  sub _tree_construction_main ($) { Line 5094  sub _tree_construction_main ($) {
5094            }            }
5095          }          }
5096    
5097            ## 3. Switch the insertion mode.
5098          $self->{insertion_mode} = AFTER_BODY_IM;          $self->{insertion_mode} = AFTER_BODY_IM;
5099          !!!next-token;          !!!next-token;
5100          next B;          next B;
# Line 5445  sub _tree_construction_main ($) { Line 5481  sub _tree_construction_main ($) {
5481    ## TODO: script stuffs    ## TODO: script stuffs
5482  } # _tree_construct_main  } # _tree_construct_main
5483    
5484    ## XXX: How this method is organized is somewhat out of date, although
5485    ## it still does what the current spec documents.
5486  sub set_inner_html ($$$$;$) {  sub set_inner_html ($$$$;$) {
5487    my $class = shift;    my $class = shift;
5488    my $node = shift;    my $node = shift; # /context/
5489    #my $s = \$_[0];    #my $s = \$_[0];
5490    my $onerror = $_[1];    my $onerror = $_[1];
5491    my $get_wrapper = $_[2] || sub ($) { return $_[0] };    my $get_wrapper = $_[2] || sub ($) { return $_[0] };
# Line 5455  sub set_inner_html ($$$$;$) { Line 5493  sub set_inner_html ($$$$;$) {
5493    ## ISSUE: Should {confident} be true?    ## ISSUE: Should {confident} be true?
5494    
5495    my $nt = $node->node_type;    my $nt = $node->node_type;
5496    if ($nt == 9) {    if ($nt == 9) { # Document (invoke the algorithm with no /context/ element)
5497      # MUST      # MUST
5498            
5499      ## Step 1 # MUST      ## Step 1 # MUST
# Line 5470  sub set_inner_html ($$$$;$) { Line 5508  sub set_inner_html ($$$$;$) {
5508    
5509      ## Step 3, 4, 5 # MUST      ## Step 3, 4, 5 # MUST
5510      $class->parse_char_string ($_[0] => $node, $onerror, $get_wrapper);      $class->parse_char_string ($_[0] => $node, $onerror, $get_wrapper);
5511    } elsif ($nt == 1) {    } elsif ($nt == 1) { # Element (invoke the algorithm with /context/ element)
5512      ## TODO: If non-html element      ## TODO: If non-html element
5513    
5514      ## NOTE: Most of this code is copied from |parse_string|      ## NOTE: Most of this code is copied from |parse_string|
5515    
5516  ## TODO: Support for $get_wrapper  ## TODO: Support for $get_wrapper
5517    
5518      ## Step 1 # MUST      ## F1. Create an HTML document.
5519      my $this_doc = $node->owner_document;      my $this_doc = $node->owner_document;
5520      my $doc = $this_doc->implementation->create_document;      my $doc = $this_doc->implementation->create_document;
5521      $doc->manakai_is_html (1);      $doc->manakai_is_html (1);
5522    
5523        ## F2. Propagate quirkness flag
5524        my $node_doc = $node->owner_document;
5525        $doc->manakai_compat_mode ($node_doc->manakai_compat_mode);
5526    
5527        ## F3. Create an HTML parser
5528      my $p = $class->new;      my $p = $class->new;
5529      $p->{document} = $doc;      $p->{document} = $doc;
5530    
# Line 5608  sub set_inner_html ($$$$;$) { Line 5652  sub set_inner_html ($$$$;$) {
5652      $p->_initialize_tokenizer;      $p->_initialize_tokenizer;
5653      $p->_initialize_tree_constructor;      $p->_initialize_tree_constructor;
5654    
5655      ## Step 2      ## F4. If /context/ is not undef...
5656    
5657        ## F4.1. content model flag
5658      my $node_ln = $node->manakai_local_name;      my $node_ln = $node->manakai_local_name;
5659      $p->{content_model} = {      $p->{content_model} = {
5660        title => RCDATA_CONTENT_MODEL,        title => RCDATA_CONTENT_MODEL,
# Line 5628  sub set_inner_html ($$$$;$) { Line 5674  sub set_inner_html ($$$$;$) {
5674      $p->{inner_html_node} = [$node, $el_category->{$node_ln}];      $p->{inner_html_node} = [$node, $el_category->{$node_ln}];
5675        ## TODO: Foreign element OK?        ## TODO: Foreign element OK?
5676    
5677      ## Step 3      ## F4.2. Root |html| element
5678      my $root = $doc->create_element_ns      my $root = $doc->create_element_ns
5679        ('http://www.w3.org/1999/xhtml', [undef, 'html']);        ('http://www.w3.org/1999/xhtml', [undef, 'html']);
5680    
5681      ## Step 4 # MUST      ## F4.3.
5682      $doc->append_child ($root);      $doc->append_child ($root);
5683    
5684      ## Step 5 # MUST      ## F4.4.
5685      push @{$p->{open_elements}}, [$root, $el_category->{html}];      push @{$p->{open_elements}}, [$root, $el_category->{html}];
5686    
5687      undef $p->{head_element};      undef $p->{head_element};
5688      undef $p->{head_element_inserted};      undef $p->{head_element_inserted};
5689    
5690      ## Step 6 # MUST      ## F4.5.
5691      $p->_reset_insertion_mode;      $p->_reset_insertion_mode;
5692    
5693      ## Step 7 # MUST      ## F4.6.
5694      my $anode = $node;      my $anode = $node;
5695      AN: while (defined $anode) {      AN: while (defined $anode) {
5696        if ($anode->node_type == 1) {        if ($anode->node_type == 1) {
# Line 5659  sub set_inner_html ($$$$;$) { Line 5705  sub set_inner_html ($$$$;$) {
5705        }        }
5706        $anode = $anode->parent_node;        $anode = $anode->parent_node;
5707      } # AN      } # AN
5708        
5709      ## Step 9 # MUST      ## F.6. Start the parser.
5710      {      {
5711        my $self = $p;        my $self = $p;
5712        !!!next-token;        !!!next-token;
5713      }      }
5714      $p->_tree_construction_main;      $p->_tree_construction_main;
5715    
5716      ## Step 10 # MUST      ## F.7.
5717      my @cn = @{$node->child_nodes};      my @cn = @{$node->child_nodes};
5718      for (@cn) {      for (@cn) {
5719        $node->remove_child ($_);        $node->remove_child ($_);

Legend:
Removed from v.1.217  
changed lines
  Added in v.1.234

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24