/[suikacvs]/messaging/manakai/lib/Message/DOM/AttributeDefinition.pm
Suika

Contents of /messaging/manakai/lib/Message/DOM/AttributeDefinition.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (hide annotations) (download)
Sat Jun 16 08:05:48 2007 UTC (17 years, 5 months ago) by wakaba
Branch: MAIN
Changes since 1.2: +3 -2 lines
++ manakai/t/ChangeLog	16 Jun 2007 08:01:18 -0000
	* DOM-NodeList.t: New test.

2007-06-16  Wakaba  <wakaba@suika.fam.cx>

++ manakai/lib/Message/DOM/ChangeLog	16 Jun 2007 08:05:30 -0000
	* Attr.pm, AttributeDefinition.pm, DocumentFragment.pm,
	DocumentType.pm, Entity.pm,
	EntityReference.pm (____new): Initialize |child_nodes| by an empty list.

	* Node.pm, DOMCharacterData.pm, ElementTypeDefinition.pm,
	Notation.pm, ProcessingInstruction.pm (child_nodes): Implemetned.

	* DOMDocument.pm (AUTOLOAD): Typo fixed.

	* Node.pm (==, !=): Implemented.
	(manakai_read_only): Implemented.
	(is_same_node): Implemented.
	(is_equal_node): Alpha version.
	(manakai_set_read_only): Alpha version.
	(child_nodes, first_child, last_child, previous_sibling): Duplicate
	definitions are removed.

2007-06-16  Wakaba  <wakaba@suika.fam.cx>

1 wakaba 1.1 package Message::DOM::AttributeDefinition;
2     use strict;
3 wakaba 1.3 our $VERSION=do{my @r=(q$Revision: 1.2 $=~/\d+/g);sprintf "%d."."%02d" x $#r,@r};
4 wakaba 1.1 push our @ISA, 'Message::DOM::Node', 'Message::IF::AttributeDefinition';
5     require Message::DOM::Node;
6    
7     ## Spec:
8     ## <http://suika.fam.cx/gate/2005/sw/AttributeDefinition>
9    
10     sub ____new ($$$) {
11     my $self = shift->SUPER::____new (shift);
12     $$self->{node_name} = $_[0];
13 wakaba 1.3 $$self->{child_nodes} = [];
14 wakaba 1.1 return $self;
15     } # ____new
16    
17     sub AUTOLOAD {
18     my $method_name = our $AUTOLOAD;
19     $method_name =~ s/.*:://;
20     return if $method_name eq 'DESTROY';
21    
22     if ({
23     ## Read-only attributes (trivial accessors)
24 wakaba 1.2 node_name => 1,
25 wakaba 1.1 }->{$method_name}) {
26     no strict 'refs';
27     eval qq{
28     sub $method_name (\$) {
29     if (\@_ > 1) {
30     require Carp;
31     Carp::croak (qq<Can't modify read-only attribute>);
32     }
33     return \${\$_[0]}->{$method_name};
34     }
35     };
36     goto &{ $AUTOLOAD };
37     } elsif ({
38     ## Read-write attributes (DOMString, trivial accessors)
39     }->{$method_name}) {
40     no strict 'refs';
41     eval qq{
42     sub $method_name (\$) {
43     if (\@_ > 1) {
44     \${\$_[0]}->{$method_name} = ''.$_[1];
45     }
46     return \${\$_[0]}->{$method_name};
47     }
48     };
49     goto &{ $AUTOLOAD };
50     } else {
51     require Carp;
52     Carp::croak (qq<Can't locate method "$AUTOLOAD">);
53     }
54     } # AUTOLOAD
55    
56     ## The |Node| interface - attribute
57    
58 wakaba 1.2 ## Spec:
59     ## <http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-F68D095>
60     ## <http://suika.fam.cx/gate/2005/sw/AttributeDefinition>
61    
62     sub node_name ($); # read-only trivial accessor
63    
64     ## Spec:
65     ## <http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-111237558>
66    
67     sub node_type ($) { 81002 } # ATTRIBUTE_DEFINITION_NODE
68    
69     ## Spec:
70     ## <http://suika.fam.cx/gate/2005/sw/AttributeDefinition#anchor-2>
71    
72     ## TODO: node_value
73 wakaba 1.1
74     package Message::IF::AttributeDefinition;
75    
76     package Message::DOM::Document;
77    
78     ## Spec:
79     ## <http://suika.fam.cx/gate/2005/sw/DocumentXDoctype>
80    
81 wakaba 1.2 sub create_attribute_definition ($$) {
82 wakaba 1.1 return Message::DOM::AttributeDefinition->____new (@_[0, 1]);
83     } # create_attribute_definition
84    
85     1;
86     ## License: <http://suika.fam.cx/~wakaba/archive/2004/8/18/license#Perl+MPL>
87 wakaba 1.3 ## $Date: 2007/06/15 14:32:50 $

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24