/[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.139 by wakaba, Sat May 24 04:26:27 2008 UTC revision 1.149 by wakaba, Sun May 25 08:53:49 2008 UTC
# Line 8  use Error qw(:try); Line 8  use Error qw(:try);
8  ## doc.write ('');  ## doc.write ('');
9  ## alert (doc.compatMode);  ## alert (doc.compatMode);
10    
 ## TODO: 1252 parse error (revision 1264)  
 ## TODO: 8859-11 = 874 (revision 1271)  
   
11  require IO::Handle;  require IO::Handle;
12    
13  my $HTML_NS = q<http://www.w3.org/1999/xhtml>;  my $HTML_NS = q<http://www.w3.org/1999/xhtml>;
# Line 214  my $el_category_f = { Line 211  my $el_category_f = {
211  };  };
212    
213  my $svg_attr_name = {  my $svg_attr_name = {
214      attributename => 'attributeName',
215    attributetype => 'attributeType',    attributetype => 'attributeType',
216    basefrequency => 'baseFrequency',    basefrequency => 'baseFrequency',
217    baseprofile => 'baseProfile',    baseprofile => 'baseProfile',
# Line 224  my $svg_attr_name = { Line 222  my $svg_attr_name = {
222    diffuseconstant => 'diffuseConstant',    diffuseconstant => 'diffuseConstant',
223    edgemode => 'edgeMode',    edgemode => 'edgeMode',
224    externalresourcesrequired => 'externalResourcesRequired',    externalresourcesrequired => 'externalResourcesRequired',
   fecolormatrix => 'feColorMatrix',  
   fecomposite => 'feComposite',  
   fegaussianblur => 'feGaussianBlur',  
   femorphology => 'feMorphology',  
   fetile => 'feTile',  
225    filterres => 'filterRes',    filterres => 'filterRes',
226    filterunits => 'filterUnits',    filterunits => 'filterUnits',
227    glyphref => 'glyphRef',    glyphref => 'glyphRef',
# Line 262  my $svg_attr_name = { Line 255  my $svg_attr_name = {
255    repeatcount => 'repeatCount',    repeatcount => 'repeatCount',
256    repeatdur => 'repeatDur',    repeatdur => 'repeatDur',
257    requiredextensions => 'requiredExtensions',    requiredextensions => 'requiredExtensions',
258      requiredfeatures => 'requiredFeatures',
259    specularconstant => 'specularConstant',    specularconstant => 'specularConstant',
260    specularexponent => 'specularExponent',    specularexponent => 'specularExponent',
261    spreadmethod => 'spreadMethod',    spreadmethod => 'spreadMethod',
# Line 487  sub parse_byte_stream ($$$$;$) { Line 481  sub parse_byte_stream ($$$$;$) {
481        ## "Change the encoding" algorithm:        ## "Change the encoding" algorithm:
482    
483        ## Step 1            ## Step 1    
484        if ($charset->{iana_names}->{'utf-16'}) { ## ISSUE: UTF-16BE -> UTF-8? UTF-16LE -> UTF-8?        if ($charset->{category} &
485              Message::Charset::Info::CHARSET_CATEGORY_UTF16 ()) {
486          $charset = Message::Charset::Info->get_by_iana_name ('utf-8');          $charset = Message::Charset::Info->get_by_iana_name ('utf-8');
487          ($char_stream, $e_status) = $charset->get_decode_handle          ($char_stream, $e_status) = $charset->get_decode_handle
488              ($byte_stream,              ($byte_stream,
# Line 1827  sub _get_next_token ($) { Line 1822  sub _get_next_token ($) {
1822          $self->{state} = SELF_CLOSING_START_TAG_STATE;          $self->{state} = SELF_CLOSING_START_TAG_STATE;
1823          !!!next-input-character;          !!!next-input-character;
1824          redo A;          redo A;
1825          } elsif ($self->{next_char} == -1) {
1826            !!!parse-error (type => 'unclosed tag');
1827            if ($self->{current_token}->{type} == START_TAG_TOKEN) {
1828              !!!cp (122.3);
1829              $self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name};
1830            } elsif ($self->{current_token}->{type} == END_TAG_TOKEN) {
1831              if ($self->{current_token}->{attributes}) {
1832                !!!cp (122.1);
1833                !!!parse-error (type => 'end tag attribute');
1834              } else {
1835                ## NOTE: This state should never be reached.
1836                !!!cp (122.2);
1837              }
1838            } else {
1839              die "$0: $self->{current_token}->{type}: Unknown token type";
1840            }
1841            $self->{state} = DATA_STATE;
1842            ## Reconsume.
1843            !!!emit ($self->{current_token}); # start tag or end tag
1844            redo A;
1845        } else {        } else {
1846          !!!cp ('124.1');          !!!cp ('124.1');
1847          !!!parse-error (type => 'no space between attributes');          !!!parse-error (type => 'no space between attributes');
# Line 1859  sub _get_next_token ($) { Line 1874  sub _get_next_token ($) {
1874          !!!emit ($self->{current_token}); # start tag or end tag          !!!emit ($self->{current_token}); # start tag or end tag
1875    
1876          redo A;          redo A;
1877          } elsif ($self->{next_char} == -1) {
1878            !!!parse-error (type => 'unclosed tag');
1879            if ($self->{current_token}->{type} == START_TAG_TOKEN) {
1880              !!!cp (124.7);
1881              $self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name};
1882            } elsif ($self->{current_token}->{type} == END_TAG_TOKEN) {
1883              if ($self->{current_token}->{attributes}) {
1884                !!!cp (124.5);
1885                !!!parse-error (type => 'end tag attribute');
1886              } else {
1887                ## NOTE: This state should never be reached.
1888                !!!cp (124.6);
1889              }
1890            } else {
1891              die "$0: $self->{current_token}->{type}: Unknown token type";
1892            }
1893            $self->{state} = DATA_STATE;
1894            ## Reconsume.
1895            !!!emit ($self->{current_token}); # start tag or end tag
1896            redo A;
1897        } else {        } else {
1898          !!!cp ('124.4');          !!!cp ('124.4');
1899          !!!parse-error (type => 'nestc');          !!!parse-error (type => 'nestc');
# Line 2699  sub _get_next_token ($) { Line 2734  sub _get_next_token ($) {
2734          redo A;          redo A;
2735        } elsif ($self->{next_char} == -1) {        } elsif ($self->{next_char} == -1) {
2736          !!!cp (217);          !!!cp (217);
         !!!parse-error (type => 'unclosed DOCTYPE');  
2737    
2738          $self->{state} = DATA_STATE;          $self->{state} = DATA_STATE;
2739          ## reconsume          ## reconsume
# Line 3103  sub _tree_construction_initial ($) { Line 3137  sub _tree_construction_initial ($) {
3137        } elsif (defined $token->{public_identifier}) {        } elsif (defined $token->{public_identifier}) {
3138          my $pubid = $token->{public_identifier};          my $pubid = $token->{public_identifier};
3139          $pubid =~ tr/a-z/A-z/;          $pubid =~ tr/a-z/A-z/;
3140          if ({          my $prefix = [
3141            "+//SILMARIL//DTD HTML PRO V0R11 19970101//EN" => 1,            "+//SILMARIL//DTD HTML PRO V0R11 19970101//",
3142            "-//ADVASOFT LTD//DTD HTML 3.0 ASWEDIT + EXTENSIONS//EN" => 1,            "-//ADVASOFT LTD//DTD HTML 3.0 ASWEDIT + EXTENSIONS//",
3143            "-//AS//DTD HTML 3.0 ASWEDIT + EXTENSIONS//EN" => 1,            "-//AS//DTD HTML 3.0 ASWEDIT + EXTENSIONS//",
3144            "-//IETF//DTD HTML 2.0 LEVEL 1//EN" => 1,            "-//IETF//DTD HTML 2.0 LEVEL 1//",
3145            "-//IETF//DTD HTML 2.0 LEVEL 2//EN" => 1,            "-//IETF//DTD HTML 2.0 LEVEL 2//",
3146            "-//IETF//DTD HTML 2.0 STRICT LEVEL 1//EN" => 1,            "-//IETF//DTD HTML 2.0 STRICT LEVEL 1//",
3147            "-//IETF//DTD HTML 2.0 STRICT LEVEL 2//EN" => 1,            "-//IETF//DTD HTML 2.0 STRICT LEVEL 2//",
3148            "-//IETF//DTD HTML 2.0 STRICT//EN" => 1,            "-//IETF//DTD HTML 2.0 STRICT//",
3149            "-//IETF//DTD HTML 2.0//EN" => 1,            "-//IETF//DTD HTML 2.0//",
3150            "-//IETF//DTD HTML 2.1E//EN" => 1,            "-//IETF//DTD HTML 2.1E//",
3151            "-//IETF//DTD HTML 3.0//EN" => 1,            "-//IETF//DTD HTML 3.0//",
3152            "-//IETF//DTD HTML 3.0//EN//" => 1,            "-//IETF//DTD HTML 3.2 FINAL//",
3153            "-//IETF//DTD HTML 3.2 FINAL//EN" => 1,            "-//IETF//DTD HTML 3.2//",
3154            "-//IETF//DTD HTML 3.2//EN" => 1,            "-//IETF//DTD HTML 3//",
3155            "-//IETF//DTD HTML 3//EN" => 1,            "-//IETF//DTD HTML LEVEL 0//",
3156            "-//IETF//DTD HTML LEVEL 0//EN" => 1,            "-//IETF//DTD HTML LEVEL 1//",
3157            "-//IETF//DTD HTML LEVEL 0//EN//2.0" => 1,            "-//IETF//DTD HTML LEVEL 2//",
3158            "-//IETF//DTD HTML LEVEL 1//EN" => 1,            "-//IETF//DTD HTML LEVEL 3//",
3159            "-//IETF//DTD HTML LEVEL 1//EN//2.0" => 1,            "-//IETF//DTD HTML STRICT LEVEL 0//",
3160            "-//IETF//DTD HTML LEVEL 2//EN" => 1,            "-//IETF//DTD HTML STRICT LEVEL 1//",
3161            "-//IETF//DTD HTML LEVEL 2//EN//2.0" => 1,            "-//IETF//DTD HTML STRICT LEVEL 2//",
3162            "-//IETF//DTD HTML LEVEL 3//EN" => 1,            "-//IETF//DTD HTML STRICT LEVEL 3//",
3163            "-//IETF//DTD HTML LEVEL 3//EN//3.0" => 1,            "-//IETF//DTD HTML STRICT//",
3164            "-//IETF//DTD HTML STRICT LEVEL 0//EN" => 1,            "-//IETF//DTD HTML//",
3165            "-//IETF//DTD HTML STRICT LEVEL 0//EN//2.0" => 1,            "-//METRIUS//DTD METRIUS PRESENTATIONAL//",
3166            "-//IETF//DTD HTML STRICT LEVEL 1//EN" => 1,            "-//MICROSOFT//DTD INTERNET EXPLORER 2.0 HTML STRICT//",
3167            "-//IETF//DTD HTML STRICT LEVEL 1//EN//2.0" => 1,            "-//MICROSOFT//DTD INTERNET EXPLORER 2.0 HTML//",
3168            "-//IETF//DTD HTML STRICT LEVEL 2//EN" => 1,            "-//MICROSOFT//DTD INTERNET EXPLORER 2.0 TABLES//",
3169            "-//IETF//DTD HTML STRICT LEVEL 2//EN//2.0" => 1,            "-//MICROSOFT//DTD INTERNET EXPLORER 3.0 HTML STRICT//",
3170            "-//IETF//DTD HTML STRICT LEVEL 3//EN" => 1,            "-//MICROSOFT//DTD INTERNET EXPLORER 3.0 HTML//",
3171            "-//IETF//DTD HTML STRICT LEVEL 3//EN//3.0" => 1,            "-//MICROSOFT//DTD INTERNET EXPLORER 3.0 TABLES//",
3172            "-//IETF//DTD HTML STRICT//EN" => 1,            "-//NETSCAPE COMM. CORP.//DTD HTML//",
3173            "-//IETF//DTD HTML STRICT//EN//2.0" => 1,            "-//NETSCAPE COMM. CORP.//DTD STRICT HTML//",
3174            "-//IETF//DTD HTML STRICT//EN//3.0" => 1,            "-//O'REILLY AND ASSOCIATES//DTD HTML 2.0//",
3175            "-//IETF//DTD HTML//EN" => 1,            "-//O'REILLY AND ASSOCIATES//DTD HTML EXTENDED 1.0//",
3176            "-//IETF//DTD HTML//EN//2.0" => 1,            "-//O'REILLY AND ASSOCIATES//DTD HTML EXTENDED RELAXED 1.0//",
3177            "-//IETF//DTD HTML//EN//3.0" => 1,            "-//SOFTQUAD SOFTWARE//DTD HOTMETAL PRO 6.0::19990601::EXTENSIONS TO HTML 4.0//",
3178            "-//METRIUS//DTD METRIUS PRESENTATIONAL//EN" => 1,            "-//SOFTQUAD//DTD HOTMETAL PRO 4.0::19971010::EXTENSIONS TO HTML 4.0//",
3179            "-//MICROSOFT//DTD INTERNET EXPLORER 2.0 HTML STRICT//EN" => 1,            "-//SPYGLASS//DTD HTML 2.0 EXTENDED//",
3180            "-//MICROSOFT//DTD INTERNET EXPLORER 2.0 HTML//EN" => 1,            "-//SQ//DTD HTML 2.0 HOTMETAL + EXTENSIONS//",
3181            "-//MICROSOFT//DTD INTERNET EXPLORER 2.0 TABLES//EN" => 1,            "-//SUN MICROSYSTEMS CORP.//DTD HOTJAVA HTML//",
3182            "-//MICROSOFT//DTD INTERNET EXPLORER 3.0 HTML STRICT//EN" => 1,            "-//SUN MICROSYSTEMS CORP.//DTD HOTJAVA STRICT HTML//",
3183            "-//MICROSOFT//DTD INTERNET EXPLORER 3.0 HTML//EN" => 1,            "-//W3C//DTD HTML 3 1995-03-24//",
3184            "-//MICROSOFT//DTD INTERNET EXPLORER 3.0 TABLES//EN" => 1,            "-//W3C//DTD HTML 3.2 DRAFT//",
3185            "-//NETSCAPE COMM. CORP.//DTD HTML//EN" => 1,            "-//W3C//DTD HTML 3.2 FINAL//",
3186            "-//NETSCAPE COMM. CORP.//DTD STRICT HTML//EN" => 1,            "-//W3C//DTD HTML 3.2//",
3187            "-//O'REILLY AND ASSOCIATES//DTD HTML 2.0//EN" => 1,            "-//W3C//DTD HTML 3.2S DRAFT//",
3188            "-//O'REILLY AND ASSOCIATES//DTD HTML EXTENDED 1.0//EN" => 1,            "-//W3C//DTD HTML 4.0 FRAMESET//",
3189            "-//O'REILLY AND ASSOCIATES//DTD HTML EXTENDED RELAXED 1.0//EN" => 1,            "-//W3C//DTD HTML 4.0 TRANSITIONAL//",
3190            "-//SOFTQUAD SOFTWARE//DTD HOTMETAL PRO 6.0::19990601::EXTENSIONS TO HTML 4.0//EN" => 1,            "-//W3C//DTD HTML EXPERIMETNAL 19960712//",
3191            "-//SOFTQUAD//DTD HOTMETAL PRO 4.0::19971010::EXTENSIONS TO HTML 4.0//EN" => 1,            "-//W3C//DTD HTML EXPERIMENTAL 970421//",
3192            "-//SPYGLASS//DTD HTML 2.0 EXTENDED//EN" => 1,            "-//W3C//DTD W3 HTML//",
3193            "-//SQ//DTD HTML 2.0 HOTMETAL + EXTENSIONS//EN" => 1,            "-//W3O//DTD W3 HTML 3.0//",
3194            "-//SUN MICROSYSTEMS CORP.//DTD HOTJAVA HTML//EN" => 1,            "-//WEBTECHS//DTD MOZILLA HTML 2.0//",
3195            "-//SUN MICROSYSTEMS CORP.//DTD HOTJAVA STRICT HTML//EN" => 1,            "-//WEBTECHS//DTD MOZILLA HTML//",
3196            "-//W3C//DTD HTML 3 1995-03-24//EN" => 1,          ]; # $prefix
3197            "-//W3C//DTD HTML 3.2 DRAFT//EN" => 1,          my $match;
3198            "-//W3C//DTD HTML 3.2 FINAL//EN" => 1,          for (@$prefix) {
3199            "-//W3C//DTD HTML 3.2//EN" => 1,            if (substr ($prefix, 0, length $_) eq $_) {
3200            "-//W3C//DTD HTML 3.2S DRAFT//EN" => 1,              $match = 1;
3201            "-//W3C//DTD HTML 4.0 FRAMESET//EN" => 1,              last;
3202            "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN" => 1,            }
3203            "-//W3C//DTD HTML EXPERIMETNAL 19960712//EN" => 1,          }
3204            "-//W3C//DTD HTML EXPERIMENTAL 970421//EN" => 1,          if ($match or
3205            "-//W3C//DTD W3 HTML//EN" => 1,              $pubid eq "-//W3O//DTD W3 HTML STRICT 3.0//EN//" or
3206            "-//W3O//DTD W3 HTML 3.0//EN" => 1,              $pubid eq "-/W3C/DTD HTML 4.0 TRANSITIONAL/EN" or
3207            "-//W3O//DTD W3 HTML 3.0//EN//" => 1,              $pubid eq "HTML") {
           "-//W3O//DTD W3 HTML STRICT 3.0//EN//" => 1,  
           "-//WEBTECHS//DTD MOZILLA HTML 2.0//EN" => 1,  
           "-//WEBTECHS//DTD MOZILLA HTML//EN" => 1,  
           "-/W3C/DTD HTML 4.0 TRANSITIONAL/EN" => 1,  
           "HTML" => 1,  
         }->{$pubid}) {  
3208            !!!cp ('t5');            !!!cp ('t5');
3209            $self->{document}->manakai_compat_mode ('quirks');            $self->{document}->manakai_compat_mode ('quirks');
3210          } elsif ($pubid eq "-//W3C//DTD HTML 4.01 FRAMESET//EN" or          } elsif ($pubid =~ m[^-//W3C//DTD HTML 4.01 FRAMESET//] or
3211                   $pubid eq "-//W3C//DTD HTML 4.01 TRANSITIONAL//EN") {                   $pubid =~ m[^-//W3C//DTD HTML 4.01 TRANSITIONAL//]) {
3212            if (defined $token->{system_identifier}) {            if (defined $token->{system_identifier}) {
3213              !!!cp ('t6');              !!!cp ('t6');
3214              $self->{document}->manakai_compat_mode ('quirks');              $self->{document}->manakai_compat_mode ('quirks');
# Line 3188  sub _tree_construction_initial ($) { Line 3216  sub _tree_construction_initial ($) {
3216              !!!cp ('t7');              !!!cp ('t7');
3217              $self->{document}->manakai_compat_mode ('limited quirks');              $self->{document}->manakai_compat_mode ('limited quirks');
3218            }            }
3219          } elsif ($pubid eq "-//W3C//DTD XHTML 1.0 FRAMESET//EN" or          } elsif ($pubid =~ m[^-//W3C//DTD XHTML 1.0 FRAMESET//] or
3220                   $pubid eq "-//W3C//DTD XHTML 1.0 TRANSITIONAL//EN") {                   $pubid =~ m[^-//W3C//DTD XHTML 1.0 TRANSITIONAL//]) {
3221            !!!cp ('t8');            !!!cp ('t8');
3222            $self->{document}->manakai_compat_mode ('limited quirks');            $self->{document}->manakai_compat_mode ('limited quirks');
3223          } else {          } else {
# Line 3202  sub _tree_construction_initial ($) { Line 3230  sub _tree_construction_initial ($) {
3230          my $sysid = $token->{system_identifier};          my $sysid = $token->{system_identifier};
3231          $sysid =~ tr/A-Z/a-z/;          $sysid =~ tr/A-Z/a-z/;
3232          if ($sysid eq "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd") {          if ($sysid eq "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd") {
3233            ## TODO: Check the spec: PUBLIC "(limited quirks)" "(quirks)"            ## NOTE: Ensure that |PUBLIC "(limited quirks)" "(quirks)"| is
3234              ## marked as quirks.
3235            $self->{document}->manakai_compat_mode ('quirks');            $self->{document}->manakai_compat_mode ('quirks');
3236            !!!cp ('t11');            !!!cp ('t11');
3237          } else {          } else {
# Line 3374  sub _reset_insertion_mode ($) { Line 3403  sub _reset_insertion_mode ($) {
3403        if ($self->{open_elements}->[0]->[0] eq $node->[0]) {        if ($self->{open_elements}->[0]->[0] eq $node->[0]) {
3404          $last = 1;          $last = 1;
3405          if (defined $self->{inner_html_node}) {          if (defined $self->{inner_html_node}) {
3406            if ($self->{inner_html_node}->[1] & TABLE_CELL_EL) {            !!!cp ('t28');
3407              !!!cp ('t27');            $node = $self->{inner_html_node};
3408              #          } else {
3409            } else {            die "_reset_insertion_mode: t27";
             !!!cp ('t28');  
             $node = $self->{inner_html_node};  
           }  
3410          }          }
3411        }        }
3412              
3413      ## Step 4..14        ## Step 4..14
3414      my $new_mode;        my $new_mode;
3415      if ($node->[1] & FOREIGN_EL) {        if ($node->[1] & FOREIGN_EL) {
3416        ## NOTE: Strictly spaking, the line below only applies to MathML and          !!!cp ('t28.1');
3417        ## SVG elements.  Currently the HTML syntax supports only MathML and          ## NOTE: Strictly spaking, the line below only applies to MathML and
3418        ## SVG elements as foreigners.          ## SVG elements.  Currently the HTML syntax supports only MathML and
3419        $new_mode = $self->{insertion_mode} | IN_FOREIGN_CONTENT_IM;          ## SVG elements as foreigners.
3420        ## ISSUE: What is set as the secondary insertion mode?          $new_mode = IN_BODY_IM | IN_FOREIGN_CONTENT_IM;
3421      } else {        } elsif ($node->[1] & TABLE_CELL_EL) {
3422        $new_mode = {          if ($last) {
3423              !!!cp ('t28.2');
3424              #
3425            } else {
3426              !!!cp ('t28.3');
3427              $new_mode = IN_CELL_IM;
3428            }
3429          } else {
3430            !!!cp ('t28.4');
3431            $new_mode = {
3432                        select => IN_SELECT_IM,                        select => IN_SELECT_IM,
3433                        ## NOTE: |option| and |optgroup| do not set                        ## NOTE: |option| and |optgroup| do not set
3434                        ## insertion mode to "in select" by themselves.                        ## insertion mode to "in select" by themselves.
                       td => IN_CELL_IM,  
                       th => IN_CELL_IM,  
3435                        tr => IN_ROW_IM,                        tr => IN_ROW_IM,
3436                        tbody => IN_TABLE_BODY_IM,                        tbody => IN_TABLE_BODY_IM,
3437                        thead => IN_TABLE_BODY_IM,                        thead => IN_TABLE_BODY_IM,
# Line 3410  sub _reset_insertion_mode ($) { Line 3443  sub _reset_insertion_mode ($) {
3443                        body => IN_BODY_IM,                        body => IN_BODY_IM,
3444                        frameset => IN_FRAMESET_IM,                        frameset => IN_FRAMESET_IM,
3445                       }->{$node->[0]->manakai_local_name};                       }->{$node->[0]->manakai_local_name};
3446      }        }
3447      $self->{insertion_mode} = $new_mode and return if defined $new_mode;        $self->{insertion_mode} = $new_mode and return if defined $new_mode;
3448                
3449        ## Step 15        ## Step 15
3450        if ($node->[1] & HTML_EL) {        if ($node->[1] & HTML_EL) {
# Line 3988  sub _tree_construction_main ($) { Line 4021  sub _tree_construction_main ($) {
4021            #            #
4022          } elsif ({          } elsif ({
4023                    b => 1, big => 1, blockquote => 1, body => 1, br => 1,                    b => 1, big => 1, blockquote => 1, body => 1, br => 1,
4024                    center => 1, code => 1, dd => 1, div => 1, dl => 1, em => 1,                    center => 1, code => 1, dd => 1, div => 1, dl => 1, dt => 1,
4025                    embed => 1, font => 1, h1 => 1, h2 => 1, h3 => 1, ## No h4!                    em => 1, embed => 1, font => 1, h1 => 1, h2 => 1, h3 => 1,
4026                    h5 => 1, h6 => 1, head => 1, hr => 1, i => 1, img => 1,                    h4 => 1, h5 => 1, h6 => 1, head => 1, hr => 1, i => 1,
4027                    li => 1, menu => 1, meta => 1, nobr => 1, p => 1, pre => 1,                    img => 1, li => 1, listing => 1, menu => 1, meta => 1,
4028                    ruby => 1, s => 1, small => 1, span => 1, strong => 1,                    nobr => 1, ol => 1, p => 1, pre => 1, ruby => 1, s => 1,
4029                    sub => 1, sup => 1, table => 1, tt => 1, u => 1, ul => 1,                    small => 1, span => 1, strong => 1, strike => 1, sub => 1,
4030                    var => 1,                    sup => 1, table => 1, tt => 1, u => 1, ul => 1, var => 1,
4031                   }->{$token->{tag_name}}) {                   }->{$token->{tag_name}}) {
4032            !!!cp ('t87.2');            !!!cp ('t87.2');
4033            !!!parse-error (type => 'not closed',            !!!parse-error (type => 'not closed',
# Line 4074  sub _tree_construction_main ($) { Line 4107  sub _tree_construction_main ($) {
4107          !!!cp ('t87.5');          !!!cp ('t87.5');
4108          #          #
4109        } elsif ($token->{type} == END_OF_FILE_TOKEN) {        } elsif ($token->{type} == END_OF_FILE_TOKEN) {
         ## NOTE: "using the rules for secondary insertion mode" then "continue"  
4110          !!!cp ('t87.6');          !!!cp ('t87.6');
4111          #          !!!parse-error (type => 'not closed',
4112          ## TODO: ...                          value => $self->{open_elements}->[-1]->[0]
4113                                ->manakai_local_name,
4114                            token => $token);
4115    
4116            pop @{$self->{open_elements}}
4117                while $self->{open_elements}->[-1]->[1] & FOREIGN_EL;
4118    
4119            $self->{insertion_mode} &= ~ IN_FOREIGN_CONTENT_IM;
4120            ## Reprocess.
4121            next B;
4122        } else {        } else {
4123          die "$0: $token->{type}: Unknown token type";                  die "$0: $token->{type}: Unknown token type";        
4124        }        }
# Line 4256  sub _tree_construction_main ($) { Line 4297  sub _tree_construction_main ($) {
4297                                                 ->{has_reference});                                                 ->{has_reference});
4298                  } elsif ($token->{attributes}->{content}) {                  } elsif ($token->{attributes}->{content}) {
4299                    if ($token->{attributes}->{content}->{value}                    if ($token->{attributes}->{content}->{value}
4300                        =~ /\A[^;]*;[\x09-\x0D\x20]*[Cc][Hh][Aa][Rr][Ss][Ee][Tt]                        =~ /[Cc][Hh][Aa][Rr][Ss][Ee][Tt]
4301                            [\x09-\x0D\x20]*=                            [\x09-\x0D\x20]*=
4302                            [\x09-\x0D\x20]*(?>"([^"]*)"|'([^']*)'|                            [\x09-\x0D\x20]*(?>"([^"]*)"|'([^']*)'|
4303                            ([^"'\x09-\x0D\x20][^\x09-\x0D\x20]*))/x) {                            ([^"'\x09-\x0D\x20][^\x09-\x0D\x20\x3B]*))/x) {
4304                      !!!cp ('t107');                      !!!cp ('t107');
4305                      ## NOTE: Whether the encoding is supported or not is handled                      ## NOTE: Whether the encoding is supported or not is handled
4306                      ## in the {change_encoding} callback.                      ## in the {change_encoding} callback.
# Line 4321  sub _tree_construction_main ($) { Line 4362  sub _tree_construction_main ($) {
4362                pop @{$self->{open_elements}} # <head>                pop @{$self->{open_elements}} # <head>
4363                    if $self->{insertion_mode} == AFTER_HEAD_IM;                    if $self->{insertion_mode} == AFTER_HEAD_IM;
4364                next B;                next B;
4365              } elsif ($token->{tag_name} eq 'style') {              } elsif ($token->{tag_name} eq 'style' or
4366                         $token->{tag_name} eq 'noframes') {
4367                ## NOTE: Or (scripting is enabled and tag_name eq 'noscript' and                ## NOTE: Or (scripting is enabled and tag_name eq 'noscript' and
4368                ## insertion mode IN_HEAD_IM)                ## insertion mode IN_HEAD_IM)
4369                ## NOTE: There is a "as if in head" code clone.                ## NOTE: There is a "as if in head" code clone.
# Line 5833  sub _tree_construction_main ($) { Line 5875  sub _tree_construction_main ($) {
5875            !!!nack ('t277.1');            !!!nack ('t277.1');
5876            !!!next-token;            !!!next-token;
5877            next B;            next B;
5878          } elsif ($token->{tag_name} eq 'select' or          } elsif ({
5879                   $token->{tag_name} eq 'input' or                     select => 1, input => 1, textarea => 1,
5880                     }->{$token->{tag_name}} or
5881                   ($self->{insertion_mode} == IN_SELECT_IN_TABLE_IM and                   ($self->{insertion_mode} == IN_SELECT_IN_TABLE_IM and
5882                    {                    {
5883                     caption => 1, table => 1,                     caption => 1, table => 1,
# Line 6191  sub _tree_construction_main ($) { Line 6234  sub _tree_construction_main ($) {
6234            next B;            next B;
6235          } elsif ($token->{tag_name} eq 'noframes') {          } elsif ($token->{tag_name} eq 'noframes') {
6236            !!!cp ('t320');            !!!cp ('t320');
6237            ## NOTE: As if in body.            ## NOTE: As if in head.
6238            $parse_rcdata->(CDATA_CONTENT_MODEL);            $parse_rcdata->(CDATA_CONTENT_MODEL);
6239            next B;            next B;
6240          } else {          } else {
# Line 6319  sub _tree_construction_main ($) { Line 6362  sub _tree_construction_main ($) {
6362                                           ->{has_reference});                                           ->{has_reference});
6363            } elsif ($token->{attributes}->{content}) {            } elsif ($token->{attributes}->{content}) {
6364              if ($token->{attributes}->{content}->{value}              if ($token->{attributes}->{content}->{value}
6365                  =~ /\A[^;]*;[\x09-\x0D\x20]*[Cc][Hh][Aa][Rr][Ss][Ee][Tt]                  =~ /[Cc][Hh][Aa][Rr][Ss][Ee][Tt]
6366                      [\x09-\x0D\x20]*=                      [\x09-\x0D\x20]*=
6367                      [\x09-\x0D\x20]*(?>"([^"]*)"|'([^']*)'|                      [\x09-\x0D\x20]*(?>"([^"]*)"|'([^']*)'|
6368                      ([^"'\x09-\x0D\x20][^\x09-\x0D\x20]*))/x) {                      ([^"'\x09-\x0D\x20][^\x09-\x0D\x20\x3B]*))/x) {
6369                !!!cp ('t336');                !!!cp ('t336');
6370                ## NOTE: Whether the encoding is supported or not is handled                ## NOTE: Whether the encoding is supported or not is handled
6371                ## in the {change_encoding} callback.                ## in the {change_encoding} callback.
# Line 6634  sub _tree_construction_main ($) { Line 6677  sub _tree_construction_main ($) {
6677                  xmp => 1,                  xmp => 1,
6678                  iframe => 1,                  iframe => 1,
6679                  noembed => 1,                  noembed => 1,
6680                  noframes => 1,                  noframes => 1, ## NOTE: This is an "as if in head" code clone.
6681                  noscript => 0, ## TODO: 1 if scripting is enabled                  noscript => 0, ## TODO: 1 if scripting is enabled
6682                 }->{$token->{tag_name}}) {                 }->{$token->{tag_name}}) {
6683          if ($token->{tag_name} eq 'xmp') {          if ($token->{tag_name} eq 'xmp') {
# Line 6656  sub _tree_construction_main ($) { Line 6699  sub _tree_construction_main ($) {
6699            !!!next-token;            !!!next-token;
6700            next B;            next B;
6701          } else {          } else {
6702              !!!ack ('t391.1');
6703    
6704            my $at = $token->{attributes};            my $at = $token->{attributes};
6705            my $form_attrs;            my $form_attrs;
6706            $form_attrs->{action} = $at->{action} if $at->{action};            $form_attrs->{action} = $at->{action} if $at->{action};
# Line 6699  sub _tree_construction_main ($) { Line 6744  sub _tree_construction_main ($) {
6744                           line => $token->{line}, column => $token->{column}},                           line => $token->{line}, column => $token->{column}},
6745                          {type => END_TAG_TOKEN, tag_name => 'form',                          {type => END_TAG_TOKEN, tag_name => 'form',
6746                           line => $token->{line}, column => $token->{column}};                           line => $token->{line}, column => $token->{column}};
           !!!nack ('t391.1'); ## NOTE: Not acknowledged.  
6747            !!!back-token (@tokens);            !!!back-token (@tokens);
6748            !!!next-token;            !!!next-token;
6749            next B;            next B;

Legend:
Removed from v.1.139  
changed lines
  Added in v.1.149

[email protected]
ViewVC Help
Powered by ViewVC 1.1.24