apostrophecms / sanitize-html

Clean up user-submitted HTML, preserving whitelisted elements and whitelisted attributes on a per-element basis. Built on htmlparser2 for speed and tolerance

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

remove empty tag

mrbbp opened this issue · comments

commented

Hello sure my question is stupid but i do not understand your example:

sanitizeHtml(
  '<p>This is <a href="http://www.linux.org"></a><br/>Linux</p>',
  {
    exclusiveFilter: function(frame) {
      return frame.tag === 'a' && !frame.text.trim();
    }
  }
);

i'm trying to remove empty span and p or fill with&nbsp;or whitespace

i do not understand this line return frame.tag === 'a' && !frame.text.trim();
i do not understand the return with the test inside... (sorry it's tricky for me)
what does it suppose to return if tag is a and ???

would you kindly develop your line?

best regards

commented

thanks for your help
now i'm able to modifying it as i wish

have to return a true if i want to discard a tag.

regards