Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
3.8k views
in Q2A Core by
When widget plugin outputs nothing, empty tag(<DIV CLASS="qa-widget-side"></DIV>) is outputted and unnecessary line(boarder) is displayed. How to solve this problem?
Q2A version: 1.5, 1.6

1 Answer

0 votes
by
edited by

Solution ex. by jQuery:

Reference: http://stackoverflow.com/questions/1539367/remove-whitespace-and-line-breaks-between-html-elements-using-jquery

File: qa-theme/Your theme/qa-theme.php

Source:

function head_script()
{
  qa_html_theme_base::head_script();
 
  $this->output(
    '<SCRIPT TYPE="text/javascript"><!--',
    '$.fn.cleanWhitespace = function() {',
    '  textNodes = this.contents().filter(',
    '  function() { return (this.nodeType == 3 && !/\S/.test(this.nodeValue)); })',
    '  .remove();',
    '  return this;',
    '}',
    '$(document).ready(function(){',
    '  $(\'.qa-widget-side\').cleanWhitespace();',
    '  $(\'.qa-widget-side:empty\').remove();',
    '});',
    '//--></SCRIPT>'
  );
}
There may be method of processing by server side ...
...