/[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.140 by wakaba, Sat May 24 09:59:52 2008 UTC revision 1.150 by wakaba, Sun Jun 1 06:47:08 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 829  sub _initialize_tokenizer ($) { Line 824  sub _initialize_tokenizer ($) {
824  ##     |->{self_closing}| is used to save the value of |$self->{self_closing}|  ##     |->{self_closing}| is used to save the value of |$self->{self_closing}|
825  ##     while the token is pushed back to the stack.  ##     while the token is pushed back to the stack.
826    
 ## ISSUE: "When a DOCTYPE token is created, its  
 ## <i>self-closing flag</i> must be unset (its other state is that it  
 ## be set), and its attributes list must be empty.": Wrong subject?  
   
827  ## Emitted token MUST immediately be handled by the tree construction state.  ## Emitted token MUST immediately be handled by the tree construction state.
828    
829  ## Before each step, UA MAY check to see if either one of the scripts in  ## Before each step, UA MAY check to see if either one of the scripts in
# Line 1827  sub _get_next_token ($) { Line 1818  sub _get_next_token ($) {
1818          $self->{state} = SELF_CLOSING_START_TAG_STATE;          $self->{state} = SELF_CLOSING_START_TAG_STATE;
1819          !!!next-input-character;          !!!next-input-character;
1820          redo A;          redo A;
1821          } elsif ($self->{next_char} == -1) {
1822            !!!parse-error (type => 'unclosed tag');
1823            if ($self->{current_token}->{type} == START_TAG_TOKEN) {
1824              !!!cp (122.3);
1825              $self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name};
1826            } elsif ($self->{current_token}->{type} == END_TAG_TOKEN) {
1827              if ($self->{current_token}->{attributes}) {
1828                !!!cp (122.1);
1829                !!!parse-error (type => 'end tag attribute');
1830              } else {
1831                ## NOTE: This state should never be reached.
1832                !!!cp (122.2);
1833              }
1834            } else {
1835              die "$0: $self->{current_token}->{type}: Unknown token type";
1836            }
1837            $self->{state} = DATA_STATE;
1838            ## Reconsume.
1839            !!!emit ($self->{current_token}); # start tag or end tag
1840            redo A;
1841        } else {        } else {
1842          !!!cp ('124.1');          !!!cp ('124.1');
1843          !!!parse-error (type => 'no space between attributes');          !!!parse-error (type => 'no space between attributes');
# Line 1859  sub _get_next_token ($) { Line 1870  sub _get_next_token ($) {
1870          !!!emit ($self->{current_token}); # start tag or end tag          !!!emit ($self->{current_token}); # start tag or end tag
1871    
1872          redo A;          redo A;
1873          } elsif ($self->{next_char} == -1) {
1874            !!!parse-error (type => 'unclosed tag');
1875            if ($self->{current_token}->{type} == START_TAG_TOKEN) {
1876              !!!cp (124.7);
1877              $self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name};
1878            } elsif ($self->{current_token}->{type} == END_TAG_TOKEN) {
1879              if ($self->{current_token}->{attributes}) {
1880                !!!cp (124.5);
1881                !!!parse-error (type => 'end tag attribute');
1882              } else {
1883                ## NOTE: This state should never be reached.
1884                !!!cp (124.6);
1885              }
1886            } else {
1887              die "$0: $self->{current_token}->{type}: Unknown token type";
1888            }
1889            $self->{state} = DATA_STATE;
1890            ## Reconsume.
1891            !!!emit ($self->{current_token}); # start tag or end tag
1892            redo A;
1893        } else {        } else {
1894          !!!cp ('124.4');          !!!cp ('124.4');
1895          !!!parse-error (type => 'nestc');          !!!parse-error (type => 'nestc');
# Line 2700  sub _get_next_token ($) { Line 2731  sub _get_next_token ($) {
2731        } elsif ($self->{next_char} == -1) {        } elsif ($self->{next_char} == -1) {
2732          !!!cp (217);          !!!cp (217);
2733          !!!parse-error (type => 'unclosed DOCTYPE');          !!!parse-error (type => 'unclosed DOCTYPE');
   
2734          $self->{state} = DATA_STATE;          $self->{state} = DATA_STATE;
2735          ## reconsume          ## reconsume
2736    
# Line 3103  sub _tree_construction_initial ($) { Line 3133  sub _tree_construction_initial ($) {
3133        } elsif (defined $token->{public_identifier}) {        } elsif (defined $token->{public_identifier}) {
3134          my $pubid = $token->{public_identifier};          my $pubid = $token->{public_identifier};
3135          $pubid =~ tr/a-z/A-z/;          $pubid =~ tr/a-z/A-z/;
3136          if ({          my $prefix = [
3137            "+//SILMARIL//DTD HTML PRO V0R11 19970101//EN" => 1,            "+//SILMARIL//DTD HTML PRO V0R11 19970101//",
3138            "-//ADVASOFT LTD//DTD HTML 3.0 ASWEDIT + EXTENSIONS//EN" => 1,            "-//ADVASOFT LTD//DTD HTML 3.0 ASWEDIT + EXTENSIONS//",
3139            "-//AS//DTD HTML 3.0 ASWEDIT + EXTENSIONS//EN" => 1,            "-//AS//DTD HTML 3.0 ASWEDIT + EXTENSIONS//",
3140            "-//IETF//DTD HTML 2.0 LEVEL 1//EN" => 1,            "-//IETF//DTD HTML 2.0 LEVEL 1//",
3141            "-//IETF//DTD HTML 2.0 LEVEL 2//EN" => 1,            "-//IETF//DTD HTML 2.0 LEVEL 2//",
3142            "-//IETF//DTD HTML 2.0 STRICT LEVEL 1//EN" => 1,            "-//IETF//DTD HTML 2.0 STRICT LEVEL 1//",
3143            "-//IETF//DTD HTML 2.0 STRICT LEVEL 2//EN" => 1,            "-//IETF//DTD HTML 2.0 STRICT LEVEL 2//",
3144            "-//IETF//DTD HTML 2.0 STRICT//EN" => 1,            "-//IETF//DTD HTML 2.0 STRICT//",
3145            "-//IETF//DTD HTML 2.0//EN" => 1,            "-//IETF//DTD HTML 2.0//",
3146            "-//IETF//DTD HTML 2.1E//EN" => 1,            "-//IETF//DTD HTML 2.1E//",
3147            "-//IETF//DTD HTML 3.0//EN" => 1,            "-//IETF//DTD HTML 3.0//",
3148            "-//IETF//DTD HTML 3.0//EN//" => 1,            "-//IETF//DTD HTML 3.2 FINAL//",
3149            "-//IETF//DTD HTML 3.2 FINAL//EN" => 1,            "-//IETF//DTD HTML 3.2//",
3150            "-//IETF//DTD HTML 3.2//EN" => 1,            "-//IETF//DTD HTML 3//",
3151            "-//IETF//DTD HTML 3//EN" => 1,            "-//IETF//DTD HTML LEVEL 0//",
3152            "-//IETF//DTD HTML LEVEL 0//EN" => 1,            "-//IETF//DTD HTML LEVEL 1//",
3153            "-//IETF//DTD HTML LEVEL 0//EN//2.0" => 1,            "-//IETF//DTD HTML LEVEL 2//",
3154            "-//IETF//DTD HTML LEVEL 1//EN" => 1,            "-//IETF//DTD HTML LEVEL 3//",
3155            "-//IETF//DTD HTML LEVEL 1//EN//2.0" => 1,            "-//IETF//DTD HTML STRICT LEVEL 0//",
3156            "-//IETF//DTD HTML LEVEL 2//EN" => 1,            "-//IETF//DTD HTML STRICT LEVEL 1//",
3157            "-//IETF//DTD HTML LEVEL 2//EN//2.0" => 1,            "-//IETF//DTD HTML STRICT LEVEL 2//",
3158            "-//IETF//DTD HTML LEVEL 3//EN" => 1,            "-//IETF//DTD HTML STRICT LEVEL 3//",
3159            "-//IETF//DTD HTML LEVEL 3//EN//3.0" => 1,            "-//IETF//DTD HTML STRICT//",
3160            "-//IETF//DTD HTML STRICT LEVEL 0//EN" => 1,            "-//IETF//DTD HTML//",
3161            "-//IETF//DTD HTML STRICT LEVEL 0//EN//2.0" => 1,            "-//METRIUS//DTD METRIUS PRESENTATIONAL//",
3162            "-//IETF//DTD HTML STRICT LEVEL 1//EN" => 1,            "-//MICROSOFT//DTD INTERNET EXPLORER 2.0 HTML STRICT//",
3163            "-//IETF//DTD HTML STRICT LEVEL 1//EN//2.0" => 1,            "-//MICROSOFT//DTD INTERNET EXPLORER 2.0 HTML//",
3164            "-//IETF//DTD HTML STRICT LEVEL 2//EN" => 1,            "-//MICROSOFT//DTD INTERNET EXPLORER 2.0 TABLES//",
3165            "-//IETF//DTD HTML STRICT LEVEL 2//EN//2.0" => 1,            "-//MICROSOFT//DTD INTERNET EXPLORER 3.0 HTML STRICT//",
3166            "-//IETF//DTD HTML STRICT LEVEL 3//EN" => 1,            "-//MICROSOFT//DTD INTERNET EXPLORER 3.0 HTML//",
3167            "-//IETF//DTD HTML STRICT LEVEL 3//EN//3.0" => 1,            "-//MICROSOFT//DTD INTERNET EXPLORER 3.0 TABLES//",
3168            "-//IETF//DTD HTML STRICT//EN" => 1,            "-//NETSCAPE COMM. CORP.//DTD HTML//",
3169            "-//IETF//DTD HTML STRICT//EN//2.0" => 1,            "-//NETSCAPE COMM. CORP.//DTD STRICT HTML//",
3170            "-//IETF//DTD HTML STRICT//EN//3.0" => 1,            "-//O'REILLY AND ASSOCIATES//DTD HTML 2.0//",
3171            "-//IETF//DTD HTML//EN" => 1,            "-//O'REILLY AND ASSOCIATES//DTD HTML EXTENDED 1.0//",
3172            "-//IETF//DTD HTML//EN//2.0" => 1,            "-//O'REILLY AND ASSOCIATES//DTD HTML EXTENDED RELAXED 1.0//",
3173            "-//IETF//DTD HTML//EN//3.0" => 1,            "-//SOFTQUAD SOFTWARE//DTD HOTMETAL PRO 6.0::19990601::EXTENSIONS TO HTML 4.0//",
3174            "-//METRIUS//DTD METRIUS PRESENTATIONAL//EN" => 1,            "-//SOFTQUAD//DTD HOTMETAL PRO 4.0::19971010::EXTENSIONS TO HTML 4.0//",
3175            "-//MICROSOFT//DTD INTERNET EXPLORER 2.0 HTML STRICT//EN" => 1,            "-//SPYGLASS//DTD HTML 2.0 EXTENDED//",
3176            "-//MICROSOFT//DTD INTERNET EXPLORER 2.0 HTML//EN" => 1,            "-//SQ//DTD HTML 2.0 HOTMETAL + EXTENSIONS//",
3177            "-//MICROSOFT//DTD INTERNET EXPLORER 2.0 TABLES//EN" => 1,            "-//SUN MICROSYSTEMS CORP.//DTD HOTJAVA HTML//",
3178            "-//MICROSOFT//DTD INTERNET EXPLORER 3.0 HTML STRICT//EN" => 1,            "-//SUN MICROSYSTEMS CORP.//DTD HOTJAVA STRICT HTML//",
3179            "-//MICROSOFT//DTD INTERNET EXPLORER 3.0 HTML//EN" => 1,            "-//W3C//DTD HTML 3 1995-03-24//",
3180            "-//MICROSOFT//DTD INTERNET EXPLORER 3.0 TABLES//EN" => 1,            "-//W3C//DTD HTML 3.2 DRAFT//",
3181            "-//NETSCAPE COMM. CORP.//DTD HTML//EN" => 1,            "-//W3C//DTD HTML 3.2 FINAL//",
3182            "-//NETSCAPE COMM. CORP.//DTD STRICT HTML//EN" => 1,            "-//W3C//DTD HTML 3.2//",
3183            "-//O'REILLY AND ASSOCIATES//DTD HTML 2.0//EN" => 1,            "-//W3C//DTD HTML 3.2S DRAFT//",
3184            "-//O'REILLY AND ASSOCIATES//DTD HTML EXTENDED 1.0//EN" => 1,            "-//W3C//DTD HTML 4.0 FRAMESET//",
3185            "-//O'REILLY AND ASSOCIATES//DTD HTML EXTENDED RELAXED 1.0//EN" => 1,            "-//W3C//DTD HTML 4.0 TRANSITIONAL//",
3186            "-//SOFTQUAD SOFTWARE//DTD HOTMETAL PRO 6.0::19990601::EXTENSIONS TO HTML 4.0//EN" => 1,            "-//W3C//DTD HTML EXPERIMETNAL 19960712//",
3187            "-//SOFTQUAD//DTD HOTMETAL PRO 4.0::19971010::EXTENSIONS TO HTML 4.0//EN" => 1,            "-//W3C//DTD HTML EXPERIMENTAL 970421//",
3188            "-//SPYGLASS//DTD HTML 2.0 EXTENDED//EN" => 1,            "-//W3C//DTD W3 HTML//",
3189            "-//SQ//DTD HTML 2.0 HOTMETAL + EXTENSIONS//EN" => 1,            "-//W3O//DTD W3 HTML 3.0//",
3190            "-//SUN MICROSYSTEMS CORP.//DTD HOTJAVA HTML//EN" => 1,            "-//WEBTECHS//DTD MOZILLA HTML 2.0//",
3191            "-//SUN MICROSYSTEMS CORP.//DTD HOTJAVA STRICT HTML//EN" => 1,            "-//WEBTECHS//DTD MOZILLA HTML//",
3192            "-//W3C//DTD HTML 3 1995-03-24//EN" => 1,          ]; # $prefix
3193            "-//W3C//DTD HTML 3.2 DRAFT//EN" => 1,          my $match;
3194            "-//W3C//DTD HTML 3.2 FINAL//EN" => 1,          for (@$prefix) {
3195            "-//W3C//DTD HTML 3.2//EN" => 1,            if (substr ($prefix, 0, length $_) eq $_) {
3196            "-//W3C//DTD HTML 3.2S DRAFT//EN" => 1,              $match = 1;
3197            "-//W3C//DTD HTML 4.0 FRAMESET//EN" => 1,              last;
3198            "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN" => 1,            }
3199            "-//W3C//DTD HTML EXPERIMETNAL 19960712//EN" => 1,          }
3200            "-//W3C//DTD HTML EXPERIMENTAL 970421//EN" => 1,          if ($match or
3201            "-//W3C//DTD W3 HTML//EN" => 1,              $pubid eq "-//W3O//DTD W3 HTML STRICT 3.0//EN//" or
3202            "-//W3O//DTD W3 HTML 3.0//EN" => 1,              $pubid eq "-/W3C/DTD HTML 4.0 TRANSITIONAL/EN" or
3203            "-//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}) {  
3204            !!!cp ('t5');            !!!cp ('t5');
3205            $self->{document}->manakai_compat_mode ('quirks');            $self->{document}->manakai_compat_mode ('quirks');
3206          } elsif ($pubid eq "-//W3C//DTD HTML 4.01 FRAMESET//EN" or          } elsif ($pubid =~ m[^-//W3C//DTD HTML 4.01 FRAMESET//] or
3207                   $pubid eq "-//W3C//DTD HTML 4.01 TRANSITIONAL//EN") {                   $pubid =~ m[^-//W3C//DTD HTML 4.01 TRANSITIONAL//]) {
3208            if (defined $token->{system_identifier}) {            if (defined $token->{system_identifier}) {
3209              !!!cp ('t6');              !!!cp ('t6');
3210              $self->{document}->manakai_compat_mode ('quirks');              $self->{document}->manakai_compat_mode ('quirks');
# Line 3188  sub _tree_construction_initial ($) { Line 3212  sub _tree_construction_initial ($) {
3212              !!!cp ('t7');              !!!cp ('t7');
3213              $self->{document}->manakai_compat_mode ('limited quirks');              $self->{document}->manakai_compat_mode ('limited quirks');
3214            }            }
3215          } elsif ($pubid eq "-//W3C//DTD XHTML 1.0 FRAMESET//EN" or          } elsif ($pubid =~ m[^-//W3C//DTD XHTML 1.0 FRAMESET//] or
3216                   $pubid eq "-//W3C//DTD XHTML 1.0 TRANSITIONAL//EN") {                   $pubid =~ m[^-//W3C//DTD XHTML 1.0 TRANSITIONAL//]) {
3217            !!!cp ('t8');            !!!cp ('t8');
3218            $self->{document}->manakai_compat_mode ('limited quirks');            $self->{document}->manakai_compat_mode ('limited quirks');
3219          } else {          } else {
# Line 3202  sub _tree_construction_initial ($) { Line 3226  sub _tree_construction_initial ($) {
3226          my $sysid = $token->{system_identifier};          my $sysid = $token->{system_identifier};
3227          $sysid =~ tr/A-Z/a-z/;          $sysid =~ tr/A-Z/a-z/;
3228          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") {
3229            ## TODO: Check the spec: PUBLIC "(limited quirks)" "(quirks)"            ## NOTE: Ensure that |PUBLIC "(limited quirks)" "(quirks)"| is
3230              ## marked as quirks.
3231            $self->{document}->manakai_compat_mode ('quirks');            $self->{document}->manakai_compat_mode ('quirks');
3232            !!!cp ('t11');            !!!cp ('t11');
3233          } else {          } else {
# Line 3388  sub _reset_insertion_mode ($) { Line 3413  sub _reset_insertion_mode ($) {
3413          ## NOTE: Strictly spaking, the line below only applies to MathML and          ## NOTE: Strictly spaking, the line below only applies to MathML and
3414          ## SVG elements.  Currently the HTML syntax supports only MathML and          ## SVG elements.  Currently the HTML syntax supports only MathML and
3415          ## SVG elements as foreigners.          ## SVG elements as foreigners.
3416          $new_mode = $self->{insertion_mode} | IN_FOREIGN_CONTENT_IM;          $new_mode = IN_BODY_IM | IN_FOREIGN_CONTENT_IM;
         ## ISSUE: What is set as the secondary insertion mode?  
3417        } elsif ($node->[1] & TABLE_CELL_EL) {        } elsif ($node->[1] & TABLE_CELL_EL) {
3418          if ($last) {          if ($last) {
3419            !!!cp ('t28.2');            !!!cp ('t28.2');
# Line 3993  sub _tree_construction_main ($) { Line 4017  sub _tree_construction_main ($) {
4017            #            #
4018          } elsif ({          } elsif ({
4019                    b => 1, big => 1, blockquote => 1, body => 1, br => 1,                    b => 1, big => 1, blockquote => 1, body => 1, br => 1,
4020                    center => 1, code => 1, dd => 1, div => 1, dl => 1, em => 1,                    center => 1, code => 1, dd => 1, div => 1, dl => 1, dt => 1,
4021                    embed => 1, font => 1, h1 => 1, h2 => 1, h3 => 1, ## No h4!                    em => 1, embed => 1, font => 1, h1 => 1, h2 => 1, h3 => 1,
4022                    h5 => 1, h6 => 1, head => 1, hr => 1, i => 1, img => 1,                    h4 => 1, h5 => 1, h6 => 1, head => 1, hr => 1, i => 1,
4023                    li => 1, menu => 1, meta => 1, nobr => 1, p => 1, pre => 1,                    img => 1, li => 1, listing => 1, menu => 1, meta => 1,
4024                    ruby => 1, s => 1, small => 1, span => 1, strong => 1,                    nobr => 1, ol => 1, p => 1, pre => 1, ruby => 1, s => 1,
4025                    sub => 1, sup => 1, table => 1, tt => 1, u => 1, ul => 1,                    small => 1, span => 1, strong => 1, strike => 1, sub => 1,
4026                    var => 1,                    sup => 1, table => 1, tt => 1, u => 1, ul => 1, var => 1,
4027                   }->{$token->{tag_name}}) {                   }->{$token->{tag_name}}) {
4028            !!!cp ('t87.2');            !!!cp ('t87.2');
4029            !!!parse-error (type => 'not closed',            !!!parse-error (type => 'not closed',
# Line 4079  sub _tree_construction_main ($) { Line 4103  sub _tree_construction_main ($) {
4103          !!!cp ('t87.5');          !!!cp ('t87.5');
4104          #          #
4105        } elsif ($token->{type} == END_OF_FILE_TOKEN) {        } elsif ($token->{type} == END_OF_FILE_TOKEN) {
         ## NOTE: "using the rules for secondary insertion mode" then "continue"  
4106          !!!cp ('t87.6');          !!!cp ('t87.6');
4107          #          !!!parse-error (type => 'not closed',
4108          ## TODO: ...                          value => $self->{open_elements}->[-1]->[0]
4109                                ->manakai_local_name,
4110                            token => $token);
4111    
4112            pop @{$self->{open_elements}}
4113                while $self->{open_elements}->[-1]->[1] & FOREIGN_EL;
4114    
4115            $self->{insertion_mode} &= ~ IN_FOREIGN_CONTENT_IM;
4116            ## Reprocess.
4117            next B;
4118        } else {        } else {
4119          die "$0: $token->{type}: Unknown token type";                  die "$0: $token->{type}: Unknown token type";        
4120        }        }
# Line 4261  sub _tree_construction_main ($) { Line 4293  sub _tree_construction_main ($) {
4293                                                 ->{has_reference});                                                 ->{has_reference});
4294                  } elsif ($token->{attributes}->{content}) {                  } elsif ($token->{attributes}->{content}) {
4295                    if ($token->{attributes}->{content}->{value}                    if ($token->{attributes}->{content}->{value}
4296                        =~ /\A[^;]*;[\x09-\x0D\x20]*[Cc][Hh][Aa][Rr][Ss][Ee][Tt]                        =~ /[Cc][Hh][Aa][Rr][Ss][Ee][Tt]
4297                            [\x09-\x0D\x20]*=                            [\x09-\x0D\x20]*=
4298                            [\x09-\x0D\x20]*(?>"([^"]*)"|'([^']*)'|                            [\x09-\x0D\x20]*(?>"([^"]*)"|'([^']*)'|
4299                            ([^"'\x09-\x0D\x20][^\x09-\x0D\x20]*))/x) {                            ([^"'\x09-\x0D\x20][^\x09-\x0D\x20\x3B]*))/x) {
4300                      !!!cp ('t107');                      !!!cp ('t107');
4301                      ## NOTE: Whether the encoding is supported or not is handled                      ## NOTE: Whether the encoding is supported or not is handled
4302                      ## in the {change_encoding} callback.                      ## in the {change_encoding} callback.
# Line 4326  sub _tree_construction_main ($) { Line 4358  sub _tree_construction_main ($) {
4358                pop @{$self->{open_elements}} # <head>                pop @{$self->{open_elements}} # <head>
4359                    if $self->{insertion_mode} == AFTER_HEAD_IM;                    if $self->{insertion_mode} == AFTER_HEAD_IM;
4360                next B;                next B;
4361              } elsif ($token->{tag_name} eq 'style') {              } elsif ($token->{tag_name} eq 'style' or
4362                         $token->{tag_name} eq 'noframes') {
4363                ## NOTE: Or (scripting is enabled and tag_name eq 'noscript' and                ## NOTE: Or (scripting is enabled and tag_name eq 'noscript' and
4364                ## insertion mode IN_HEAD_IM)                ## insertion mode IN_HEAD_IM)
4365                ## NOTE: There is a "as if in head" code clone.                ## NOTE: There is a "as if in head" code clone.
# Line 5838  sub _tree_construction_main ($) { Line 5871  sub _tree_construction_main ($) {
5871            !!!nack ('t277.1');            !!!nack ('t277.1');
5872            !!!next-token;            !!!next-token;
5873            next B;            next B;
5874          } elsif ($token->{tag_name} eq 'select' or          } elsif ({
5875                   $token->{tag_name} eq 'input' or                     select => 1, input => 1, textarea => 1,
5876                     }->{$token->{tag_name}} or
5877                   ($self->{insertion_mode} == IN_SELECT_IN_TABLE_IM and                   ($self->{insertion_mode} == IN_SELECT_IN_TABLE_IM and
5878                    {                    {
5879                     caption => 1, table => 1,                     caption => 1, table => 1,
# Line 6196  sub _tree_construction_main ($) { Line 6230  sub _tree_construction_main ($) {
6230            next B;            next B;
6231          } elsif ($token->{tag_name} eq 'noframes') {          } elsif ($token->{tag_name} eq 'noframes') {
6232            !!!cp ('t320');            !!!cp ('t320');
6233            ## NOTE: As if in body.            ## NOTE: As if in head.
6234            $parse_rcdata->(CDATA_CONTENT_MODEL);            $parse_rcdata->(CDATA_CONTENT_MODEL);
6235            next B;            next B;
6236          } else {          } else {
# Line 6324  sub _tree_construction_main ($) { Line 6358  sub _tree_construction_main ($) {
6358                                           ->{has_reference});                                           ->{has_reference});
6359            } elsif ($token->{attributes}->{content}) {            } elsif ($token->{attributes}->{content}) {
6360              if ($token->{attributes}->{content}->{value}              if ($token->{attributes}->{content}->{value}
6361                  =~ /\A[^;]*;[\x09-\x0D\x20]*[Cc][Hh][Aa][Rr][Ss][Ee][Tt]                  =~ /[Cc][Hh][Aa][Rr][Ss][Ee][Tt]
6362                      [\x09-\x0D\x20]*=                      [\x09-\x0D\x20]*=
6363                      [\x09-\x0D\x20]*(?>"([^"]*)"|'([^']*)'|                      [\x09-\x0D\x20]*(?>"([^"]*)"|'([^']*)'|
6364                      ([^"'\x09-\x0D\x20][^\x09-\x0D\x20]*))/x) {                      ([^"'\x09-\x0D\x20][^\x09-\x0D\x20\x3B]*))/x) {
6365                !!!cp ('t336');                !!!cp ('t336');
6366                ## NOTE: Whether the encoding is supported or not is handled                ## NOTE: Whether the encoding is supported or not is handled
6367                ## in the {change_encoding} callback.                ## in the {change_encoding} callback.
# Line 6639  sub _tree_construction_main ($) { Line 6673  sub _tree_construction_main ($) {
6673                  xmp => 1,                  xmp => 1,
6674                  iframe => 1,                  iframe => 1,
6675                  noembed => 1,                  noembed => 1,
6676                  noframes => 1,                  noframes => 1, ## NOTE: This is an "as if in head" code clone.
6677                  noscript => 0, ## TODO: 1 if scripting is enabled                  noscript => 0, ## TODO: 1 if scripting is enabled
6678                 }->{$token->{tag_name}}) {                 }->{$token->{tag_name}}) {
6679          if ($token->{tag_name} eq 'xmp') {          if ($token->{tag_name} eq 'xmp') {
# Line 6661  sub _tree_construction_main ($) { Line 6695  sub _tree_construction_main ($) {
6695            !!!next-token;            !!!next-token;
6696            next B;            next B;
6697          } else {          } else {
6698              !!!ack ('t391.1');
6699    
6700            my $at = $token->{attributes};            my $at = $token->{attributes};
6701            my $form_attrs;            my $form_attrs;
6702            $form_attrs->{action} = $at->{action} if $at->{action};            $form_attrs->{action} = $at->{action} if $at->{action};
# Line 6704  sub _tree_construction_main ($) { Line 6740  sub _tree_construction_main ($) {
6740                           line => $token->{line}, column => $token->{column}},                           line => $token->{line}, column => $token->{column}},
6741                          {type => END_TAG_TOKEN, tag_name => 'form',                          {type => END_TAG_TOKEN, tag_name => 'form',
6742                           line => $token->{line}, column => $token->{column}};                           line => $token->{line}, column => $token->{column}};
           !!!nack ('t391.1'); ## NOTE: Not acknowledged.  
6743            !!!back-token (@tokens);            !!!back-token (@tokens);
6744            !!!next-token;            !!!next-token;
6745            next B;            next B;

Legend:
Removed from v.1.140  
changed lines
  Added in v.1.150

[email protected]
ViewVC Help
Powered by ViewVC 1.1.24