SPVM-Eg

 view release on metacpan or  search on metacpan

lib/SPVM/Eg/Node.spvm  view on Meta::CPAN

    
    my $node_type = $self->{node_type};
    
    my $node_name = (string)undef;
    
    switch ($node_type) {
      case &TYPE_ATTRIBUTE_NODE: {
        $node_name = $self->(Eg::Node::Attr)->name;
      }
      case &TYPE_CDATA_SECTION_NODE: {
        $node_name = "#cdata-section";
      }
      case &TYPE_COMMENT_NODE: {
        $node_name = "#comment";
      }
      case &TYPE_DOCUMENT_NODE: {
        $node_name = "#document";
      }
      case &TYPE_DOCUMENT_FRAGMENT_NODE: {
        $node_name = "#document-fragment";
      }

lib/SPVM/Eg/Node/CDATASection.pm  view on Meta::CPAN

SPVM::Eg::Node::CDATASection - CDATASection in JavaScript

=head1 Description

The Eg::Node::CDATASection class in L<SPVM> represents a CDATA section that can be used within XML to include extended portions of unescaped text.

This class is a port of L<CDATASection|https://developer.mozilla.org/en-US/docs/Web/API/CDATASection> in JavaScript.

=head1 Usage

  my $cdata_section_node = Eg->document->create_cdata_section("Some Data");

=head1 Inheritance

L<Eg::Node::CharacterData|SPVM::Eg::Node::CharacterData>

=head1 Copyright & License

Copyright (c) 2024 Yuki Kimoto

MIT License

lib/SPVM/Eg/Node/Document.pm  view on Meta::CPAN

For details, see L<Document.createTextNode|https://developer.mozilla.org/en-US/docs/Web/API/Document/createTextNode> in JavaScript.

=head2 create_comment

C<method create_comment : L<Eg::Node::Comment|SPVM::Eg::Node::Comment> ($node_value : string);>

Creates a new comment node, and returns it.

For details, see L<Document.createComment|https://developer.mozilla.org/en-US/docs/Web/API/Document/createComment> in JavaScript.

=head2 create_cdata_section

C<method create_cdata_section : L<Eg::Node::CDATASection|SPVM::Eg::Node::CDATASection> ($node_value : string);>

Creates a new CDATA section node, and returns it.

For details, see L<Document.createCDATASection|https://developer.mozilla.org/en-US/docs/Web/API/Document/createCDATASection> in JavaScript.

=head2 create_document_fragment

C<method create_document_fragment : L<Eg::Node::DocumentFragment|SPVM::Eg::Node::DocumentFragment> ();>

Creates a new empty DocumentFragment into which DOM nodes can be added to build an offscreen DOM tree.

lib/SPVM/Eg/Node/Document.spvm  view on Meta::CPAN

    
    unless ($node_value) {
      die "\$node_value must be defined.";
    }
    
    my $comment_node = Eg::Node::Comment->new({owner_document => $self, node_value => $node_value});
    
    return $comment_node;
  }
  
  method create_cdata_section : Eg::Node::CDATASection ($node_value : string) {
    
    unless ($node_value) {
      die "\$node_value must be defined.";
    }
    
    my $cdata_section_node = Eg::Node::CDATASection->new({owner_document => $self, node_value => $node_value});
    
    return $cdata_section_node;
  }
  
  method create_document_fragment : Eg::Node::DocumentFragment () {
    
    my $document_fragment_node = Eg::Node::DocumentFragment->new({owner_document => $self});
    
    return $document_fragment_node;
  }
  
  method create_attribute : Eg::Node::Attr ($name : string) {



( run in 0.654 second using v1.01-cache-2.11-cpan-454fe037f31 )