WPIntell

Source evidence

Empty element when '&' in element with tooltip inserted

WP Glossary Hover · support · 2014-12-13T06:26:00+00:00

mixedsentiment
mediumseverity
0.72relevance
2replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

2 / 22 rows with source links

9.1% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

20 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
dunco3000 resolved
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/ 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); } This issue is now fixed in version 1.2.0. The issue relates to escaping html sepcial characters in the glossary term definition.

Comments

2 shown
dunco3000 2014-12-13T06:28:00+00:00

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); }

chorton2227 2015-03-30T00:26:00+00:00

This issue is now fixed in version 1.2.0. The issue relates to escaping html sepcial characters in the glossary term definition.