Parent Directory
|
Revision Log
++ manakai/t/ChangeLog 15 Jun 2007 14:31:27 -0000 2007-06-15 Wakaba <wakaba@suika.fam.cx> * DOM-Node.t: New test. 2007-06-15 Wakaba <wakaba@suika.fam.cx> * DOM-Document.t: New test. ++ manakai/lib/Message/DOM/ChangeLog 15 Jun 2007 14:32:37 -0000 2007-06-15 Wakaba <wakaba@suika.fam.cx> * ProcessingInstruction.pm, EntityReference.pm, CDATASection, DocumentFragment.pm, DOMDocument.pm, Entity.pm, ElementTypeDefinition.pm, AttributeDefinition.pm, DocumentType.pm, DOMElement.pm, Attr.pm, CharacterData.pm, Text.pm, Comment.pm (node_name, node_value, node_type): Implemented.
| 1 | package Message::DOM::DocumentFragment; |
| 2 | use strict; |
| 3 | our $VERSION=do{my @r=(q$Revision: 1.1 $=~/\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 | return $self; |
| 13 | } # ____new |
| 14 | |
| 15 | sub AUTOLOAD { |
| 16 | my $method_name = our $AUTOLOAD; |
| 17 | $method_name =~ s/.*:://; |
| 18 | return if $method_name eq 'DESTROY'; |
| 19 | |
| 20 | if ({ |
| 21 | ## Read-only attributes (trivial accessors) |
| 22 | }->{$method_name}) { |
| 23 | no strict 'refs'; |
| 24 | eval qq{ |
| 25 | sub $method_name (\$) { |
| 26 | if (\@_ > 1) { |
| 27 | require Carp; |
| 28 | Carp::croak (qq<Can't modify read-only attribute>); |
| 29 | } |
| 30 | return \${\$_[0]}->{$method_name}; |
| 31 | } |
| 32 | }; |
| 33 | goto &{ $AUTOLOAD }; |
| 34 | } elsif ({ |
| 35 | ## Read-write attributes (DOMString, trivial accessors) |
| 36 | }->{$method_name}) { |
| 37 | no strict 'refs'; |
| 38 | eval qq{ |
| 39 | sub $method_name (\$) { |
| 40 | if (\@_ > 1) { |
| 41 | \${\$_[0]}->{$method_name} = ''.$_[1]; |
| 42 | } |
| 43 | return \${\$_[0]}->{$method_name}; |
| 44 | } |
| 45 | }; |
| 46 | goto &{ $AUTOLOAD }; |
| 47 | } else { |
| 48 | require Carp; |
| 49 | Carp::croak (qq<Can't locate method "$AUTOLOAD">); |
| 50 | } |
| 51 | } # AUTOLOAD |
| 52 | |
| 53 | ## The |Node| interface - attribute |
| 54 | |
| 55 | ## Spec: |
| 56 | ## <http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-F68D095> |
| 57 | ## <http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-1950641247> |
| 58 | |
| 59 | sub node_name ($) { |
| 60 | return '#document-fragment'; |
| 61 | } # node_name |
| 62 | |
| 63 | ## Spec: |
| 64 | ## <http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-111237558> |
| 65 | |
| 66 | sub node_type ($) { 11 } # DOCUMENT_FRAGMENT_NODE |
| 67 | |
| 68 | package Message::IF::DocumentFragment; |
| 69 | |
| 70 | package Message::DOM::Document; |
| 71 | |
| 72 | ## Spec: |
| 73 | ## <http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-35CB04B5> |
| 74 | |
| 75 | sub create_document_fragment ($) { |
| 76 | return Message::DOM::DocumentFragment->____new ($_[0]); |
| 77 | } # create_document_fragment |
| 78 | |
| 79 | 1; |
| 80 | ## License: <http://suika.fam.cx/~wakaba/archive/2004/8/18/license#Perl+MPL> |
| 81 | ## $Date: 2007/06/14 13:10:07 $ |
| [email protected] | ViewVC Help |
| Powered by ViewVC 1.1.24 |