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 |
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. |
## NOTE: There is a "as if in head" code clone. |
3467 |
if ($self->{insertion_mode} eq 'after head') { |
if ($self->{insertion_mode} eq 'after head') { |
3468 |
!!!parse-error (type => 'after head:'.$token->{tag_name}); |
!!!parse-error (type => 'after head:'.$token->{tag_name}); |
3473 |
## TODO: Extracting |charset| from |meta|. |
## TODO: Extracting |charset| from |meta|. |
3474 |
pop @{$self->{open_elements}} |
pop @{$self->{open_elements}} |
3475 |
if $self->{insertion_mode} eq 'after head'; |
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. |
3480 |
|
if ($self->{insertion_mode} eq 'after head') { |
3481 |
|
!!!parse-error (type => 'after head:'.$token->{tag_name}); |
3482 |
|
push @{$self->{open_elements}}, [$self->{head_element}, 'head']; |
3483 |
|
} |
3484 |
|
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
3485 |
|
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|. |
3504 |
|
pop @{$self->{open_elements}} |
3505 |
|
if $self->{insertion_mode} eq 'after head'; |
3506 |
!!!next-token; |
!!!next-token; |
3507 |
redo B; |
redo B; |
3508 |
} elsif ($token->{tag_name} eq 'title' and |
} elsif ($token->{tag_name} eq 'title' and |