lambdasoup icon indicating copy to clipboard operation
lambdasoup copied to clipboard

Trying to insert a node before a child of the root fails

Open dmbaturin opened this issue 3 years ago • 1 comments

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".

dmbaturin avatar Feb 02 '22 15:02 dmbaturin