lambdasoup
lambdasoup copied to clipboard
Trying to insert a node before a child of the root fails
Soup.insert_before
only works if the node is a child of an element node, but it fails when the node is at the root of the element tree.
utop # #require "lambdasoup";;
utop # open Soup.Infix;;
utop # let s = Soup.parse "<p>test element</p>" ;;
utop # Soup.insert_before (s $ "p") (Soup.create_text "test stuff") ;;
Exception: Failure "Soup.insert_before: target node has no parent".