Class: Dommy::ProcessingInstructionNode

Inherits:
CharacterDataNode show all
Defined in:
lib/dommy/element.rb

Overview

ProcessingInstruction (<?target data?>, nodeType 7) — CharacterData with a target. Backed by a real backend node (created via document.createProcessingInstruction), so it participates in the tree like Text/Comment: insertion, ChildNode methods, identity caching and serialization all come from the shared CharacterDataNode machinery.

Constant Summary

Constants included from Node

Node::ATTRIBUTE_NODE, Node::CDATA_SECTION_NODE, Node::COMMENT_NODE, Node::DOCUMENT_FRAGMENT_NODE, Node::DOCUMENT_NODE, Node::DOCUMENT_POSITION_CONTAINED_BY, Node::DOCUMENT_POSITION_CONTAINS, Node::DOCUMENT_POSITION_DISCONNECTED, Node::DOCUMENT_POSITION_FOLLOWING, Node::DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, Node::DOCUMENT_POSITION_PRECEDING, Node::DOCUMENT_TYPE_NODE, Node::ELEMENT_NODE, Node::HTML_NAMESPACE, Node::PROCESSING_INSTRUCTION_NODE, Node::TEXT_NODE, Node::XMLNS_NAMESPACE, Node::XML_NAMESPACE

Instance Attribute Summary

Attributes inherited from CharacterDataNode

#document

Instance Method Summary collapse

Methods inherited from CharacterDataNode

#[], #[]=, #__dommy_backend_node__, #__internal_event_parent__, #__js_set__, #after, #append_data, #assigned_slot, #before, #data, #data=, #delete_data, #dom_string, #initialize, #insert_data, #length, #next_sibling, #node_value, #node_value=, #parent_element, #parent_node, #previous_sibling, #remove, #replace_data, #replace_with, #split_text, #substring_data, #text_content, #text_content=, #to_uint32, #utf16_length, #utf16_slice

Methods included from Bridge::Methods

included

Methods included from Internal::ChildNode

#child_node_after, #child_node_before, #child_node_replace_with, #nullable_dom_string, #validate_insert_before_ref!

Methods included from EventTarget

#__dommy_dump_event_failure__, #__internal_deliver_event__, #__internal_event_parent__, #__internal_process_event_handler_return__, #add_event_listener, capture_flag, #deliver_at, #dispatch_event, #event_name_from_on, #invoke_listener_isolated, js_truthy?, #on_handler, #remove_event_listener, #set_on_handler

Methods included from Node

#compare_document_position, #get_root_node, #is_default_namespace, #is_equal_node, #is_same_node, #lookup_namespace_uri, #lookup_prefix

Constructor Details

This class inherits a constructor from Dommy::CharacterDataNode

Instance Method Details

#__js_call__(method, args) ⇒ Object



739
740
741
742
743
744
745
746
# File 'lib/dommy/element.rb', line 739

def __js_call__(method, args)
  case method
  when "cloneNode"
    @document.create_processing_instruction(@__node__.target, @__node__.content)
  else
    super
  end
end

#__js_get__(key) ⇒ Object



728
729
730
731
732
733
734
735
# File 'lib/dommy/element.rb', line 728

def __js_get__(key)
  case key
  when "target"
    @__node__.target
  else
    super
  end
end

#node_nameObject

WHATWG: a ProcessingInstruction's nodeName is its target.



720
721
722
# File 'lib/dommy/element.rb', line 720

def node_name
  @__node__.target
end

#node_typeObject



715
716
717
# File 'lib/dommy/element.rb', line 715

def node_type
  7
end

#targetObject



724
725
726
# File 'lib/dommy/element.rb', line 724

def target
  @__node__.target
end