Title: Empty element when &#039;&amp;&#039; in element with tooltip inserted
Last modified: August 22, 2016

---

# Empty element when '&' in element with tooltip inserted

 *  Resolved [dunco3000](https://wordpress.org/support/users/dunco3000/)
 * (@dunco3000)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/empty-element-when-in-element-with-tooltip-inserted/)
 * Hi,
 * I had an issue where paragraphs with the ‘&’ character in them where being lost
   if the WP Glossary Hover plugin was trying to insert the tooltip.
 * Tracked it down to the ‘$newNode->appendXML($nodeValue)’ failing in class-tooltip-
   parser.php.
 * This is the solution I came up with:
 * line 217: if ($updateNode)
    { $newNode = $dom->createDocumentFragment(); //error_log(“
   before append: “.$nodeValue); $convertedNodeValue = str_replace(‘&’, ‘&’, $nodeValue);//
   13.12.2014 Duncan M Added otherwise ‘appendXML’ below was consistently failing//
   error_log(“after conversion: “.$convertedNodeValue); //if (FALSE == $newNode-
   >appendXML($nodeValue)) if (FALSE == $newNode->appendXML($convertedNodeValue)){
   error_log(“WP Glossary Hover: appendXML failed, line 227 class-tooltip-parser.
   php”); } $node->parentNode->replaceChild($newNode, $node); }
 * but could be more elegant, and str_replace probably needs to account for more
   characters than just ‘&’… didn’t have time for further investigation sorry!
 * Otherwise, awesome plugin 🙂
 * [https://wordpress.org/plugins/wp-glossary-hover/](https://wordpress.org/plugins/wp-glossary-hover/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [dunco3000](https://wordpress.org/support/users/dunco3000/)
 * (@dunco3000)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/empty-element-when-in-element-with-tooltip-inserted/#post-5573638)
 * Sorry, should have included my code correctly:
 *     ```
       if ($updateNode)
       			{
       				$newNode = $dom->createDocumentFragment();
       				//error_log("before append: ".$nodeValue);
       				$convertedNodeValue = str_replace('&', '&', $nodeValue);  //13.12.2014 Duncan M Added otherwise 'appendXML' below was consistently failing
       				//error_log("after conversion: ".$convertedNodeValue);
       				//if (FALSE == $newNode->appendXML($nodeValue))
       				if (FALSE == $newNode->appendXML($convertedNodeValue))
       				{
       					error_log("WP Glossary Hover: appendXML failed, line 227 class-tooltip-parser.php");
       				}
       				$node->parentNode->replaceChild($newNode, $node);
       			}
       ```
   
 *  Plugin Author [chorton2227](https://wordpress.org/support/users/chorton2227/)
 * (@chorton2227)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/empty-element-when-in-element-with-tooltip-inserted/#post-5573909)
 * This issue is now fixed in version 1.2.0. The issue relates to escaping html 
   sepcial characters in the glossary term definition.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Empty element when '&' in element with tooltip inserted’ is closed to
new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-glossary-hover.svg)
 * [WP Glossary Hover](https://wordpress.org/plugins/wp-glossary-hover/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-glossary-hover/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-glossary-hover/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-glossary-hover/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-glossary-hover/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-glossary-hover/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [chorton2227](https://wordpress.org/support/users/chorton2227/)
 * Last activity: [11 years, 2 months ago](https://wordpress.org/support/topic/empty-element-when-in-element-with-tooltip-inserted/#post-5573909)
 * Status: resolved