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

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

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

revision 1.1 by wakaba, Mon Apr 30 14:12:02 2007 UTC revision 1.2 by wakaba, Tue May 1 06:22:12 2007 UTC
# Line 63  sub insert_before ($$;$) { Line 63  sub insert_before ($$;$) {
63    return $new_child;    return $new_child;
64  } # insert_before  } # insert_before
65    
66    ## NOTE: Only applied to Elements and Documents
67  sub remove_child ($$) {  sub remove_child ($$) {
68    my ($self, $old_child) = @_;    my ($self, $old_child) = @_;
69    my $parent_list = $self->{child_nodes};    my $parent_list = $self->{child_nodes};
# Line 80  sub has_child_nodes ($) { Line 81  sub has_child_nodes ($) {
81    return @{shift->{child_nodes}} > 0;    return @{shift->{child_nodes}} > 0;
82  } # has_child_nodes  } # has_child_nodes
83    
84    ## NOTE: Only applied to Elements and Documents
85    sub last_child ($) {
86      my $self = shift;
87      return @{$self->{child_nodes}} ? $self->{child_nodes}->[-1] : undef;
88    } # last_child
89    
90    ## NOTE: Only applied to Elements and Documents
91    sub previous_sibling ($) {
92      my $self = shift;
93      my $parent = $self->{parent_node};
94      return undef unless defined $parent;
95      my $r;
96      for (@{$parent->{child_nodes}}) {
97        if ($_ eq $self) {
98          return $r;
99        } else {
100          $r = $_;
101        }
102      }
103      return undef;
104    } # previous_sibling
105    
106  sub ELEMENT_NODE () { 1 }  sub ELEMENT_NODE () { 1 }
107  sub ATTRIBUTE_NODE () { 2 }  sub ATTRIBUTE_NODE () { 2 }
108  sub TEXT_NODE () { 3 }  sub TEXT_NODE () { 3 }
# Line 166  sub clone_node ($$) { Line 189  sub clone_node ($$) {
189    }, ref $self;    }, ref $self;
190    for my $ns (keys %{$self->{attributes}}) {    for my $ns (keys %{$self->{attributes}}) {
191      for my $ln (keys %{$self->{attributes}->{$ns}}) {      for my $ln (keys %{$self->{attributes}->{$ns}}) {
192          my $attr = $self->{attributes}->{$ns}->{$ln};
193        $clone->{attributes}->{$ns}->{$ln} = bless {        $clone->{attributes}->{$ns}->{$ln} = bless {
194          prefix => $self->{attributes}->{$ns}->{$ln}->{prefix},          namespace_uri => $attr->{namespace_uri},
195          value => $self->{attributes}->{$ns}->{$ln}->{value},          prefix => $attr->{prefix},
196            local_name => $attr->{local_name},
197            value => $attr->{value},
198        }, ref $self->{attributes}->{$ns}->{$ln};        }, ref $self->{attributes}->{$ns}->{$ln};
199      }      }
200    }    }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24