Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I try to make a filter not allowing all tags, but at least it should make TinyMCE somewhat WYSIWYG. I added them to "Allowed HTML tags" but still the keep being filtered out. Is this a bug?
Comment | File | Size | Author |
---|---|---|---|
#9 | filter.module-xhtml-close-tag_02.patch | 465 bytes | frjo |
#8 | filter.module-xhtml-close-tag.patch | 528 bytes | tclineks |
Comments
Comment #1
ñull CreditAttribution: ñull commentedSorry. The "them" I added to "Allowed HTML tags" were
and
.
Comment #2
ñull CreditAttribution: ñull commentedI added these to "Allowed HTML tags":
<br> </br>
Comment #3
alexanderpas CreditAttribution: alexanderpas commentedi noticed that is is inpossible to add any self-closing xhtml codes in the proper way so it keeps XHTML Strict Compliance
Comment #4
frjo CreditAttribution: frjo commentedI have noticed this also. The HTML filter will convert
in to this
breaking XHTML 1.0 Strict Compliance.
Comment #5
chx CreditAttribution: chx commented4.6.4 and on has filter_xss which takes special care to keep the XHTML slash.
Comment #6
frjo CreditAttribution: frjo commentedI missed to change the version info, sorry.
I have this problem with 4.6.4, and setting line 1097 in filter.module,v 1.57.2.10
to this
doesn't help.
(I believe $attr should be $attrlist since $attr is never set in function _filter_xss_split and should there not be a space before the closing slash?)
Comment #7
frjo CreditAttribution: frjo commentedProblem persist with Drupal 4.6.5.
Comment #8
tclineks CreditAttribution: tclineks commented$attr to $attrlist fixes this.
patch attached (patched against 4.6.5).
Comment #9
frjo CreditAttribution: frjo commentedThis works for me now, I must have done something wrong when I did the testing in my last post.
I suggest we also add a space before the closing slash, that is what my patch adds.
Comment #10
Steven CreditAttribution: Steven commentedI committed a slightly tweaked patch: the code would always add a space after the tag name, even if there were no attributes (e.g.
<tag >
) and it would not recognize the XHTML slash without the (optional) leading space (e.g.<tag/>
).Thanks.
Comment #11
tclineks CreditAttribution: tclineks commentedLooks like the extra space will still be there with that commit Steven.
http://drupal.org/node/27230 is a patch for this -- your conditional is cleaner.
Comment #12
Steven CreditAttribution: Steven commentedErr, how? This is the code:
$attrlist only contains non-empty strings, without leading or trailing spaces. And $attr2 only gets prefixed with a space if it is non-empty. So, there can only be a space between $elem and $attr2, if there are attributes.
As far as the leading space for the XHTML slash, that is recommended by W3C.
Comment #13
tclineks CreditAttribution: tclineks commentedthat's the code: last line still have space between $elem and $attr
http://cvs.drupal.org/viewcvs/drupal/drupal/modules/filter.module?r1=1.9...
Comment #14
tclineks CreditAttribution: tclineks commentedHas*
Sorry about not being very clear there.
Comment #15
tclineks CreditAttribution: tclineks commentedWhoops!
http://cvs.drupal.org/viewcvs/drupal/drupal/modules/filter.module?r1=1.9...
doesn't show the change on that line but it's there, fixed indeed.
Comment #16
(not verified) CreditAttribution: commented