Class: Makiri::ProcessingInstruction

Inherits:
Node
  • Object
show all
Defined in:
lib/makiri/processing_instruction.rb,
ext/makiri/makiri.c

Overview

An XML/HTML processing-instruction node. Rare in HTML5 (the parser usually treats “<?…>” as a bogus comment), present mainly for completeness.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#add_class, #append_class, #at, #attribute, #attribute?, #attributes, #blank?, #cdata?, #classes, #clone, #comment?, #document?, #document_fragment?, #dup, #each, #element?, #inspect, #path, #processing_instruction?, #remove_class, #root, #search, #set_attribute, #text?, #to_h, #traverse

Class Method Details

.new(document, target, content) ⇒ Makiri::ProcessingInstruction

Create a detached processing instruction owned by document (Nokogiri-style, document first). Delegates to Document#create_processing_instruction.

Parameters:

Returns:



14
15
16
# File 'lib/makiri/processing_instruction.rb', line 14

def self.new(document, target, content)
  Makiri::Document.coerce!(document).create_processing_instruction(target, content)
end

Instance Method Details

#targetObject

DOM ‘ProcessingInstruction#target` — the PI’s target name. Defined once on the shared base so both backends expose it: the XML node reaches it here (its target IS its node name), while the HTML node overrides it with a native implementation earlier in the ancestor chain.



22
23
24
# File 'lib/makiri/processing_instruction.rb', line 22

def target
  name
end