Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove empty tag #509

Closed
mrbbp opened this issue Oct 31, 2021 · 2 comments
Closed

remove empty tag #509

mrbbp opened this issue Oct 31, 2021 · 2 comments
Labels

Comments

@mrbbp
Copy link

mrbbp commented Oct 31, 2021

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

@mrbbp mrbbp added the question label Oct 31, 2021
@boutell boutell closed this as completed Nov 1, 2021
@boutell
Copy link
Member

boutell commented Nov 1, 2021 via email

@mrbbp
Copy link
Author

mrbbp commented Nov 1, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants