Mercurial > pub > Impl
diff Lib/IMPL/DOM/Node.pm @ 122:a7efb3117295
Fixed bug in IMPL::DOM::Navigator::selectNodes
Fixed bug in IMPL::DOM::Node::selectNodes
renamed operator 'type' to 'typeof' in IMPL::Object::Abstract
A proper implementation of the IMPL::DOM::Node::nodeProperty and a related changes in the IMPL::DOM::Property module, now the last is very simple.
author | wizard |
---|---|
date | Tue, 08 Jun 2010 20:12:45 +0400 |
parents | 1722ca51537c |
children | e30bdd040fe3 |
line wrap: on
line diff
--- a/Lib/IMPL/DOM/Node.pm Tue Jun 08 03:38:10 2010 +0400 +++ b/Lib/IMPL/DOM/Node.pm Tue Jun 08 20:12:45 2010 +0400 @@ -191,13 +191,18 @@ sub selectNodes { my $this = shift; - my ($path) = @_; + my $path; - $path = ref $path eq 'ARRAY' ? $path : ( @_ == 1 ? $this->translatePath($path) : [@_]); + if (@_ == 1) { + $path = $this->translatePath($_[0]); + } else { + $path = [@_]; + } my @set = ($this); - while (my $query = shift @$path) { + while (@$path) { + my $query = shift @$path; @set = map $_->selectNodesAxis($query), @set; } @@ -341,14 +346,26 @@ my $this = shift; my $name = shift; + if (my $method = $this->can($name)) { + return &$method($this,@_); + } + if (@_) { - # set - return $this->{$_propertyMap}{$name} = shift; - } else { - return $this->{$_propertyMap}{$name}; + # set + return $this->{$_propertyMap}{$name} = shift; + } else { + return $this->{$_propertyMap}{$name}; } } +sub listProperties { + my ($this) = @_; + + my %props = map {$_->Name, 1} $this->get_meta(typeof IMPL::Class::PropertyInfo, sub { $_->Attributes->{domProperty}},1); + + return (keys %props,keys %{$this->{$_propertyMap}}); +} + sub qname { $_[0]->{$nodeName}; }