| 28 |
## as defined by [IETF RFC 3066], Tags for the Identification |
## as defined by [IETF RFC 3066], Tags for the Identification |
| 29 |
## of Languages, or its successor; in addition, the empty string |
## of Languages, or its successor; in addition, the empty string |
| 30 |
## may be specified." ("may" in lower case) |
## may be specified." ("may" in lower case) |
| 31 |
|
$self->{onerror}->(node => $attr, level => 'unsupported', |
| 32 |
|
type => 'language tag'); |
| 33 |
if ($attr->owner_document->manakai_is_html) { # MUST NOT |
if ($attr->owner_document->manakai_is_html) { # MUST NOT |
| 34 |
$self->{onerror}->(node => $attr, level => 'error', |
$self->{onerror}->(node => $attr, type => 'in HTML:xml:lang'); |
|
type => 'in HTML:xml:lang'); |
|
| 35 |
## TODO: Test data... |
## TODO: Test data... |
| 36 |
} |
} |
| 37 |
}, |
}, |
| 749 |
Whatpm::URIChecker->check_iri_reference ($value, sub { |
Whatpm::URIChecker->check_iri_reference ($value, sub { |
| 750 |
my %opt = @_; |
my %opt = @_; |
| 751 |
$self->{onerror}->(node => $attr, level => $opt{level}, |
$self->{onerror}->(node => $attr, level => $opt{level}, |
| 752 |
type => 'URI:'. |
type => 'URI::'.$opt{type}. |
| 753 |
(defined $opt{position} ? $opt{position} : '').':'. |
(defined $opt{position} ? ':'.$opt{position} : '')); |
|
$opt{type}); |
|
| 754 |
}); |
}); |
| 755 |
}; # $HTMLURIAttrChecker |
}; # $HTMLURIAttrChecker |
| 756 |
|
|
| 762 |
Whatpm::URIChecker->check_iri_reference ($value, sub { |
Whatpm::URIChecker->check_iri_reference ($value, sub { |
| 763 |
my %opt = @_; |
my %opt = @_; |
| 764 |
$self->{onerror}->(node => $attr, level => $opt{level}, |
$self->{onerror}->(node => $attr, level => $opt{level}, |
| 765 |
type => 'URIs:'.$i.':'. |
type => 'URIs:'.$i.'::'. |
| 766 |
(defined $opt{position} ? $opt{position} : '').':'. |
$opt{type}. |
| 767 |
$opt{type}); |
(defined $opt{position} ? ':'.$opt{position} : '')); |
| 768 |
}); |
}); |
| 769 |
$i++; |
$i++; |
| 770 |
} |
} |
| 885 |
|
|
| 886 |
my $HTMLLanguageTagAttrChecker = sub { |
my $HTMLLanguageTagAttrChecker = sub { |
| 887 |
my ($self, $attr) = @_; |
my ($self, $attr) = @_; |
| 888 |
|
$self->{onerror}->(node => $attr, level => 'unsupported', |
| 889 |
|
type => 'language tag'); |
| 890 |
if ($attr->value eq '') { |
if ($attr->value eq '') { |
| 891 |
$self->{onerror}->(node => $attr, type => 'language tag:syntax error'); |
$self->{onerror}->(node => $attr, type => 'language tag:syntax error'); |
| 892 |
} |
} |
| 896 |
|
|
| 897 |
## "A valid media query [MQ]" |
## "A valid media query [MQ]" |
| 898 |
my $HTMLMQAttrChecker = sub { |
my $HTMLMQAttrChecker = sub { |
| 899 |
|
my ($self, $attr) = @_; |
| 900 |
|
$self->{onerror}->(node => $attr, level => 'unsupported', |
| 901 |
|
type => 'media query'); |
| 902 |
## ISSUE: What is "a valid media query"? |
## ISSUE: What is "a valid media query"? |
| 903 |
}; # $HTMLMQAttrChecker |
}; # $HTMLMQAttrChecker |
| 904 |
|
|
| 905 |
my $HTMLEventHandlerAttrChecker = sub { |
my $HTMLEventHandlerAttrChecker = sub { |
| 906 |
|
my ($self, $attr) = @_; |
| 907 |
|
$self->{onerror}->(node => $attr, level => 'unsupported', |
| 908 |
|
type => 'event handler'); |
| 909 |
## TODO: MUST contain valid ECMAScript code matching the |
## TODO: MUST contain valid ECMAScript code matching the |
| 910 |
## ECMAScript |FunctionBody| production. [ECMA262] |
## ECMAScript |FunctionBody| production. [ECMA262] |
| 911 |
## ISSUE: MUST be ES3? E4X? ES4? JS1.x? |
## ISSUE: MUST be ES3? E4X? ES4? JS1.x? |
| 965 |
title => sub {}, ## NOTE: No conformance creteria |
title => sub {}, ## NOTE: No conformance creteria |
| 966 |
lang => sub { |
lang => sub { |
| 967 |
my ($self, $attr) = @_; |
my ($self, $attr) = @_; |
| 968 |
|
$self->{onerror}->(node => $attr, level => 'unsupported', |
| 969 |
|
type => 'language tag'); |
| 970 |
## TODO: RFC 3066 or empty test |
## TODO: RFC 3066 or empty test |
| 971 |
## ISSUE: RFC 4646 (3066bis)? |
## ISSUE: RFC 4646 (3066bis)? |
| 972 |
unless ($attr->owner_document->manakai_is_html) { |
unless ($attr->owner_document->manakai_is_html) { |
| 1332 |
checker => $HTMLEmptyChecker, |
checker => $HTMLEmptyChecker, |
| 1333 |
}; |
}; |
| 1334 |
|
|
|
## NOTE: |html:style| has no conformance creteria on content model |
|
| 1335 |
$Element->{$HTML_NS}->{style} = { |
$Element->{$HTML_NS}->{style} = { |
| 1336 |
attrs_checker => $GetHTMLAttrsChecker->({ |
attrs_checker => $GetHTMLAttrsChecker->({ |
| 1337 |
type => $HTMLIMTAttrChecker, ## TODO: MUST be a styling language |
type => $HTMLIMTAttrChecker, ## TODO: MUST be a styling language |
| 1340 |
## NOTE: |title| has special semantics for |style|s, but is syntactically |
## NOTE: |title| has special semantics for |style|s, but is syntactically |
| 1341 |
## not different |
## not different |
| 1342 |
}), |
}), |
| 1343 |
checker => $AnyChecker, |
checker => sub { |
| 1344 |
|
## NOTE: |html:style| has no conformance creteria on content model |
| 1345 |
|
my ($self, $todo) = @_; |
| 1346 |
|
my $type = $todo->{node}->get_attribute_ns (undef, 'type'); |
| 1347 |
|
$type = 'text/css' unless defined $type; |
| 1348 |
|
$self->{onerror}->(node => $todo->{node}, level => 'unsupported', |
| 1349 |
|
type => 'style:'.$type); ## TODO: $type normalization |
| 1350 |
|
return $AnyChecker->($self, $todo); |
| 1351 |
|
}, |
| 1352 |
}; |
}; |
| 1353 |
|
|
| 1354 |
$Element->{$HTML_NS}->{body} = { |
$Element->{$HTML_NS}->{body} = { |
| 2690 |
return $HTMLEmptyChecker->($self, $todo); |
return $HTMLEmptyChecker->($self, $todo); |
| 2691 |
} else { |
} else { |
| 2692 |
## NOTE: No content model conformance in HTML5 spec. |
## NOTE: No content model conformance in HTML5 spec. |
| 2693 |
|
my $type = $todo->{node}->get_attribute_ns (undef, 'type'); |
| 2694 |
|
my $language = $todo->{node}->get_attribute_ns (undef, 'language'); |
| 2695 |
|
if ((defined $type and $type eq '') or |
| 2696 |
|
(defined $language and $language eq '')) { |
| 2697 |
|
$type = 'text/javascript'; |
| 2698 |
|
} elsif (defined $type) { |
| 2699 |
|
# |
| 2700 |
|
} elsif (defined $language) { |
| 2701 |
|
$type = 'text/' . $language; |
| 2702 |
|
} else { |
| 2703 |
|
$type = 'text/javascript'; |
| 2704 |
|
} |
| 2705 |
|
$self->{onerror}->(node => $todo->{node}, level => 'unsupported', |
| 2706 |
|
type => 'script:'.$type); ## TODO: $type normalization |
| 2707 |
return $AnyChecker->($self, $todo); |
return $AnyChecker->($self, $todo); |
| 2708 |
} |
} |
| 2709 |
}, |
}, |