Nokogiri

The Nokogiri filter allows the web DOM API to behave much like the API of the Nokogiri gem.

List of Transformations

  • add_child appendChild
  • add_next_sibling node.parentNode.insertBefore(sibling, node.nextSibling)
  • add_previous_sibling node.parentNode.insertBefore(sibling, node)
  • after node.parentNode.insertBefore(sibling, node.nextSibling)
  • at querySelector
  • attr getAttribute
  • attribute getAttributeNode
  • before node.parentNode.insertBefore(sibling, node)
  • cdata? node.nodeType === Node.CDATA_SECTION_NODE
  • children childNodes
  • comment? node.nodeType === Node.COMMENT_NODE
  • content textContent
  • create_element createElement
  • document ownerDocument
  • element? node.nodeType === Node.ELEMENT_NODE
  • fragment? node.nodeType === Node.FRAGMENT_NODE
  • get_attribute getAttribute
  • has_attribute hasAttribute
  • inner_html innerHTML
  • key? hasAttribute
  • name nextSibling
  • next nodeName
  • next= node.parentNode.insertBefore(sibling,node.nextSibling)
  • next_element nextElement
  • next_sibling nextSibling
  • Nokogiri::HTML5 new JSDOM().window.document
  • Nokogiri::HTML5.parse new JSDOM().window.document
  • Nokogiri::HTML new JSDOM().window.document
  • Nokogiri::HTML.parse new JSDOM().window.document
  • Nokogiri::XML::Node.new document.createElement()
  • parent parentNode
  • previous= node.parentNode.insertBefore(sibling, node)
  • previous_element previousElement
  • previous_sibling previousSibling
  • processing_instruction? node.nodeType === Node.PROCESSING_INSTRUCTION_NODE
  • remove_attribute removeAttribute
  • root documentElement
  • search querySelectorAll
  • set_attribute setAttribute
  • text? node.nodeType === Node.TEXT_NODE
  • text textContent
  • to_html outerHTML

Next: Preact