?
avatar volandku
volandku
6 Nov 2016

Steps to reproduce the issue

Expected result

Actual result

In some cases Joomla remove when non-semantic-code inside

System information (as much as possible)

Joomla 3.7.0dev php 5.5

Additional comments

like this
http://paste.ubuntu.com/23435876/

Votes

# of Users Experiencing Issue
0/1
Average Importance Score
5.00

avatar volandku volandku - open - 6 Nov 2016
avatar zero-24
zero-24 - comment - 6 Nov 2016

Can you please a bit more information how to reproduce the issue?

avatar volandku
volandku - comment - 6 Nov 2016

Insert this code in item (TinyMCE - source code or No Editor), save it.
As result - same code, except tag a, it have been removed

avatar zero-24
zero-24 - comment - 6 Nov 2016

I can't reproduce the problem. Please doube check the Text Filter Settions for your User Group.

image

avatar ggppdk
ggppdk - comment - 6 Nov 2016

I tested with default text-filters for super-user,

  • it works with no-editor and code mirror
  • but with TinyMCE the JS code cleanup removes the A tag , it seems that TinyMCE tries to remove block elements from A Tags and fails in some cases removing the A tag itself ?

http://stackoverflow.com/questions/14597219/how-to-configure-tinymce-to-allow-block-level-elements-inside-anchor-a-tag

avatar zero-24
zero-24 - comment - 6 Nov 2016

For tinymce can you try to disable the editor checking via the plugin?

avatar zero-24
zero-24 - comment - 6 Nov 2016

The editor text filter i mean

avatar ggppdk
ggppdk - comment - 6 Nov 2016

It is disabled already, but it is not relevant, in my case it is the HTML code cleanup feature,
and not the disallowed tag that is causing the removal of the A tag

I tested here
https://www.tinymce.com/

and the tag is also removed, during code cleanup

@volandku
is the problem the removal of the A tag ?
or is the problem something else ?

avatar volandku
volandku - comment - 6 Nov 2016

I found it on client site.
All filters are disabled.
After I downgrade it to 3.6.4 and all works fine

avatar ggppdk
ggppdk - comment - 6 Nov 2016

@volandku

Same cleanup (the A tag is removed) happens in J3.6.4
so i repeat the question that you have not answered:

is the problem the removal / deletion of the A tag ?

avatar volandku
volandku - comment - 6 Nov 2016

I test it again on new test site.
Cant confirm without TinyMCE, but still confirm with TinyMCE

avatar mbabker
mbabker - comment - 6 Nov 2016

If it's TinyMCE specific there is either an issue in our implementation or a bug in their code.

avatar volandku
volandku - comment - 6 Nov 2016

Well on first client site there was this bug in any editor (evem without) on 3.7.0
Was no this bug on 3.6.4

May be matters it was upgraded 1.5 -> 2.5 -> 3.4 -> 3.6 -> 3.7

Filters for superadmin was setted to none

avatar mbabker
mbabker - comment - 6 Nov 2016

The only way it would matter on the upgrade path is if old files were not correctly removed.

avatar ggppdk
ggppdk - comment - 6 Nov 2016

If it's TinyMCE specific there is either an issue in our implementation or a bug in their code.

it is tinyMCE issue, and not Joomla implementation,

because I tested here
https://www.tinymce.com/

The a tag is lost , basically tinyMCE tries to move block elements out of the A tag, in this case it fails and removes the A Tag ...

Maybe we should is change the defaults of Joomla plugin for tinyMCE:
to prevent TinyMCE from doing the cleanup:

e.g.
Allowed child elements for a (e.g. notice div and h4):

a[div|h4|span|...........|img|#text]"

avatar mbabker
mbabker - comment - 6 Nov 2016

1) Report this as an issue to TinyMCE then
2) If it's a configurable behavior, then it might be acceptable. But then I have to ask, should we really allow invalid HTML constructs to be saved? OK the stuff might "work", but doesn't make it right.

avatar dgt41
dgt41 - comment - 6 Nov 2016

If it's a configurable behavior, then it might be acceptable.

It is, by assigning something like span[lang|dir|class|[xml:lang]] in extended elements. I did that in #11367
But I will agree that INVALID HTML SHOULD NOT BE ALLOWED, at least by default!

avatar ggppdk
ggppdk - comment - 6 Nov 2016

2 comments

  • removal of Anchor tag (A tag) is known TinyMCE bug if inside the A tag you have no Text node (see tinymce/tinymce#2991),
  • blocks elements inside Anchor are valid in HTML5, right ?

Explanation:
the block tags are moved outside the anchor during cleanup,
and then you have an A tag without any inner content
thus the A tag is removed

if you add "hello" just after A you will see that the A tag is not lost and it will be around hello

@volandku
I link to an issue above:
you can use

valid_children : '+a[div]',

but there is not parameter in the Joomla content plugin for doing this

avatar ggppdk
ggppdk - comment - 6 Nov 2016

Please see this:
http://html5doctor.com/block-level-links-in-html-5/

Wrapping Anchor around block elements is useful,
the alternative is to do tricks and use SPAN and CSS,

but since HTML5 allows, it makes no sense for Joomla not allow it by default

avatar brianteeman
brianteeman - comment - 6 Nov 2016

It doesn't matter what links you share to prove it should be ok. If tinyMCE
doesn't allow it (and you said it does not) then there is NOTHING we can do
about it.

avatar ggppdk
ggppdk - comment - 6 Nov 2016

I will make a PR (1 line of code),
it is just a matter of our default TinyMCE configuration allowing block elements inside anchor

avatar ggppdk
ggppdk - comment - 6 Nov 2016

I have made a PR

avatar ggppdk
ggppdk - comment - 6 Nov 2016

@dgt41

This is related ? #9323

Related in terms of "HTML code cleanups"

avatar Fedik
Fedik - comment - 6 Nov 2016

we should not promote invalid HTML, if User need it then he/she should do it himself

avatar ggppdk
ggppdk - comment - 6 Nov 2016

we should not promote invalid HTML, if User need it then he/she should do it himself

yes agreed but what is invalid the block elements inside anchor are valid (in HTML5)

avatar brianteeman
brianteeman - comment - 13 Nov 2016

I have made a PR

Where?


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12784.

avatar ggppdk
ggppdk - comment - 13 Nov 2016

Here is the PR:

#12792 HTML5 allows block elements inside anchors, modify TinyMCE default behaviour for this

avatar brianteeman
brianteeman - comment - 13 Nov 2016

Thanks now I can close this as we have a PR

avatar brianteeman brianteeman - change - 13 Nov 2016
Status New Closed
Closed_Date 0000-00-00 00:00:00 2016-11-13 10:50:43
Closed_By brianteeman
avatar brianteeman brianteeman - close - 13 Nov 2016
avatar brianteeman brianteeman - close - 13 Nov 2016

Add a Comment

Login with GitHub to post a comment