920 |
my $doctype = $self->{document}->create_document_type_definition |
my $doctype = $self->{document}->create_document_type_definition |
921 |
($doctype_name); |
($doctype_name); |
922 |
|
|
923 |
$doctype_name =~ tr/a-z/A-Z/; # ASCII case-insensitive |
$doctype_name =~ tr/A-Z/a-z/; # ASCII case-insensitive |
924 |
if (not defined $token->{name} or # <!DOCTYPE> |
if ($doctype_name ne 'html') { |
|
defined $token->{sysid}) { |
|
925 |
!!!cp ('t1'); |
!!!cp ('t1'); |
926 |
!!!parse-error (type => 'not HTML5', token => $token); |
!!!parse-error (type => 'not HTML5', token => $token); |
927 |
} elsif ($doctype_name ne 'HTML') { |
} elsif (defined $token->{pubid}) { |
928 |
!!!cp ('t2'); |
!!!cp ('t2'); |
929 |
|
## XXX Obsolete permitted DOCTYPEs |
930 |
!!!parse-error (type => 'not HTML5', token => $token); |
!!!parse-error (type => 'not HTML5', token => $token); |
931 |
} elsif (defined $token->{pubid}) { |
} elsif (defined $token->{sysid}) { |
932 |
if ($token->{pubid} eq 'XSLT-compat') { |
if ($token->{sysid} eq 'about:legacy-compat') { |
933 |
!!!cp ('t1.2'); |
!!!cp ('t1.2'); ## <!DOCTYPE HTML SYSTEM "about:legacy-compat"> |
934 |
!!!parse-error (type => 'XSLT-compat', token => $token, |
!!!parse-error (type => 'XSLT-compat', token => $token, |
935 |
level => $self->{level}->{should}); |
level => $self->{level}->{should}); |
936 |
} else { |
} else { |
937 |
!!!parse-error (type => 'not HTML5', token => $token); |
!!!parse-error (type => 'not HTML5', token => $token); |
938 |
} |
} |
939 |
} else { |
} else { ## <!DOCTYPE HTML> |
940 |
!!!cp ('t3'); |
!!!cp ('t3'); |
941 |
# |
# |
942 |
} |
} |
952 |
## according to DOM3 Core. |
## according to DOM3 Core. |
953 |
$self->{document}->append_child ($doctype); |
$self->{document}->append_child ($doctype); |
954 |
|
|
955 |
if ($token->{quirks} or $doctype_name ne 'HTML') { |
if ($token->{quirks} or $doctype_name ne 'html') { |
956 |
!!!cp ('t4'); |
!!!cp ('t4'); |
957 |
$self->{document}->manakai_compat_mode ('quirks'); |
$self->{document}->manakai_compat_mode ('quirks'); |
958 |
} elsif (defined $token->{pubid}) { |
} elsif (defined $token->{pubid}) { |