-
Notifications
You must be signed in to change notification settings - Fork 353
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
Labels
Comments
This line returns true if the tag is "a" and it contains no text
(frame.text.trim() is falsy, i.e. the empty string).
So it discards links with no text in them and keeps the rest.
JavaScript treats expressions the same way regardless of whether they are
part of a "return" statement, an "if" statement, an assignment, etc.
…On Sun, Oct 31, 2021 at 1:17 PM mrbbp ***@***.***> wrote:
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 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
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#509>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAH27LOG4AO4QGJI7XPEGTUJV24BANCNFSM5HCQDEJA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
--
THOMAS BOUTELL | CHIEF TECHNOLOGY OFFICER
APOSTROPHECMS | apostrophecms.com | he/him/his
|
thanks for your help 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
Hello sure my question is stupid but i do not understand your example:
i'm trying to remove empty
span
andp
or fill with
or whitespacei 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
The text was updated successfully, but these errors were encountered: