| 142 |
[$HTML_NS, 'menu'], |
[$HTML_NS, 'menu'], |
| 143 |
]; |
]; |
| 144 |
|
|
| 145 |
my $HTMLInteractiveElements = [ |
my $HTMLInteractiveElements = { |
| 146 |
[$HTML_NS, 'a'], |
$HTML_NS => {a => 1, details => 1, datagrid => 1}, |
| 147 |
[$HTML_NS, 'details'], |
}; |
| 148 |
[$HTML_NS, 'datagrid'], |
## NOTE: |html:a| and |html:datagrid| are not allowed as a descendant |
| 149 |
]; |
## of interactive elements |
| 150 |
|
|
| 151 |
my $HTMLTransparentElements = [ |
my $HTMLTransparentElements = [ |
| 152 |
[$HTML_NS, 'ins'], |
[$HTML_NS, 'ins'], |
| 241 |
my $node_ns = $node->namespace_uri; |
my $node_ns = $node->namespace_uri; |
| 242 |
$node_ns = '' unless defined $node_ns; |
$node_ns = '' unless defined $node_ns; |
| 243 |
my $node_ln = $node->manakai_local_name; |
my $node_ln = $node->manakai_local_name; |
| 244 |
if ($self->{minuses}->{$node_ns}->{$node_ln}) { |
my $not_allowed = $self->{minuses}->{$node_ns}->{$node_ln}; |
|
$self->{onerror}->(node => $node, type => 'element not allowed'); |
|
|
} |
|
| 245 |
if ($node->manakai_element_type_match ($HTML_NS, 'style')) { |
if ($node->manakai_element_type_match ($HTML_NS, 'style')) { |
| 246 |
if ($has_non_style) { |
$not_allowed = 1 if $has_non_style; |
|
$self->{onerror}->(node => $node, type => 'element not allowed'); |
|
|
} |
|
| 247 |
} else { |
} else { |
| 248 |
$has_non_style = 1; |
$has_non_style = 1; |
| 249 |
CHK: { |
CHK: { |
| 252 |
last CHK; |
last CHK; |
| 253 |
} |
} |
| 254 |
} |
} |
| 255 |
$self->{onerror}->(node => $node, type => 'element not allowed'); |
$not_allowed = 1; |
| 256 |
} # CHK |
} # CHK |
| 257 |
} |
} |
| 258 |
|
$self->{onerror}->(node => $node, type => 'element not allowed') |
| 259 |
|
if $not_allowed; |
| 260 |
my ($sib, $ch) = $self->_check_get_children ($node); |
my ($sib, $ch) = $self->_check_get_children ($node); |
| 261 |
unshift @nodes, @$sib; |
unshift @nodes, @$sib; |
| 262 |
push @$new_todos, @$ch; |
push @$new_todos, @$ch; |
| 287 |
my $node_ns = $node->namespace_uri; |
my $node_ns = $node->namespace_uri; |
| 288 |
$node_ns = '' unless defined $node_ns; |
$node_ns = '' unless defined $node_ns; |
| 289 |
my $node_ln = $node->manakai_local_name; |
my $node_ln = $node->manakai_local_name; |
| 290 |
if ($self->{minuses}->{$node_ns}->{$node_ln}) { |
my $not_allowed = $self->{minuses}->{$node_ns}->{$node_ln}; |
|
$self->{onerror}->(node => $node, type => 'element not allowed'); |
|
|
} |
|
| 291 |
CHK: { |
CHK: { |
| 292 |
for (@{$HTMLBlockLevelElements}) { |
for (@{$HTMLBlockLevelElements}) { |
| 293 |
if ($node->manakai_element_type_match ($_->[0], $_->[1])) { |
if ($node->manakai_element_type_match ($_->[0], $_->[1])) { |
| 294 |
last CHK; |
last CHK; |
| 295 |
} |
} |
| 296 |
} |
} |
| 297 |
$self->{onerror}->(node => $node, type => 'element not allowed'); |
$not_allowed = 1; |
| 298 |
} # CHK |
} # CHK |
| 299 |
|
$self->{onerror}->(node => $node, type => 'element not allowed') |
| 300 |
|
if $not_allowed; |
| 301 |
my ($sib, $ch) = $self->_check_get_children ($node); |
my ($sib, $ch) = $self->_check_get_children ($node); |
| 302 |
unshift @nodes, @$sib; |
unshift @nodes, @$sib; |
| 303 |
push @$new_todos, @$ch; |
push @$new_todos, @$ch; |
| 328 |
my $node_ns = $node->namespace_uri; |
my $node_ns = $node->namespace_uri; |
| 329 |
$node_ns = '' unless defined $node_ns; |
$node_ns = '' unless defined $node_ns; |
| 330 |
my $node_ln = $node->manakai_local_name; |
my $node_ln = $node->manakai_local_name; |
| 331 |
if ($self->{minuses}->{$node_ns}->{$node_ln}) { |
my $not_allowed = $self->{minuses}->{$node_ns}->{$node_ln}; |
|
$self->{onerror}->(node => $node, type => 'element not allowed'); |
|
|
} |
|
| 332 |
CHK: { |
CHK: { |
| 333 |
for (@{$HTMLStrictlyInlineLevelElements}, |
for (@{$HTMLStrictlyInlineLevelElements}, |
| 334 |
@{$HTMLStructuredInlineLevelElements}) { |
@{$HTMLStructuredInlineLevelElements}) { |
| 336 |
last CHK; |
last CHK; |
| 337 |
} |
} |
| 338 |
} |
} |
| 339 |
$self->{onerror}->(node => $node, type => 'element not allowed'); |
$not_allowed = 1; |
| 340 |
} # CHK |
} # CHK |
| 341 |
|
$self->{onerror}->(node => $node, type => 'element not allowed') |
| 342 |
|
if $not_allowed; |
| 343 |
my ($sib, $ch) = $self->_check_get_children ($node); |
my ($sib, $ch) = $self->_check_get_children ($node); |
| 344 |
unshift @nodes, @$sib; |
unshift @nodes, @$sib; |
| 345 |
push @$new_todos, @$ch; |
push @$new_todos, @$ch; |
| 373 |
my $node_ns = $node->namespace_uri; |
my $node_ns = $node->namespace_uri; |
| 374 |
$node_ns = '' unless defined $node_ns; |
$node_ns = '' unless defined $node_ns; |
| 375 |
my $node_ln = $node->manakai_local_name; |
my $node_ln = $node->manakai_local_name; |
| 376 |
if ($self->{minuses}->{$node_ns}->{$node_ln}) { |
my $not_allowed = $self->{minuses}->{$node_ns}->{$node_ln}; |
|
$self->{onerror}->(node => $node, type => 'element not allowed'); |
|
|
} |
|
| 377 |
CHK: { |
CHK: { |
| 378 |
for (@{$HTMLStrictlyInlineLevelElements}) { |
for (@{$HTMLStrictlyInlineLevelElements}) { |
| 379 |
if ($node->manakai_element_type_match ($_->[0], $_->[1])) { |
if ($node->manakai_element_type_match ($_->[0], $_->[1])) { |
| 380 |
last CHK; |
last CHK; |
| 381 |
} |
} |
| 382 |
} |
} |
| 383 |
$self->{onerror}->(node => $node, type => 'element not allowed'); |
$not_allowed = 1; |
| 384 |
} # CHK |
} # CHK |
| 385 |
|
$self->{onerror}->(node => $node, type => 'element not allowed') |
| 386 |
|
if $not_allowed; |
| 387 |
my ($sib, $ch) = $self->_check_get_children ($node); |
my ($sib, $ch) = $self->_check_get_children ($node); |
| 388 |
unshift @nodes, @$sib; |
unshift @nodes, @$sib; |
| 389 |
push @$new_todos, @$ch; |
push @$new_todos, @$ch; |
| 418 |
my $node_ns = $node->namespace_uri; |
my $node_ns = $node->namespace_uri; |
| 419 |
$node_ns = '' unless defined $node_ns; |
$node_ns = '' unless defined $node_ns; |
| 420 |
my $node_ln = $node->manakai_local_name; |
my $node_ln = $node->manakai_local_name; |
| 421 |
if ($self->{minuses}->{$node_ns}->{$node_ln}) { |
my $not_allowed = $self->{minuses}->{$node_ns}->{$node_ln}; |
|
$self->{onerror}->(node => $node, type => 'element not allowed'); |
|
|
} |
|
| 422 |
CHK: { |
CHK: { |
| 423 |
for (@{$HTMLStrictlyInlineLevelElements}, |
for (@{$HTMLStrictlyInlineLevelElements}, |
| 424 |
$todo->{strictly_inline} ? () : @{$HTMLStructuredInlineLevelElements}) { |
$todo->{strictly_inline} ? () : @{$HTMLStructuredInlineLevelElements}) { |
| 426 |
last CHK; |
last CHK; |
| 427 |
} |
} |
| 428 |
} |
} |
| 429 |
$self->{onerror}->(node => $node, type => 'element not allowed'); |
$not_allowed = 1; |
| 430 |
} # CHK |
} # CHK |
| 431 |
|
$self->{onerror}->(node => $node, type => 'element not allowed') |
| 432 |
|
if $not_allowed; |
| 433 |
my ($sib, $ch) = $self->_check_get_children ($node); |
my ($sib, $ch) = $self->_check_get_children ($node); |
| 434 |
unshift @nodes, @$sib; |
unshift @nodes, @$sib; |
| 435 |
push @$new_todos, @$ch; |
push @$new_todos, @$ch; |
| 445 |
return ($new_todos); |
return ($new_todos); |
| 446 |
}; # $HTMLInlineOrStrictlyInlineChecker |
}; # $HTMLInlineOrStrictlyInlineChecker |
| 447 |
|
|
| 448 |
|
my $HTMLSignificantInlineOrStrictlyInlineChecker |
| 449 |
|
= $HTMLInlineOrStrictlyInlineChecker; |
| 450 |
|
## TODO: check significant content |
| 451 |
|
|
| 452 |
my $HTMLBlockOrInlineChecker = sub { |
my $HTMLBlockOrInlineChecker = sub { |
| 453 |
my ($self, $todo) = @_; |
my ($self, $todo) = @_; |
| 454 |
my $el = $todo->{node}; |
my $el = $todo->{node}; |
| 466 |
my $node_ns = $node->namespace_uri; |
my $node_ns = $node->namespace_uri; |
| 467 |
$node_ns = '' unless defined $node_ns; |
$node_ns = '' unless defined $node_ns; |
| 468 |
my $node_ln = $node->manakai_local_name; |
my $node_ln = $node->manakai_local_name; |
| 469 |
if ($self->{minuses}->{$node_ns}->{$node_ln}) { |
my $not_allowed = $self->{minuses}->{$node_ns}->{$node_ln}; |
|
$self->{onerror}->(node => $node, type => 'element not allowed'); |
|
|
} |
|
| 470 |
if ($content eq 'block') { |
if ($content eq 'block') { |
| 471 |
CHK: { |
CHK: { |
| 472 |
for (@{$HTMLBlockLevelElements}) { |
for (@{$HTMLBlockLevelElements}) { |
| 474 |
last CHK; |
last CHK; |
| 475 |
} |
} |
| 476 |
} |
} |
| 477 |
$self->{onerror}->(node => $node, type => 'element not allowed'); |
$not_allowed = 1; |
| 478 |
} # CHK |
} # CHK |
| 479 |
} elsif ($content eq 'inline') { |
} elsif ($content eq 'inline') { |
| 480 |
CHK: { |
CHK: { |
| 484 |
last CHK; |
last CHK; |
| 485 |
} |
} |
| 486 |
} |
} |
| 487 |
$self->{onerror}->(node => $node, type => 'element not allowed'); |
$not_allowed = 1; |
| 488 |
} # CHK |
} # CHK |
| 489 |
} else { |
} else { |
| 490 |
my $is_block; |
my $is_block; |
| 504 |
} |
} |
| 505 |
} |
} |
| 506 |
|
|
| 507 |
push @block_not_inline, $node if $is_block and not $is_inline; |
push @block_not_inline, $node |
| 508 |
|
if $is_block and not $is_inline and not $not_allowed; |
| 509 |
unless ($is_block) { |
unless ($is_block) { |
| 510 |
$content = 'inline'; |
$content = 'inline'; |
| 511 |
for (@block_not_inline) { |
for (@block_not_inline) { |
| 512 |
$self->{onerror}->(node => $_, type => 'element not allowed'); |
$self->{onerror}->(node => $_, type => 'element not allowed'); |
| 513 |
} |
} |
| 514 |
unless ($is_inline) { |
$not_allowed = 1 unless $is_inline; |
|
$self->{onerror}->(node => $node, type => 'element not allowed'); |
|
|
} |
|
| 515 |
} |
} |
| 516 |
} |
} |
| 517 |
|
$self->{onerror}->(node => $node, type => 'element not allowed') |
| 518 |
|
if $not_allowed; |
| 519 |
my ($sib, $ch) = $self->_check_get_children ($node); |
my ($sib, $ch) = $self->_check_get_children ($node); |
| 520 |
unshift @nodes, @$sib; |
unshift @nodes, @$sib; |
| 521 |
push @$new_todos, @$ch; |
push @$new_todos, @$ch; |
| 564 |
my $node_ns = $node->namespace_uri; |
my $node_ns = $node->namespace_uri; |
| 565 |
$node_ns = '' unless defined $node_ns; |
$node_ns = '' unless defined $node_ns; |
| 566 |
my $node_ln = $node->manakai_local_name; |
my $node_ln = $node->manakai_local_name; |
| 567 |
if ($self->{minuses}->{$node_ns}->{$node_ln}) { |
my $not_allowed = $self->{minuses}->{$node_ns}->{$node_ln}; |
|
$self->{onerror}->(node => $node, type => 'element not allowed'); |
|
|
} |
|
| 568 |
if ($node->manakai_element_type_match ($elnsuri, $ellname)) { |
if ($node->manakai_element_type_match ($elnsuri, $ellname)) { |
| 569 |
if ($has_non_style) { |
$not_allowed = 1 if $has_non_style; |
|
$self->{onerror}->(node => $node, type => 'element not allowed'); |
|
|
} |
|
| 570 |
} elsif ($content eq 'block') { |
} elsif ($content eq 'block') { |
| 571 |
$has_non_style = 1; |
$has_non_style = 1; |
| 572 |
CHK: { |
CHK: { |
| 575 |
last CHK; |
last CHK; |
| 576 |
} |
} |
| 577 |
} |
} |
| 578 |
$self->{onerror}->(node => $node, type => 'element not allowed'); |
$not_allowed = 1; |
| 579 |
} # CHK |
} # CHK |
| 580 |
} elsif ($content eq 'inline') { |
} elsif ($content eq 'inline') { |
| 581 |
$has_non_style = 1; |
$has_non_style = 1; |
| 586 |
last CHK; |
last CHK; |
| 587 |
} |
} |
| 588 |
} |
} |
| 589 |
$self->{onerror}->(node => $node, type => 'element not allowed'); |
$not_allowed = 1; |
| 590 |
} # CHK |
} # CHK |
| 591 |
} else { |
} else { |
| 592 |
$has_non_style = 1; |
$has_non_style = 1; |
| 607 |
} |
} |
| 608 |
} |
} |
| 609 |
|
|
| 610 |
push @block_not_inline, $node if $is_block and not $is_inline; |
push @block_not_inline, $node |
| 611 |
|
if $is_block and not $is_inline and not $not_allowed; |
| 612 |
unless ($is_block) { |
unless ($is_block) { |
| 613 |
$content = 'inline'; |
$content = 'inline'; |
| 614 |
for (@block_not_inline) { |
for (@block_not_inline) { |
| 615 |
$self->{onerror}->(node => $_, type => 'element not allowed'); |
$self->{onerror}->(node => $_, type => 'element not allowed'); |
| 616 |
} |
} |
| 617 |
unless ($is_inline) { |
$not_allowed = 1 unless $is_inline; |
|
$self->{onerror}->(node => $node, type => 'element not allowed'); |
|
|
} |
|
| 618 |
} |
} |
| 619 |
} |
} |
| 620 |
|
$self->{onerror}->(node => $node, type => 'element not allowed') |
| 621 |
|
if $not_allowed; |
| 622 |
my ($sib, $ch) = $self->_check_get_children ($node); |
my ($sib, $ch) = $self->_check_get_children ($node); |
| 623 |
unshift @nodes, @$sib; |
unshift @nodes, @$sib; |
| 624 |
push @$new_todos, @$ch; |
push @$new_todos, @$ch; |
| 667 |
my $node_ns = $node->namespace_uri; |
my $node_ns = $node->namespace_uri; |
| 668 |
$node_ns = '' unless defined $node_ns; |
$node_ns = '' unless defined $node_ns; |
| 669 |
my $node_ln = $node->manakai_local_name; |
my $node_ln = $node->manakai_local_name; |
| 670 |
if ($self->{minuses}->{$node_ns}->{$node_ln}) { |
my $not_allowed = $self->{minuses}->{$node_ns}->{$node_ln}; |
|
$self->{onerror}->(node => $node, type => 'element not allowed'); |
|
|
} |
|
| 671 |
if ($phase eq 'before head') { |
if ($phase eq 'before head') { |
| 672 |
if ($node->manakai_element_type_match ($HTML_NS, 'head')) { |
if ($node->manakai_element_type_match ($HTML_NS, 'head')) { |
| 673 |
$phase = 'after head'; |
$phase = 'after head'; |
| 676 |
->(node => $node, type => 'ps element missing:head'); |
->(node => $node, type => 'ps element missing:head'); |
| 677 |
$phase = 'after body'; |
$phase = 'after body'; |
| 678 |
} else { |
} else { |
| 679 |
$self->{onerror}->(node => $node, type => 'element not allowed'); |
$not_allowed = 1; |
| 680 |
# before head |
# before head |
| 681 |
} |
} |
| 682 |
} elsif ($phase eq 'after head') { |
} elsif ($phase eq 'after head') { |
| 683 |
if ($node->manakai_element_type_match ($HTML_NS, 'body')) { |
if ($node->manakai_element_type_match ($HTML_NS, 'body')) { |
| 684 |
$phase = 'after body'; |
$phase = 'after body'; |
| 685 |
} else { |
} else { |
| 686 |
$self->{onerror}->(node => $node, type => 'element not allowed'); |
$not_allowed = 1; |
| 687 |
# after head |
# after head |
| 688 |
} |
} |
| 689 |
} else { #elsif ($phase eq 'after body') { |
} else { #elsif ($phase eq 'after body') { |
| 690 |
$self->{onerror}->(node => $node, type => 'element not allowed'); |
$not_allowed = 1; |
| 691 |
# after body |
# after body |
| 692 |
} |
} |
| 693 |
|
$self->{onerror}->(node => $node, type => 'element not allowed') |
| 694 |
|
if $not_allowed; |
| 695 |
my ($sib, $ch) = $self->_check_get_children ($node); |
my ($sib, $ch) = $self->_check_get_children ($node); |
| 696 |
unshift @nodes, @$sib; |
unshift @nodes, @$sib; |
| 697 |
push @$new_todos, @$ch; |
push @$new_todos, @$ch; |
| 733 |
my $node_ns = $node->namespace_uri; |
my $node_ns = $node->namespace_uri; |
| 734 |
$node_ns = '' unless defined $node_ns; |
$node_ns = '' unless defined $node_ns; |
| 735 |
my $node_ln = $node->manakai_local_name; |
my $node_ln = $node->manakai_local_name; |
| 736 |
if ($self->{minuses}->{$node_ns}->{$node_ln}) { |
my $not_allowed = $self->{minuses}->{$node_ns}->{$node_ln}; |
|
$self->{onerror}->(node => $node, type => 'element not allowed'); |
|
|
} |
|
| 737 |
if ($node->manakai_element_type_match ($HTML_NS, 'title')) { |
if ($node->manakai_element_type_match ($HTML_NS, 'title')) { |
| 738 |
$phase = 'after base'; |
$phase = 'after base'; |
| 739 |
unless ($has_title) { |
unless ($has_title) { |
| 740 |
$has_title = 1; |
$has_title = 1; |
| 741 |
} else { |
} else { |
| 742 |
$self->{onerror}->(node => $node, type => 'element not allowed'); |
$not_allowed = 1; |
| 743 |
} |
} |
| 744 |
} elsif ($node->manakai_element_type_match ($HTML_NS, 'meta')) { |
} elsif ($node->manakai_element_type_match ($HTML_NS, 'meta')) { |
| 745 |
if ($node->has_attribute_ns (undef, 'charset')) { |
if ($node->has_attribute_ns (undef, 'charset')) { |
| 746 |
if ($phase eq 'initial') { |
if ($phase eq 'initial') { |
| 747 |
$phase = 'after charset'; |
$phase = 'after charset'; |
| 748 |
} else { |
} else { |
| 749 |
$self->{onerror}->(node => $node, type => 'element not allowed'); |
$not_allowed = 1; |
| 750 |
## NOTE: See also |base|'s "contexts" field in the spec |
## NOTE: See also |base|'s "contexts" field in the spec |
| 751 |
} |
} |
| 752 |
} else { |
} else { |
| 756 |
if ($phase eq 'initial' or $phase eq 'after charset') { |
if ($phase eq 'initial' or $phase eq 'after charset') { |
| 757 |
$phase = 'after base'; |
$phase = 'after base'; |
| 758 |
} else { |
} else { |
| 759 |
$self->{onerror}->(node => $node, type => 'element not allowed'); |
$not_allowed = 1; |
| 760 |
} |
} |
| 761 |
} else { |
} else { |
| 762 |
$phase = 'after base'; |
$phase = 'after base'; |
| 766 |
last CHK; |
last CHK; |
| 767 |
} |
} |
| 768 |
} |
} |
| 769 |
$self->{onerror}->(node => $node, type => 'element not allowed'); |
$not_allowed = 1; |
| 770 |
} # CHK |
} # CHK |
| 771 |
} |
} |
| 772 |
|
$self->{onerror}->(node => $node, type => 'element not allowed') |
| 773 |
|
if $not_allowed; |
| 774 |
my ($sib, $ch) = $self->_check_get_children ($node); |
my ($sib, $ch) = $self->_check_get_children ($node); |
| 775 |
unshift @nodes, @$sib; |
unshift @nodes, @$sib; |
| 776 |
push @$new_todos, @$ch; |
push @$new_todos, @$ch; |
| 878 |
my $node_ns = $node->namespace_uri; |
my $node_ns = $node->namespace_uri; |
| 879 |
$node_ns = '' unless defined $node_ns; |
$node_ns = '' unless defined $node_ns; |
| 880 |
my $node_ln = $node->manakai_local_name; |
my $node_ln = $node->manakai_local_name; |
| 881 |
|
my $not_allowed; |
| 882 |
if ($self->{minuses}->{$node_ns}->{$node_ln}) { |
if ($self->{minuses}->{$node_ns}->{$node_ln}) { |
| 883 |
$self->{onerror}->(node => $node, type => 'element not allowed'); |
$not_allowed = 1; |
| 884 |
} elsif ($node_ns eq $HTML_NS and |
} elsif ($node_ns eq $HTML_NS and |
| 885 |
{ |
{ |
| 886 |
qw/h1 1 h2 1 h3 1 h4 1 h5 1 h6 1 header 1 footer 1/ |
qw/h1 1 h2 1 h3 1 h4 1 h5 1 h6 1 header 1 footer 1/ |
| 887 |
}->{$node_ln}) { |
}->{$node_ln}) { |
| 888 |
$self->{onerror}->(node => $node, type => 'element not allowed'); |
$not_allowed = 1; |
| 889 |
} elsif ($HTMLSectioningElements->{$node_ns}->{$node_ln}) { |
} elsif ($HTMLSectioningElements->{$node_ns}->{$node_ln}) { |
| 890 |
$self->{onerror}->(node => $node, type => 'element not allowed'); |
$not_allowed = 1; |
| 891 |
} |
} |
| 892 |
if ($content eq 'block') { |
if ($content eq 'block') { |
| 893 |
CHK: { |
CHK: { |
| 896 |
last CHK; |
last CHK; |
| 897 |
} |
} |
| 898 |
} |
} |
| 899 |
$self->{onerror}->(node => $node, type => 'element not allowed'); |
$not_allowed = 1; |
| 900 |
} # CHK |
} # CHK |
| 901 |
} elsif ($content eq 'inline') { |
} elsif ($content eq 'inline') { |
| 902 |
CHK: { |
CHK: { |
| 906 |
last CHK; |
last CHK; |
| 907 |
} |
} |
| 908 |
} |
} |
| 909 |
$self->{onerror}->(node => $node, type => 'element not allowed'); |
$not_allowed = 1; |
| 910 |
} # CHK |
} # CHK |
| 911 |
} else { |
} else { |
| 912 |
my $is_block; |
my $is_block; |
| 926 |
} |
} |
| 927 |
} |
} |
| 928 |
|
|
| 929 |
push @block_not_inline, $node if $is_block and not $is_inline; |
push @block_not_inline, $node |
| 930 |
|
if $is_block and not $is_inline and not $not_allowed; |
| 931 |
unless ($is_block) { |
unless ($is_block) { |
| 932 |
$content = 'inline'; |
$content = 'inline'; |
| 933 |
for (@block_not_inline) { |
for (@block_not_inline) { |
| 934 |
$self->{onerror}->(node => $_, type => 'element not allowed'); |
$self->{onerror}->(node => $_, type => 'element not allowed'); |
| 935 |
} |
} |
| 936 |
unless ($is_inline) { |
$not_allowed = 1 unless $is_inline; |
|
$self->{onerror}->(node => $node, type => 'element not allowed'); |
|
|
} |
|
| 937 |
} |
} |
| 938 |
} |
} |
| 939 |
|
$self->{onerror}->(node => $node, type => 'element not allowed') |
| 940 |
|
if $not_allowed; |
| 941 |
my ($sib, $ch) = $self->_check_get_children ($node); |
my ($sib, $ch) = $self->_check_get_children ($node); |
| 942 |
unshift @nodes, @$sib; |
unshift @nodes, @$sib; |
| 943 |
push @$new_todos, @$ch; |
push @$new_todos, @$ch; |
| 1174 |
checker => $Element->{$HTML_NS}->{li}->{checker}, |
checker => $Element->{$HTML_NS}->{li}->{checker}, |
| 1175 |
}; |
}; |
| 1176 |
|
|
| 1177 |
## TODO: a |
$Element->{$HTML_NS}->{a} = { |
| 1178 |
|
checker => sub { |
| 1179 |
|
my ($self, $todo) = @_; |
| 1180 |
|
|
| 1181 |
|
my $end = $self->_add_minuses ($HTMLInteractiveElements); |
| 1182 |
|
my ($sib, $ch) |
| 1183 |
|
= $HTMLSignificantInlineOrStrictlyInlineChecker->($self, $todo); |
| 1184 |
|
push @$sib, $end; |
| 1185 |
|
return ($sib, $ch); |
| 1186 |
|
}, |
| 1187 |
|
}; |
| 1188 |
|
|
| 1189 |
$Element->{$HTML_NS}->{q} = { |
$Element->{$HTML_NS}->{q} = { |
| 1190 |
checker => $HTMLInlineOrStrictlyInlineChecker, |
checker => $HTMLInlineOrStrictlyInlineChecker, |
| 1616 |
}; |
}; |
| 1617 |
|
|
| 1618 |
$Element->{$HTML_NS}->{details} = { |
$Element->{$HTML_NS}->{details} = { |
| 1619 |
checker => $GetHTMLZeroOrMoreThenBlockOrInlineChecker->($HTML_NS, 'legend'), |
checker => sub { |
| 1620 |
|
my ($self, $todo) = @_; |
| 1621 |
|
|
| 1622 |
|
my $end = $self->_add_minuses ({$HTML_NS => {a => 1, datagrid => 1}}); |
| 1623 |
|
my ($sib, $ch) |
| 1624 |
|
= $GetHTMLZeroOrMoreThenBlockOrInlineChecker->($HTML_NS, 'legend') |
| 1625 |
|
->($self, $todo); |
| 1626 |
|
push @$sib, $end; |
| 1627 |
|
return ($sib, $ch); |
| 1628 |
|
}, |
| 1629 |
}; |
}; |
| 1630 |
|
|
| 1631 |
$Element->{$HTML_NS}->{datagrid} = { |
$Element->{$HTML_NS}->{datagrid} = { |
| 1632 |
checker => $HTMLBlockChecker, |
checker => sub { |
| 1633 |
|
my ($self, $todo) = @_; |
| 1634 |
|
|
| 1635 |
|
my $end = $self->_add_minuses ({$HTML_NS => {a => 1, datagrid => 1}}); |
| 1636 |
|
my ($sib, $ch) = $HTMLBlockChecker->($self, $todo); |
| 1637 |
|
push @$sib, $end; |
| 1638 |
|
return ($sib, $ch); |
| 1639 |
|
}, |
| 1640 |
}; |
}; |
| 1641 |
|
|
| 1642 |
$Element->{$HTML_NS}->{command} = { |
$Element->{$HTML_NS}->{command} = { |
| 1660 |
my $node_ns = $node->namespace_uri; |
my $node_ns = $node->namespace_uri; |
| 1661 |
$node_ns = '' unless defined $node_ns; |
$node_ns = '' unless defined $node_ns; |
| 1662 |
my $node_ln = $node->manakai_local_name; |
my $node_ln = $node->manakai_local_name; |
| 1663 |
if ($self->{minuses}->{$node_ns}->{$node_ln}) { |
my $not_allowed = $self->{minuses}->{$node_ns}->{$node_ln}; |
|
$self->{onerror}->(node => $node, type => 'element not allowed'); |
|
|
} |
|
| 1664 |
if ($node->manakai_element_type_match ($HTML_NS, 'li')) { |
if ($node->manakai_element_type_match ($HTML_NS, 'li')) { |
| 1665 |
if ($content eq 'inline') { |
if ($content eq 'inline') { |
| 1666 |
$self->{onerror}->(node => $node, type => 'element not allowed'); |
$not_allowed = 1; |
| 1667 |
} elsif ($content eq 'li or inline') { |
} elsif ($content eq 'li or inline') { |
| 1668 |
$content = 'li'; |
$content = 'li'; |
| 1669 |
} |
} |
| 1676 |
last CHK; |
last CHK; |
| 1677 |
} |
} |
| 1678 |
} |
} |
| 1679 |
$self->{onerror}->(node => $node, type => 'element not allowed'); |
$not_allowed = 1; |
| 1680 |
} # CHK |
} # CHK |
| 1681 |
} |
} |
| 1682 |
|
$self->{onerror}->(node => $node, type => 'element not allowed') |
| 1683 |
|
if $not_allowed; |
| 1684 |
my ($sib, $ch) = $self->_check_get_children ($node); |
my ($sib, $ch) = $self->_check_get_children ($node); |
| 1685 |
unshift @nodes, @$sib; |
unshift @nodes, @$sib; |
| 1686 |
push @$new_todos, @$ch; |
push @$new_todos, @$ch; |
| 1704 |
}, |
}, |
| 1705 |
}; |
}; |
| 1706 |
|
|
| 1707 |
## TODO: legend |
$Element->{$HTML_NS}->{legend} = { |
| 1708 |
|
checker => sub { |
| 1709 |
|
my ($self, $todo) = @_; |
| 1710 |
|
|
| 1711 |
|
my $parent = $todo->{node}->manakai_parent_element; |
| 1712 |
|
if (defined $parent) { |
| 1713 |
|
my $nsuri = $parent->namespace_uri; |
| 1714 |
|
$nsuri = '' unless defined $nsuri; |
| 1715 |
|
my $ln = $parent->manakai_local_name; |
| 1716 |
|
if ($nsuri eq $HTML_NS and $ln eq 'figure') { |
| 1717 |
|
return $HTMLInlineChecker->($self, $todo); |
| 1718 |
|
} else { |
| 1719 |
|
return $HTMLSignificantStrictlyInlineChecker->($self, $todo); |
| 1720 |
|
} |
| 1721 |
|
} else { |
| 1722 |
|
return $HTMLInlineChecker->($self, $todo); |
| 1723 |
|
} |
| 1724 |
|
|
| 1725 |
|
## ISSUE: Content model is defined only for fieldset/legend, |
| 1726 |
|
## details/legend, and figure/legend. |
| 1727 |
|
}, |
| 1728 |
|
}; |
| 1729 |
|
|
| 1730 |
$Element->{$HTML_NS}->{div} = { |
$Element->{$HTML_NS}->{div} = { |
| 1731 |
checker => $GetHTMLZeroOrMoreThenBlockOrInlineChecker->($HTML_NS, 'style'), |
checker => $GetHTMLZeroOrMoreThenBlockOrInlineChecker->($HTML_NS, 'style'), |