| 1004 |
} |
} |
| 1005 |
$self->{onerror}->(node => $node, type => 'element not allowed') |
$self->{onerror}->(node => $node, type => 'element not allowed') |
| 1006 |
if $not_allowed; |
if $not_allowed; |
| 1007 |
|
local $todo->{flag}->{in_head} = 1; |
| 1008 |
my ($sib, $ch) = $self->_check_get_children ($node, $todo); |
my ($sib, $ch) = $self->_check_get_children ($node, $todo); |
| 1009 |
unshift @nodes, @$sib; |
unshift @nodes, @$sib; |
| 1010 |
push @$new_todos, @$ch; |
push @$new_todos, @$ch; |
| 2685 |
|
|
| 2686 |
## NOTE: When script is disabled. |
## NOTE: When script is disabled. |
| 2687 |
$Element->{$HTML_NS}->{noscript} = { |
$Element->{$HTML_NS}->{noscript} = { |
| 2688 |
attrs_checker => $GetHTMLAttrsChecker->({}), |
attrs_checker => sub { |
| 2689 |
|
my ($self, $todo) = @_; |
| 2690 |
|
|
| 2691 |
|
## NOTE: This check is inserted in |attrs_checker|, rather than |checker|, |
| 2692 |
|
## since the later is not invoked when the |noscript| is used as a |
| 2693 |
|
## transparent element. |
| 2694 |
|
unless ($todo->{node}->owner_document->manakai_is_html) { |
| 2695 |
|
$self->{onerror}->(node => $todo->{node}, type => 'in XML:noscript'); |
| 2696 |
|
} |
| 2697 |
|
|
| 2698 |
|
$GetHTMLAttrsChecker->({})->($self, $todo); |
| 2699 |
|
}, |
| 2700 |
checker => sub { |
checker => sub { |
| 2701 |
my ($self, $todo) = @_; |
my ($self, $todo) = @_; |
| 2702 |
|
|
| 2703 |
my $end = $self->_add_minuses ({$HTML_NS => {noscript => 1}}); |
if ($todo->{flag}->{in_head}) { |
| 2704 |
my ($sib, $ch) = $HTMLBlockOrInlineChecker->($self, $todo); |
my $new_todos = []; |
| 2705 |
push @$sib, $end; |
my @nodes = (@{$todo->{node}->child_nodes}); |
| 2706 |
return ($sib, $ch); |
|
| 2707 |
|
while (@nodes) { |
| 2708 |
|
my $node = shift @nodes; |
| 2709 |
|
$self->_remove_minuses ($node) and next if ref $node eq 'HASH'; |
| 2710 |
|
|
| 2711 |
|
my $nt = $node->node_type; |
| 2712 |
|
if ($nt == 1) { |
| 2713 |
|
my $node_ns = $node->namespace_uri; |
| 2714 |
|
$node_ns = '' unless defined $node_ns; |
| 2715 |
|
my $node_ln = $node->manakai_local_name; |
| 2716 |
|
if ($node_ns eq $HTML_NS) { |
| 2717 |
|
if ({link => 1, style => 1}->{$node_ln}) { |
| 2718 |
|
# |
| 2719 |
|
} elsif ($node_ln eq 'meta') { |
| 2720 |
|
if ($node->has_attribute_ns (undef, 'charset')) { |
| 2721 |
|
$self->{onerror}->(node => $node, type => 'element not allowed'); |
| 2722 |
|
} else { |
| 2723 |
|
# |
| 2724 |
|
} |
| 2725 |
|
} else { |
| 2726 |
|
$self->{onerror}->(node => $node, type => 'element not allowed'); |
| 2727 |
|
} |
| 2728 |
|
} else { |
| 2729 |
|
$self->{onerror}->(node => $node, type => 'element not allowed'); |
| 2730 |
|
} |
| 2731 |
|
|
| 2732 |
|
my ($sib, $ch) = $self->_check_get_children ($node, $todo); |
| 2733 |
|
unshift @nodes, @$sib; |
| 2734 |
|
push @$new_todos, @$ch; |
| 2735 |
|
} elsif ($nt == 3 or $nt == 4) { |
| 2736 |
|
if ($node->data =~ /[^\x09-\x0D\x20]/) { |
| 2737 |
|
$self->{onerror}->(node => $node, type => 'character not allowed'); |
| 2738 |
|
} |
| 2739 |
|
} elsif ($nt == 5) { |
| 2740 |
|
unshift @nodes, @{$node->child_nodes}; |
| 2741 |
|
} |
| 2742 |
|
} |
| 2743 |
|
return ($new_todos); |
| 2744 |
|
} else { |
| 2745 |
|
my $end = $self->_add_minuses ({$HTML_NS => {noscript => 1}}); |
| 2746 |
|
my ($sib, $ch) = $HTMLBlockOrInlineChecker->($self, $todo); |
| 2747 |
|
push @$sib, $end; |
| 2748 |
|
return ($sib, $ch); |
| 2749 |
|
} |
| 2750 |
}, |
}, |
| 2751 |
}; |
}; |
| 2752 |
## TODO: noscript in head |
|
| 2753 |
## TODO: noscript in XHTML |
## ISSUE: Scripting is disabled: <head><noscript><html a></noscript></head> |
| 2754 |
|
|
| 2755 |
$Element->{$HTML_NS}->{'event-source'} = { |
$Element->{$HTML_NS}->{'event-source'} = { |
| 2756 |
attrs_checker => $GetHTMLAttrsChecker->({ |
attrs_checker => $GetHTMLAttrsChecker->({ |