Opened 3 years ago

Last modified 3 years ago

#14851 confirmed Bug

trailing slash is removed from meta tag

Reported by: Irina Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: IBM Cc: Satya Minnekanti

Description

Steps to reproduce

  1. Open test.html page
  2. Switch to HTML Source tab
  3. Observe meta tag, trailing slash is removed

Expected result

mata tag is converted into (XHTML) self-closing tag with trailing slash: e.g. <meta charset="utf-8" />

Actual result

mata tag is converted into self-closing tag without trailing slash: <meta charset="utf-8">

Other details (browser, OS, CKEditor version, installed plugins)

Attachments (1)

test.html (1.9 KB) - added by Irina 3 years ago.

Download all attachments as: .zip

Change History (6)

Changed 3 years ago by Irina

Attachment: test.html added

comment:1 Changed 3 years ago by Jakub Ś

Status: newpending
Version: 4.5.11

The / character has no effect on void elements - https://www.w3.org/TR/html5/syntax.html#start-tags in HTML5 and using end tag on such meta element seems to be invalid - https://www.w3.org/TR/html-markup/meta.http-equiv.content-type.html#meta.http-equiv.content-type and https://html.spec.whatwg.org/multipage/semantics.html#the-meta-element.

@satya you are using HTML5 page, HTML5 meta tag. Why do you expect output to be XHTML? I don’t understand this use case. Could you perhaps provide more detail?

Please note that if you use<meta charset="utf-8" /> it will not be modified

Last edited 3 years ago by Jakub Ś (previous) (diff)

comment:2 Changed 3 years ago by Irina

This defect was logged by a product which uses CKEditor to produce XHTML content.

The usecase:

  • CKEditor's content that has <meta charset="utf-8" /> tag will be submitted to the backend.
  • Backend will convert Meta tag into <meta charset="utf-8"></meta> (which is valid in XHTML).
  • When editing this content again, CKEditor will change <meta charset="utf-8"></meta> into <meta charset="utf-8"> which isn't XHTML valid and as a result will prevent user from saving the page.

comment:3 Changed 3 years ago by Jakub Ś

Status: pendingconfirmed

Backend will convert Meta tag into <meta charset="utf-8"></meta> (which is valid in XHTML)

Well, this is invalid meta declaration for XHTML, HTML4 and HTML5 - <meta charset="utf-8"></meta>. In HTM5 and HTML4 end tag is invalid and in XHTML and HTML4 the structure should be different. I personally think it would be much better if that backend would use /> for empty elements.

On the other hand in XHTML end tag is allowed as one of alternatives - https://www.w3.org/TR/xhtml1/#h-4.6 If you enter such meta tag <meta content="text/html; charset=utf-8" http-equiv="content-type" ></meta> into editor (and you use XHTML doctype on page and inisde the editor) you would expect it to be left as is or converted to <meta content="text/html; charset=utf-8" http-equiv="content-type" />. It should not be converted to <meta content="text/html; charset=utf-8" http-equiv="content-type" >. Since such syntax /> is valid for HTML and XHTML, CKEditor should probably use such so I agree that this ending / should be added.

comment:4 Changed 3 years ago by Irina

This issue also can be reproduced with the line breaks, e.g. one XHTML line break (<br></br>) will be converted into <br/><br/>.

In HTML 5: <br> is preferred, but <br/> and <br /> are allowed

In XHTML: <br /> is preferred but <br/> or <br></br> can be used as well

comment:5 Changed 3 years ago by Irina

Steps to reproduce the BR issue:

  1. Paste following into the HTML Source tab:
<p dir="ltr">&nbsp;</p>
<table dir="ltr">
    <tbody>
        <tr>
            <td>
            <p><br class="forTest"></br>
            testing</p>
            </td>
        </tr>
    </tbody>
</table>
  1. Switch to wysiwyg mode
  2. Call getData method

Result: An extra line is added when <br class="forTest"></br> gets converted to <br class="forTest" /><br />

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy