It involves creating a new
InsertionPoint variant (called, say, TableFosterParenting), which will be used inside this else if block here. We will remove all the code inside that block, and have it return the new variant, which will contain both the current and previous element.
Now, all instances of
InsertionPoint are mostly passed untouched to the insert_at method, where it calls the appropriate
sink method based on the variant. We will need a new sink method for the new variant, too. The impl for that method will be easy, it will just check if the first element has a parent node or not, and then call the appropriate append method.
InsertionPoint instance is accessed at one other point, here. Here, assuming we've already removed
same_tree, we'll have to pass both elements to
associate_with_form, if the enum variant was
TableFosterParenting. On the main thread, we can access the DOM and perform the corresponding operations.