| 705 |
# |
# |
| 706 |
} else { |
} else { |
| 707 |
!!!parse-error (type => 'nestc'); |
!!!parse-error (type => 'nestc'); |
| 708 |
|
## TODO: Different error type for <aa / bb> than <aa/> |
| 709 |
} |
} |
| 710 |
$self->{state} = 'before attribute name'; |
$self->{state} = 'before attribute name'; |
| 711 |
# next-input-character is already done |
# next-input-character is already done |
| 1085 |
redo A; |
redo A; |
| 1086 |
} else { |
} else { |
| 1087 |
$self->{current_token}->{data} # comment |
$self->{current_token}->{data} # comment |
| 1088 |
.= chr ($self->{next_input_character}); |
.= '-' . chr ($self->{next_input_character}); |
| 1089 |
$self->{state} = 'comment'; |
$self->{state} = 'comment'; |
| 1090 |
!!!next-input-character; |
!!!next-input-character; |
| 1091 |
redo A; |
redo A; |
| 2506 |
!!!next-token; |
!!!next-token; |
| 2507 |
## TODO: Extracting |charset| from |meta|. |
## TODO: Extracting |charset| from |meta|. |
| 2508 |
return; |
return; |
| 2509 |
|
} elsif ($token->{tag_name} eq 'meta') { |
| 2510 |
|
## NOTE: This is an "as if in head" code clone, only "-t" differs |
| 2511 |
|
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
| 2512 |
|
pop @{$self->{open_elements}}; ## ISSUE: This step is missing in the spec. |
| 2513 |
|
|
| 2514 |
|
unless ($self->{confident}) { |
| 2515 |
|
my $charset; |
| 2516 |
|
if ($token->{attributes}->{charset}) { ## TODO: And if supported |
| 2517 |
|
$charset = $token->{attributes}->{charset}->{value}; |
| 2518 |
|
} |
| 2519 |
|
if ($token->{attributes}->{'http-equiv'}) { |
| 2520 |
|
if ($token->{attributes}->{'http-equiv'}->{value} |
| 2521 |
|
=~ /\A[^;]*;[\x09-\x0D\x20]*charset[\x09-\x0D\x20]*= |
| 2522 |
|
[\x09-\x0D\x20]*(?>"([^"]*)"|'([^']*)'| |
| 2523 |
|
([^"'\x09-\x0D\x20][^\x09-\x0D\x20]*))/x) { |
| 2524 |
|
$charset = defined $1 ? $1 : defined $2 ? $2 : $3; |
| 2525 |
|
} ## TODO: And if supported |
| 2526 |
|
} |
| 2527 |
|
## TODO: Change the encoding |
| 2528 |
|
} |
| 2529 |
|
|
| 2530 |
|
!!!next-token; |
| 2531 |
|
## TODO: Extracting |charset| from |meta|. |
| 2532 |
|
return; |
| 2533 |
} elsif ($token->{tag_name} eq 'title') { |
} elsif ($token->{tag_name} eq 'title') { |
| 2534 |
!!!parse-error (type => 'in body:title'); |
!!!parse-error (type => 'in body:title'); |
| 2535 |
## NOTE: This is an "as if in head" code clone |
## NOTE: This is an "as if in head" code clone |
| 3143 |
} # INSCOPE |
} # INSCOPE |
| 3144 |
|
|
| 3145 |
if ($self->{open_elements}->[-1]->[1] ne $token->{tag_name}) { |
if ($self->{open_elements}->[-1]->[1] ne $token->{tag_name}) { |
| 3146 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
if (defined $i) { |
| 3147 |
|
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
| 3148 |
|
} else { |
| 3149 |
|
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
| 3150 |
|
} |
| 3151 |
} |
} |
| 3152 |
|
|
| 3153 |
if (defined $i) { |
if (defined $i) { |
| 3462 |
} elsif ($token->{type} eq 'start tag') { |
} elsif ($token->{type} eq 'start tag') { |
| 3463 |
if ({base => ($self->{insertion_mode} eq 'in head' or |
if ({base => ($self->{insertion_mode} eq 'in head' or |
| 3464 |
$self->{insertion_mode} eq 'after head'), |
$self->{insertion_mode} eq 'after head'), |
| 3465 |
link => 1, meta => 1}->{$token->{tag_name}}) { |
link => 1}->{$token->{tag_name}}) { |
| 3466 |
|
## NOTE: There is a "as if in head" code clone. |
| 3467 |
|
if ($self->{insertion_mode} eq 'after head') { |
| 3468 |
|
!!!parse-error (type => 'after head:'.$token->{tag_name}); |
| 3469 |
|
push @{$self->{open_elements}}, [$self->{head_element}, 'head']; |
| 3470 |
|
} |
| 3471 |
|
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
| 3472 |
|
pop @{$self->{open_elements}}; ## ISSUE: This step is missing in the spec. |
| 3473 |
|
## TODO: Extracting |charset| from |meta|. |
| 3474 |
|
pop @{$self->{open_elements}} |
| 3475 |
|
if $self->{insertion_mode} eq 'after head'; |
| 3476 |
|
!!!next-token; |
| 3477 |
|
redo B; |
| 3478 |
|
} elsif ($token->{tag_name} eq 'meta') { |
| 3479 |
## NOTE: There is a "as if in head" code clone. |
## NOTE: There is a "as if in head" code clone. |
| 3480 |
if ($self->{insertion_mode} eq 'after head') { |
if ($self->{insertion_mode} eq 'after head') { |
| 3481 |
!!!parse-error (type => 'after head:'.$token->{tag_name}); |
!!!parse-error (type => 'after head:'.$token->{tag_name}); |
| 3483 |
} |
} |
| 3484 |
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
| 3485 |
pop @{$self->{open_elements}}; ## ISSUE: This step is missing in the spec. |
pop @{$self->{open_elements}}; ## ISSUE: This step is missing in the spec. |
| 3486 |
|
|
| 3487 |
|
unless ($self->{confident}) { |
| 3488 |
|
my $charset; |
| 3489 |
|
if ($token->{attributes}->{charset}) { ## TODO: And if supported |
| 3490 |
|
$charset = $token->{attributes}->{charset}->{value}; |
| 3491 |
|
} |
| 3492 |
|
if ($token->{attributes}->{'http-equiv'}) { |
| 3493 |
|
if ($token->{attributes}->{'http-equiv'}->{value} |
| 3494 |
|
=~ /\A[^;]*;[\x09-\x0D\x20]*charset[\x09-\x0D\x20]*= |
| 3495 |
|
[\x09-\x0D\x20]*(?>"([^"]*)"|'([^']*)'| |
| 3496 |
|
([^"'\x09-\x0D\x20][^\x09-\x0D\x20]*))/x) { |
| 3497 |
|
$charset = defined $1 ? $1 : defined $2 ? $2 : $3; |
| 3498 |
|
} ## TODO: And if supported |
| 3499 |
|
} |
| 3500 |
|
## TODO: Change the encoding |
| 3501 |
|
} |
| 3502 |
|
|
| 3503 |
## TODO: Extracting |charset| from |meta|. |
## TODO: Extracting |charset| from |meta|. |
| 3504 |
pop @{$self->{open_elements}} |
pop @{$self->{open_elements}} |
| 3505 |
if $self->{insertion_mode} eq 'after head'; |
if $self->{insertion_mode} eq 'after head'; |