209 |
## and not in |head|. |
## and not in |head|. |
210 |
}; |
}; |
211 |
|
|
212 |
## Semi-transparent: html:video, html:audio, html:object |
my $HTMLSemiTransparentElements = { |
213 |
|
$HTML_NS => {object => 1, video => 1, audio => 1}, |
214 |
|
}; |
215 |
|
|
216 |
our $Element = {}; |
our $Element = {}; |
217 |
|
|
338 |
$self->{good_level} = 'w'; |
$self->{good_level} = 'w'; |
339 |
$self->{unsupported_lavel} = 'u'; |
$self->{unsupported_lavel} = 'u'; |
340 |
|
|
341 |
$self->{pluses} = {}; |
$self->{plus_elements} = {}; |
342 |
$self->{minuses} = {}; |
$self->{minus_elements} = {}; |
343 |
$self->{id} = {}; |
$self->{id} = {}; |
344 |
$self->{term} = {}; |
$self->{term} = {}; |
345 |
$self->{usemap} = []; |
$self->{usemap} = []; |
379 |
my $eldef = $Element->{$el_nsuri}->{$el_ln} || |
my $eldef = $Element->{$el_nsuri}->{$el_ln} || |
380 |
$Element->{$el_nsuri}->{''} || |
$Element->{$el_nsuri}->{''} || |
381 |
$ElementDefault; |
$ElementDefault; |
382 |
my $content_def = $item->{parent_def} || $eldef; |
my $content_def = $item->{transparent} |
383 |
|
? $item->{parent_def} || $eldef : $eldef; |
384 |
|
|
385 |
my $element_state = {}; |
my $element_state = {}; |
386 |
my @new_item; |
my @new_item; |
387 |
push @new_item, [$eldef->{check_start}, $self, $item, $element_state]; |
push @new_item, [$eldef->{check_start}, $self, $item, $element_state]; |
388 |
push @new_item, [$eldef->{check_attrs}, $self, $item, $element_state]; |
push @new_item, [$eldef->{check_attrs}, $self, $item, $element_state]; |
389 |
|
|
390 |
my @child = @{$item->{node}->child_nodes}; |
my @child = @{$item->{node}->child_nodes}; |
391 |
while (@child) { |
while (@child) { |
392 |
my $child = shift @child; |
my $child = shift @child; |
397 |
my $child_ln = $child->manakai_local_name; |
my $child_ln = $child->manakai_local_name; |
398 |
if ($HTMLTransparentElements->{$child_nsuri}->{$child_ln} and |
if ($HTMLTransparentElements->{$child_nsuri}->{$child_ln} and |
399 |
not (($self->{flag}->{in_head} or |
not (($self->{flag}->{in_head} or |
400 |
($el_nsuri eq q<http://www.w3.org/1999/xhtml> and |
($el_nsuri eq $HTML_NS and $el_ln eq 'head')) and |
401 |
$el_ln eq 'head')) and |
$child_nsuri eq $HTML_NS and $child_ln eq 'noscript')) { |
|
$child_nsuri eq q<http://www.w3.org/1999/xhtml> and |
|
|
$child_ln eq 'noscript')) { |
|
402 |
push @new_item, [$content_def->{check_child_element}, |
push @new_item, [$content_def->{check_child_element}, |
403 |
$self, $item, $child, |
$self, $item, $child, |
404 |
$child_nsuri, $child_ln, 1, $element_state]; |
$child_nsuri, $child_ln, 1, $element_state]; |
405 |
push @new_item, {type => 'element', node => $child, |
push @new_item, {type => 'element', node => $child, |
406 |
parent_state => $element_state, |
parent_state => $element_state, |
407 |
parent_def => $item->{parent_def} || $eldef, |
parent_def => $content_def, |
408 |
transparent => 1}; |
transparent => 1}; |
409 |
} else { |
} else { |
410 |
|
if ($content_def eq $eldef and |
411 |
|
$item->{parent_def} and |
412 |
|
$el_nsuri eq $HTML_NS) { ## $HTMLSemiTransparentElements |
413 |
|
if ($el_ln eq 'object') { |
414 |
|
if ($self->{plus_elements}->{$child_nsuri}->{$child_ln}) { |
415 |
|
# |
416 |
|
} elsif ($child_nsuri eq $HTML_NS and $child_ln eq 'param') { |
417 |
|
# |
418 |
|
} else { |
419 |
|
$content_def = $item->{parent_def}; |
420 |
|
} |
421 |
|
} |
422 |
|
} |
423 |
|
|
424 |
push @new_item, [$content_def->{check_child_element}, |
push @new_item, [$content_def->{check_child_element}, |
425 |
$self, $item, $child, |
$self, $item, $child, |
426 |
$child_nsuri, $child_ln, 0, $element_state]; |
$child_nsuri, $child_ln, 0, $element_state]; |
427 |
push @new_item, {type => 'element', node => $child, |
push @new_item, {type => 'element', node => $child, |
428 |
|
parent_def => $eldef, |
429 |
parent_state => $element_state}; |
parent_state => $element_state}; |
430 |
} |
} |
431 |
|
|
439 |
$self, $item, $child, $has_significant, |
$self, $item, $child, $has_significant, |
440 |
$element_state]; |
$element_state]; |
441 |
$element_state->{has_significant} ||= $has_significant; |
$element_state->{has_significant} ||= $has_significant; |
442 |
|
if ($has_significant and |
443 |
|
$HTMLSemiTransparentElements->{$el_nsuri}->{$el_ln}) { |
444 |
|
$content_def = $item->{parent_def} || $content_def; |
445 |
|
} |
446 |
} elsif ($child_nt == 5) { # ENTITY_REFERENCE_NODE |
} elsif ($child_nt == 5) { # ENTITY_REFERENCE_NODE |
447 |
push @child, @{$child->child_nodes}; |
push @child, @{$child->child_nodes}; |
448 |
} |
} |
470 |
} |
} |
471 |
} |
} |
472 |
|
|
473 |
delete $self->{pluses}; |
delete $self->{plus_elements}; |
474 |
delete $self->{minuses}; |
delete $self->{minus_elements}; |
475 |
delete $self->{onerror}; |
delete $self->{onerror}; |
476 |
delete $self->{id}; |
delete $self->{id}; |
477 |
delete $self->{usemap}; |
delete $self->{usemap}; |