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

Diff of /messaging/manakai/lib/Message/DOM/Document.pm

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

revision 1.25 by wakaba, Sun Nov 18 11:08:41 2007 UTC revision 1.30 by wakaba, Sat Apr 12 15:58:41 2008 UTC
# Line 1  Line 1 
 ## NOTE: This module will be renamed as Document.pm.  
   
1  package Message::DOM::Document;  package Message::DOM::Document;
2  use strict;  use strict;
3  our $VERSION=do{my @r=(q$Revision$=~/\d+/g);sprintf "%d."."%02d" x $#r,@r};  our $VERSION=do{my @r=(q$Revision$=~/\d+/g);sprintf "%d."."%02d" x $#r,@r};
# Line 39  sub AUTOLOAD { Line 37  sub AUTOLOAD {
37    
38    if ({    if ({
39      ## Read-only attributes (trivial accessors)      ## Read-only attributes (trivial accessors)
40        default_view => 1,
41      implementation => 1,      implementation => 1,
42    }->{$method_name}) {    }->{$method_name}) {
43      no strict 'refs';      no strict 'refs';
# Line 123  sub AUTOLOAD { Line 122  sub AUTOLOAD {
122      create_tree_walker => 'Message::DOM::TreeWalker',      create_tree_walker => 'Message::DOM::TreeWalker',
123      query_selector => 'Message::DOM::SelectorsAPI',      query_selector => 'Message::DOM::SelectorsAPI',
124      query_selector_all => 'Message::DOM::SelectorsAPI',      query_selector_all => 'Message::DOM::SelectorsAPI',
125        ___query_selector_all => 'Message::DOM::SelectorsAPI',
126    }->{$method_name}) {    }->{$method_name}) {
127      eval qq{ require $module_name } or die $@;      eval qq{ require $module_name } or die $@;
128      goto &{ $AUTOLOAD };      goto &{ $AUTOLOAD };
# Line 216  sub adopt_node ($$) { Line 216  sub adopt_node ($$) {
216          -object => $self,          -object => $self,
217          -type => 'NOT_SUPPORTED_ERR',          -type => 'NOT_SUPPORTED_ERR',
218          -subtype => 'ADOPT_NODE_TYPE_NOT_SUPPORTED_ERR';          -subtype => 'ADOPT_NODE_TYPE_NOT_SUPPORTED_ERR';
     ## ISSUE: Define ELEMENT_TYPE_DEFINITION_NODE and ATTRIBUTE_DEFINITION_NODE  
219    }    }
220    
221    my @change_od;    my @change_od;
# Line 1084  sub manakai_create_serial_walker ($$;$$$ Line 1083  sub manakai_create_serial_walker ($$;$$$
1083    
1084  sub create_tree_walker ($$;$$$);  sub create_tree_walker ($$;$$$);
1085    
1086    ## |DocumentView| attribute
1087    
1088    sub default_view ($);
1089    
1090  ## |HTMLDocument| attributes  ## |HTMLDocument| attributes
1091    
1092  sub compat_mode ($) {  sub compat_mode ($) {
# Line 1108  sub manakai_compat_mode ($;$) { Line 1111  sub manakai_compat_mode ($;$) {
1111    }    }
1112  } # manakai_compat_mode  } # manakai_compat_mode
1113    
1114    ## TODO: documentation
1115    sub manakai_head ($) {
1116      local $Error::Depth = $Error::Depth + 1;
1117      my $html = $_[0]->manakai_html;
1118      return undef unless defined $html;
1119      for my $el (@{$html->child_nodes}) {
1120        next unless $el->node_type == 1; # ELEMENT_NODE
1121        my $nsuri = $el->namespace_uri;
1122        next unless defined $nsuri;
1123        next unless $nsuri eq q<http://www.w3.org/1999/xhtml>;
1124        next unless $el->manakai_local_name eq 'head';
1125        return $el;
1126      }
1127      return undef;
1128    } # manakai_head
1129    
1130    ## TODO: documentation
1131    sub manakai_html ($) {
1132      local $Error::Depth = $Error::Depth + 1;
1133      my $de = $_[0]->document_element;
1134      my $nsuri = $de->namespace_uri;
1135      if (defined $nsuri and $nsuri eq q<http://www.w3.org/1999/xhtml> and
1136          $de->manakai_local_name eq 'html') {
1137        return $de;
1138      } else {
1139        return undef;
1140      }
1141    } # manakai_html
1142    
1143  sub inner_html ($;$) {  sub inner_html ($;$) {
1144    my $self = $_[0];    my $self = $_[0];
1145    local $Error::Depth = $Error::Depth + 1;    local $Error::Depth = $Error::Depth + 1;
# Line 1171  sub inner_html ($;$) { Line 1203  sub inner_html ($;$) {
1203      ## TODO: This serializer is currently not conformant to HTML5 spec.      ## TODO: This serializer is currently not conformant to HTML5 spec.
1204      require Whatpm::XMLSerializer;      require Whatpm::XMLSerializer;
1205      my $r = '';      my $r = '';
1206      for (@{$self->child_nodes}) {      for my $node (@{$self->child_nodes}) {
1207        $r .= ${ Whatpm::XMLSerializer->get_outer_xml ($_, sub {        $r .= ${ Whatpm::XMLSerializer->get_outer_xml ($node, sub {
1208          ## TODO: INVALID_STATE_ERR          ## TODO: INVALID_STATE_ERR
1209        }) };        }) };
1210      }      }

Legend:
Removed from v.1.25  
changed lines
  Added in v.1.30

[email protected]
ViewVC Help
Powered by ViewVC 1.1.24