class Nokogiri::HTML5::DocumentFragment
def parse(
Node, or a hypothetical tag named as specified, is the parent of the fragment subtree.
If a context node is specified using +context:+, then the parser will behave as if that
=== Context \Node
[Returns] Nokogiri::HTML5::DocumentFragment
See rdoc-ref:HTML5@Parsing+options for a complete description of these parsing options.
elements as text. (default +false+)
- +parse_noscript_content_as_text:+ (Boolean) Whether to parse the content of +noscript+
element. (default +Nokogiri::Gumbo::DEFAULT_MAX_ATTRIBUTES+)
- +max_attributes:+ (Integer) The maximum number of attributes allowed on an
+Nokogiri::Gumbo::DEFAULT_MAX_TREE_DEPTH+)
- +max_tree_depth:+ (Integer) The maximum depth of the parse tree. (default
+Nokogiri::Gumbo::DEFAULT_MAX_ERRORS+ which is currently 0)
- +max_errors:+ (Integer) The maximum number of parse errors to record. (default
information. (default +"body"+)
context" of which to parse the document fragment. See below for more
- +context:+ (String | Nokogiri::XML::Node) The node, or the name of an HTML5 element, "in
encoding is handled by the parser.
based on the document content. Also see Nokogiri::HTML5 for a longer explanation of how
used when processing the document. When not provided, the encoding will be determined
- +encoding:+ (String | Encoding) The encoding, or name of the encoding, that should be
[Optional Keyword Arguments]
- +input+ (String | IO) The HTML5 document fragment to parse.
[Parameters]
method creates a new, empty HTML5::Document to contain the fragment.
Parse \HTML5 fragment input from a String, and return a new HTML5::DocumentFragment. This
parse(input, **options) → HTML5::DocumentFragment
:call-seq:
def parse( input, encoding_ = nil, positional_options_hash = nil, encoding: encoding_, **options ) unless positional_options_hash.nil? || positional_options_hash.empty? options.merge!(positional_options_hash) end context = options.delete(:context) document = HTML5::Document.new document.encoding = "UTF-8" input = HTML5.read_and_encode(input, encoding) new(document, input, context, options) end