720 |
|
|
721 |
my $HTMLLanguageTagAttrChecker = sub { |
my $HTMLLanguageTagAttrChecker = sub { |
722 |
my ($self, $attr) = @_; |
my ($self, $attr) = @_; |
723 |
$self->{onerror}->(node => $attr, level => 'unsupported', |
my $value = $attr->value; |
724 |
type => 'language tag'); |
require Whatpm::LangTag; |
725 |
if ($attr->value eq '') { |
Whatpm::LangTag->check_rfc3066_language_tag ($value, sub { |
726 |
$self->{onerror}->(node => $attr, type => 'language tag:syntax error'); |
my %opt = @_; |
727 |
} |
my $type = 'LangTag:'.$opt{type}; |
728 |
## TODO: RFC 3066 test |
$type .= ':' . $opt{subtag} if defined $opt{subtag}; |
729 |
|
$self->{onerror}->(node => $attr, type => $type, value => $opt{value}, |
730 |
|
level => $opt{level}); |
731 |
|
}); |
732 |
## ISSUE: RFC 4646 (3066bis)? |
## ISSUE: RFC 4646 (3066bis)? |
733 |
|
|
734 |
|
## TODO: testdata |
735 |
}; # $HTMLLanguageTagAttrChecker |
}; # $HTMLLanguageTagAttrChecker |
736 |
|
|
737 |
## "A valid media query [MQ]" |
## "A valid media query [MQ]" |
806 |
title => sub {}, ## NOTE: No conformance creteria |
title => sub {}, ## NOTE: No conformance creteria |
807 |
lang => sub { |
lang => sub { |
808 |
my ($self, $attr) = @_; |
my ($self, $attr) = @_; |
809 |
$self->{onerror}->(node => $attr, level => 'unsupported', |
my $value = $attr->value; |
810 |
type => 'language tag'); |
if ($value eq '') { |
811 |
## TODO: RFC 3066 or empty test |
# |
812 |
|
} else { |
813 |
|
require Whatpm::LangTag; |
814 |
|
Whatpm::LangTag->check_rfc3066_language_tag ($value, sub { |
815 |
|
my %opt = @_; |
816 |
|
my $type = 'LangTag:'.$opt{type}; |
817 |
|
$type .= ':' . $opt{subtag} if defined $opt{subtag}; |
818 |
|
$self->{onerror}->(node => $attr, type => $type, value => $opt{value}, |
819 |
|
level => $opt{level}); |
820 |
|
}); |
821 |
|
} |
822 |
## ISSUE: RFC 4646 (3066bis)? |
## ISSUE: RFC 4646 (3066bis)? |
823 |
unless ($attr->owner_document->manakai_is_html) { |
unless ($attr->owner_document->manakai_is_html) { |
824 |
$self->{onerror}->(node => $attr, type => 'in XML:lang'); |
$self->{onerror}->(node => $attr, type => 'in XML:lang'); |
825 |
} |
} |
826 |
|
|
827 |
|
## TODO: test data |
828 |
}, |
}, |
829 |
dir => $GetHTMLEnumeratedAttrChecker->({ltr => 1, rtl => 1}), |
dir => $GetHTMLEnumeratedAttrChecker->({ltr => 1, rtl => 1}), |
830 |
class => sub { |
class => sub { |