/[suikacvs]/markup/html/whatpm/Whatpm/NanoDOM.pm
Suika

Diff of /markup/html/whatpm/Whatpm/NanoDOM.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by wakaba, Wed May 2 13:44:34 2007 UTC revision 1.4 by wakaba, Fri May 4 09:16:04 2007 UTC
# Line 39  sub parent_node ($) { Line 39  sub parent_node ($) {
39    return shift->{parent_node};    return shift->{parent_node};
40  } # parent_node  } # parent_node
41    
42    sub manakai_parent_element ($) {
43      my $self = shift;
44      my $parent = $self->{parent_node};
45      while (defined $parent) {
46        if ($parent->node_type == 1) {
47          return $parent;
48        } else {
49          $parent = $parent->{parent_node};
50        }
51      }
52      return undef;
53    } # manakai_parent_element
54    
55  ## NOTE: Only applied to Elements and Documents  ## NOTE: Only applied to Elements and Documents
56  sub child_nodes ($) {  sub child_nodes ($) {
57    return shift->{child_nodes};    return shift->{child_nodes};
# Line 193  sub implementation ($) { Line 206  sub implementation ($) {
206    return 'Whatpm::NanoDOM::DOMImplementation';    return 'Whatpm::NanoDOM::DOMImplementation';
207  } # implementation  } # implementation
208    
209    sub document_element ($) {
210      my $self = shift;
211      for (@{$self->child_nodes}) {
212        if ($_->node_type == 1) {
213          return $_;
214        }
215      }
216      return undef;
217    } # document_element
218    
219  package Whatpm::NanoDOM::Element;  package Whatpm::NanoDOM::Element;
220  push our @ISA, 'Whatpm::NanoDOM::Node';  push our @ISA, 'Whatpm::NanoDOM::Node';
221    
# Line 263  sub local_name ($) { # TODO: HTML5 case Line 286  sub local_name ($) { # TODO: HTML5 case
286    return shift->{local_name};    return shift->{local_name};
287  } # local_name  } # local_name
288    
289    sub manakai_local_name ($) {
290      return shift->{local_name}; # no case fixing for HTML5
291    } # manakai_local_name
292    
293  sub namespace_uri ($) {  sub namespace_uri ($) {
294    return shift->{namespace_uri};    return shift->{namespace_uri};
295  } # namespace_uri  } # namespace_uri
296    
297    sub manakai_element_type_match ($$$) {
298      my ($self, $nsuri, $ln) = @_;
299      if (defined $nsuri) {
300        if (defined $self->{namespace_uri} and $nsuri eq $self->{namespace_uri}) {
301          return ($ln eq $self->{local_name});
302        } else {
303          return 0;
304        }
305      } else {
306        if (not defined $self->{namespace_uri}) {
307          return ($ln eq $self->{local_name});
308        } else {
309          return 0;
310        }
311      }
312    } # manakai_element_type_match
313    
314  sub node_type { 1 }  sub node_type { 1 }
315    
316  ## TODO: HTML5 capitalization  ## TODO: HTML5 capitalization

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24