| 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 |
| 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', |
| 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 |
| 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 |
} |
} |