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

List postfixers should always check type attribute and type of element. #3003

Closed
jodator opened this issue May 14, 2018 · 4 comments · Fixed by ckeditor/ckeditor5-list#104
Closed
Assignees
Labels
package:list type:bug This issue reports a buggy (incorrect) behavior.
Milestone

Comments

@jodator
Copy link
Contributor

jodator commented May 14, 2018

The type attribute has a general name that might be used in other features. One such a feature was created here. Basically it adds a type attribute on video model element which represents the type of a media, ie video/mp4.

Unfortunately using it with conjunction with the List features leads to removing type attribute from a video element by List postfixer:

https://github.com/ckeditor/ckeditor5-list/blob/8074189abd6b406c02edd697556a267b8ae4e053/src/converters.js#L600-L620

The problem is that it should also if item is a listItem as in other checks.

@jodator jodator self-assigned this May 14, 2018
@scofalik
Copy link
Contributor

AFAIR without looking at the code, the problem won't be resolved by checking item.name. We will need to rename type to listType.

@jodator
Copy link
Contributor Author

jodator commented May 15, 2018

@scofalik yeah I'm checking this on schema - if it's allowed then it stays. The problem is that postfixer doesn't know which element it was previously - so it was removing it from every element (even those newly created). The simple check for now which I've added is to check schema.

Also this should be cleaned upon resolving this: https://github.com/ckeditor/ckeditor5-engine/issues/1228.

@Reinmar
Copy link
Member

Reinmar commented May 15, 2018

The problem is deeper. Much deeper. The type may be allowed on <listItem> and <video>. What if someone renames one to another? This postfixer, even when based on the schema (as after ckeditor/ckeditor5-engine#1228), will keep this attribute. The problem is that its value will be invalid in the context of the new element.

This indicates that we should rename this attribute to listType. Attributes belonging to specific elements should be prefixed with their names (or made unique in some other way).

Another example – the same situation might occur if <p alignment> was renamed to <image>. The <image> might allow alignment and the same situation would occur again. However, <image> should not use alignment attribute (unless, of course, it's handled by the same feature which handles it on paragraphs). It should use imageAlignment. Just like we have imageStyle instead of style (which was caused by a completely different problem, but turns out to be good :D).

So, I'm ok with renaming type to listType. We should go further and rename also listItem's indent to listIndent.

As for the image's src and alt, we might rename them too unless we want to make an exception for object elements which are never going to be renamed to anything (so their attributes won't leak), but then we have to live with that inconsistent imageStyle.

@Reinmar
Copy link
Member

Reinmar commented Jun 4, 2018

So, I'm ok with renaming type to listType. We should go further and rename also listItem's indent to listIndent.

@scofalik gave 👍 to that and @pjasiun was fine with this change too. Let's do it, then.

Reinmar referenced this issue in ckeditor/ckeditor5-list Jun 13, 2018
Other: Rename dlist attributes `indent` and `type` to `listIndent` and `listType` to avoid collisions with possible generic `type` attribute which could be used on other elements. Closes #103.

BREAKING CHANGE: The `indent` attribute is now called `listIndent`. See #103 for more information.

BREAKING CHANGE: The `type` attribute is now called `listType`. See #103 for more information.
Reinmar referenced this issue in ckeditor/ckeditor5-alignment Jun 13, 2018
Internal: Aligned tests to changes in ckeditor/ckeditor5-list#103.
Reinmar referenced this issue in ckeditor/ckeditor5-autoformat Jun 13, 2018
Internal: Aligned tests to changes in ckeditor/ckeditor5-list#103.
Reinmar referenced this issue in ckeditor/ckeditor5-block-quote Jun 13, 2018
Internal: Aligned tests to changes in ckeditor/ckeditor5-list#103.
Reinmar referenced this issue in ckeditor/ckeditor5-engine Jun 13, 2018
Internal: Aligned tests to changes in ckeditor/ckeditor5-list#103.
Reinmar referenced this issue in ckeditor/ckeditor5-typing Jun 13, 2018
Internal: Aligned tests to changes in ckeditor/ckeditor5-list#103.
@mlewand mlewand transferred this issue from ckeditor/ckeditor5-list Oct 9, 2019
@mlewand mlewand added this to the iteration 18 milestone Oct 9, 2019
@mlewand mlewand added status:confirmed type:bug This issue reports a buggy (incorrect) behavior. package:list labels Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:list type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants