title: jQuery clone node error
body: <p>I have to check if a 'p' element contains some text, if so create another element 'span' then clone the 'p' element and append and replace it to the 'span' element. However i got the following error: </p>
  
  <blockquote>
    <p>Uncaught NotFoundError: Failed to execute 'appendChild' on 'Node': The
    new child element is null.</p>
  </blockquote>
  
  <p>Here is my codes:</p>
  
  <pre><code>if ($("p:contains('computer forensics is')")) {
              var highlight = document.createElement('span');
              highlight.className = 'highlight';
              highlight.style.backgroundColor = "red";
              highlight.id = "";
              highlight.setAttribute("title", "");
              var node = $("p:contains('computer forensics is')");
              var wordClone = node.clone(true);
              highlight.appendChild(wordClone);
              node.parentNode.replaceChild(highlight, node);
          }
  </code></pre>