title: Why does this element in lxml include the tail?
body: <p>Consider this Python script:</p>
  
  <pre><code>from lxml import etree
  
  html = '''
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;&lt;/head&gt;
    &lt;body&gt;
      &lt;p&gt;This is some text followed with 2 citations.&lt;span class="footnote"&gt;1&lt;/span&gt;
         &lt;span сlass="footnote"&gt;2&lt;/span&gt;This is some more text.&lt;/p&gt;
    &lt;/body&gt;
  &lt;/html&gt;'''
  
  tree = etree.fromstring(html)
  
  for element in tree.findall(".//{*}span"):
      if element.get("class") == 'footnote':
          print(etree.tostring(element, encoding="unicode", pretty_print=True))
  </code></pre>
  
  <p>The desired output would be the 2 <code>span</code> elements, instead I get:</p>
  
  <pre><code>&lt;span xmlns="http://www.w3.org/1999/xhtml" class="footnote"&gt;1&lt;/span&gt;
  &lt;span xmlns="http://www.w3.org/1999/xhtml" class="footnote"&gt;2&lt;/span&gt;This is some more text.
  </code></pre>
  
  <p>Why does it include the text after the element until the end of the parent element?</p>
  
  <p>I'm trying to use lxml to link footnotes and when I <code>a.insert()</code> the <code>span</code> element into the <code>a</code> element I create for it, it's including the text after and so linking large amounts of text I don't want linked.</p>