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