| 79 |
## as defined by [IETF RFC 3066], Tags for the Identification |
## as defined by [IETF RFC 3066], Tags for the Identification |
| 80 |
## of Languages, or its successor; in addition, the empty string |
## of Languages, or its successor; in addition, the empty string |
| 81 |
## may be specified." ("may" in lower case) |
## may be specified." ("may" in lower case) |
| 82 |
## NOTE: Is an RFC 3066-valid (but RFC 4647-invalid) language tag |
## NOTE: Is an RFC 3066-valid (but RFC 4646-invalid) language tag |
| 83 |
## allowed today? |
## allowed today? |
| 84 |
|
|
| 85 |
## TODO: test data |
## TODO: test data |
| 225 |
my ($self, $item, $element_state) = @_; |
my ($self, $item, $element_state) = @_; |
| 226 |
for my $attr (@{$item->{node}->attributes}) { |
for my $attr (@{$item->{node}->attributes}) { |
| 227 |
my $attr_ns = $attr->namespace_uri; |
my $attr_ns = $attr->namespace_uri; |
| 228 |
$attr_ns = '' unless defined $attr_ns; |
if (defined $attr_ns) { |
| 229 |
|
load_ns_module ($attr_ns); |
| 230 |
|
} else { |
| 231 |
|
$attr_ns = ''; |
| 232 |
|
} |
| 233 |
my $attr_ln = $attr->manakai_local_name; |
my $attr_ln = $attr->manakai_local_name; |
| 234 |
|
|
|
load_ns_module ($attr_ns); |
|
|
|
|
| 235 |
my $checker = $AttrChecker->{$attr_ns}->{$attr_ln} |
my $checker = $AttrChecker->{$attr_ns}->{$attr_ln} |
| 236 |
|| $AttrChecker->{$attr_ns}->{''}; |
|| $AttrChecker->{$attr_ns}->{''}; |
| 237 |
my $status = $AttrStatus->{$attr_ns}->{$attr_ln} |
my $status = $AttrStatus->{$attr_ns}->{$attr_ln} |
| 302 |
## embedded content. |
## embedded content. |
| 303 |
}; |
}; |
| 304 |
|
|
| 305 |
|
our $IsInHTMLInteractiveContent = sub { |
| 306 |
|
my ($el, $nsuri, $ln) = @_; |
| 307 |
|
|
| 308 |
|
## NOTE: This CODE returns whether an element that is conditionally |
| 309 |
|
## categorizzed as an interactive content is currently in that |
| 310 |
|
## condition or not. See $HTMLInteractiveContent list defined in |
| 311 |
|
## Whatpm::ContentChecler::HTML for the list of all (conditionally |
| 312 |
|
## or permanently) interactive content. |
| 313 |
|
|
| 314 |
|
if ($nsuri eq $HTML_NS and ($ln eq 'video' or $ln eq 'audio')) { |
| 315 |
|
return $el->has_attribute ('controls'); |
| 316 |
|
} elsif ($nsuri eq $HTML_NS and $ln eq 'menu') { |
| 317 |
|
my $value = $el->get_attribute ('type'); |
| 318 |
|
$value =~ tr/A-Z/a-z/; # ASCII case-insensitive |
| 319 |
|
return ($value eq 'toolbar'); |
| 320 |
|
} else { |
| 321 |
|
return 1; |
| 322 |
|
} |
| 323 |
|
}; # $IsInHTMLInteractiveContent |
| 324 |
|
|
| 325 |
my $HTMLTransparentElements = { |
my $HTMLTransparentElements = { |
| 326 |
$HTML_NS => {qw/ins 1 del 1 font 1 noscript 1 canvas 1 a 1/}, |
$HTML_NS => {qw/ins 1 del 1 font 1 noscript 1 canvas 1 a 1/}, |
| 327 |
## NOTE: |html:noscript| is transparent if scripting is disabled |
## NOTE: |html:noscript| is transparent if scripting is disabled |
| 383 |
should => 's', |
should => 's', |
| 384 |
warn => 'w', |
warn => 'w', |
| 385 |
good => 'w', |
good => 'w', |
| 386 |
|
undefined => 'w', |
| 387 |
info => 'i', |
info => 'i', |
| 388 |
|
|
| 389 |
uncertain => 'u', |
uncertain => 'u', |
| 451 |
## ISSUE: Unexpanded entity references and HTML5 conformance |
## ISSUE: Unexpanded entity references and HTML5 conformance |
| 452 |
|
|
| 453 |
my $docel_nsuri = $docel->namespace_uri; |
my $docel_nsuri = $docel->namespace_uri; |
| 454 |
$docel_nsuri = '' unless defined $docel_nsuri; |
if (defined $docel_nsuri) { |
| 455 |
load_ns_module ($docel_nsuri); |
load_ns_module ($docel_nsuri); |
| 456 |
|
} else { |
| 457 |
|
$docel_nsuri = ''; |
| 458 |
|
} |
| 459 |
my $docel_def = $Element->{$docel_nsuri}->{$docel->manakai_local_name} || |
my $docel_def = $Element->{$docel_nsuri}->{$docel->manakai_local_name} || |
| 460 |
$Element->{$docel_nsuri}->{''} || |
$Element->{$docel_nsuri}->{''} || |
| 461 |
$ElementDefault; |
$ElementDefault; |
| 558 |
$self->{plus_elements} = {}; |
$self->{plus_elements} = {}; |
| 559 |
$self->{minus_elements} = {}; |
$self->{minus_elements} = {}; |
| 560 |
$self->{id} = {}; |
$self->{id} = {}; |
| 561 |
|
$self->{form} = {}; |
| 562 |
$self->{term} = {}; |
$self->{term} = {}; |
| 563 |
$self->{usemap} = []; |
$self->{usemap} = []; |
| 564 |
$self->{ref} = []; # datetemplate data references |
$self->{ref} = []; # datetemplate data references |
| 592 |
$code->(@$item); |
$code->(@$item); |
| 593 |
} elsif ($item->{type} eq 'element') { |
} elsif ($item->{type} eq 'element') { |
| 594 |
my $el_nsuri = $item->{node}->namespace_uri; |
my $el_nsuri = $item->{node}->namespace_uri; |
| 595 |
$el_nsuri = '' unless defined $el_nsuri; |
if (defined $el_nsuri) { |
| 596 |
|
load_ns_module ($el_nsuri); |
| 597 |
|
} else { |
| 598 |
|
$el_nsuri = ''; |
| 599 |
|
} |
| 600 |
my $el_ln = $item->{node}->manakai_local_name; |
my $el_ln = $item->{node}->manakai_local_name; |
| 601 |
|
|
|
load_ns_module ($el_nsuri); |
|
|
|
|
| 602 |
my $element_state = {}; |
my $element_state = {}; |
| 603 |
my $eldef = $Element->{$el_nsuri}->{$el_ln} || |
my $eldef = $Element->{$el_nsuri}->{$el_ln} || |
| 604 |
$Element->{$el_nsuri}->{''} || |
$Element->{$el_nsuri}->{''} || |
| 698 |
} |
} |
| 699 |
} elsif ($child_nt == 3 or # TEXT_NODE |
} elsif ($child_nt == 3 or # TEXT_NODE |
| 700 |
$child_nt == 4) { # CDATA_SECTION_NODE |
$child_nt == 4) { # CDATA_SECTION_NODE |
| 701 |
my $has_significant = ($child->data =~ /[^\x09-\x0D\x20]/); |
my $has_significant = ($child->data =~ /[^\x09\x0A\x0C\x0D\x20]/); |
| 702 |
push @new_item, [$content_def->{check_child_text}, |
push @new_item, [$content_def->{check_child_text}, |
| 703 |
$self, $item, $child, $has_significant, |
$self, $item, $child, $has_significant, |
| 704 |
$content_state, $element_state]; |
$content_state, $element_state]; |
| 788 |
delete $self->{minus_elements}; |
delete $self->{minus_elements}; |
| 789 |
delete $self->{onerror}; |
delete $self->{onerror}; |
| 790 |
delete $self->{id}; |
delete $self->{id}; |
| 791 |
|
delete $self->{form}; |
| 792 |
delete $self->{usemap}; |
delete $self->{usemap}; |
| 793 |
delete $self->{ref}; |
delete $self->{ref}; |
| 794 |
delete $self->{template}; |
delete $self->{template}; |
| 992 |
last CN; |
last CN; |
| 993 |
} |
} |
| 994 |
} elsif ($cnt == 3 or $cnt == 4) { |
} elsif ($cnt == 3 or $cnt == 4) { |
| 995 |
if ($cn->data =~ /[^\x09-\x0D\x20]/) { |
if ($cn->data =~ /[^\x09\x0A\x0C\x0D\x20]/) { |
| 996 |
last CN; |
last CN; |
| 997 |
} |
} |
| 998 |
} |
} |
| 1013 |
last CN; |
last CN; |
| 1014 |
} |
} |
| 1015 |
} elsif ($cnt == 3 or $cnt == 4) { |
} elsif ($cnt == 3 or $cnt == 4) { |
| 1016 |
if ($cn->data =~ /[^\x09-\x0D\x20]/) { |
if ($cn->data =~ /[^\x09\x0A\x0C\x0D\x20]/) { |
| 1017 |
last CN; |
last CN; |
| 1018 |
} |
} |
| 1019 |
} |
} |