175 |
check_end => sub { |
check_end => sub { |
176 |
my ($self, $item, $element_state) = @_; |
my ($self, $item, $element_state) = @_; |
177 |
if ($element_state->{has_significant}) { |
if ($element_state->{has_significant}) { |
178 |
$item->{parent_state}->{has_significant} = 1; |
$item->{real_parent_state}->{has_significant} = 1; |
179 |
} |
} |
180 |
}, |
}, |
181 |
); |
); |
358 |
}; |
}; |
359 |
|
|
360 |
my @item = ({type => 'element', node => $el, parent_state => {}}); |
my @item = ({type => 'element', node => $el, parent_state => {}}); |
361 |
|
$item[-1]->{real_parent_state} = $item[-1]->{parent_state}; |
362 |
while (@item) { |
while (@item) { |
363 |
my $item = shift @item; |
my $item = shift @item; |
364 |
if (ref $item eq 'ARRAY') { |
if (ref $item eq 'ARRAY') { |
407 |
$child_nsuri eq $HTML_NS and $child_ln eq 'noscript')) { |
$child_nsuri eq $HTML_NS and $child_ln eq 'noscript')) { |
408 |
push @new_item, [$content_def->{check_child_element}, |
push @new_item, [$content_def->{check_child_element}, |
409 |
$self, $item, $child, |
$self, $item, $child, |
410 |
$child_nsuri, $child_ln, 1, $content_state]; |
$child_nsuri, $child_ln, 1, |
411 |
|
$content_state, $element_state]; |
412 |
push @new_item, {type => 'element', node => $child, |
push @new_item, {type => 'element', node => $child, |
413 |
parent_state => $content_state, |
parent_state => $content_state, |
414 |
parent_def => $content_def, |
parent_def => $content_def, |
415 |
|
real_parent_state => $element_state, |
416 |
transparent => 1}; |
transparent => 1}; |
417 |
} else { |
} else { |
418 |
if ($item->{parent_def} and # has parent |
if ($item->{parent_def} and # has parent |
443 |
$child_nsuri, $child_ln, |
$child_nsuri, $child_ln, |
444 |
$HTMLSemiTransparentElements |
$HTMLSemiTransparentElements |
445 |
->{$child_nsuri}->{$child_ln}, |
->{$child_nsuri}->{$child_ln}, |
446 |
$content_state]; |
$content_state, $element_state]; |
447 |
push @new_item, {type => 'element', node => $child, |
push @new_item, {type => 'element', node => $child, |
448 |
parent_def => $content_def, |
parent_def => $content_def, |
449 |
|
real_parent_state => $element_state, |
450 |
parent_state => $content_state}; |
parent_state => $content_state}; |
451 |
} |
} |
452 |
|
|
458 |
my $has_significant = ($child->data =~ /[^\x09-\x0D\x20]/); |
my $has_significant = ($child->data =~ /[^\x09-\x0D\x20]/); |
459 |
push @new_item, [$content_def->{check_child_text}, |
push @new_item, [$content_def->{check_child_text}, |
460 |
$self, $item, $child, $has_significant, |
$self, $item, $child, $has_significant, |
461 |
$content_state]; |
$content_state, $element_state]; |
462 |
$content_state->{has_significant} ||= $has_significant; |
$element_state->{has_significant} ||= $has_significant; |
463 |
if ($has_significant and |
if ($has_significant and |
464 |
$HTMLSemiTransparentElements->{$el_nsuri}->{$el_ln}) { |
$HTMLSemiTransparentElements->{$el_nsuri}->{$el_ln}) { |
465 |
$content_def = $item->{parent_def} || $content_def; |
$content_def = $item->{parent_def} || $content_def; |