Opened 6 years ago

Last modified 6 years ago

#10306 confirmed Bug

Anchor allows spaces in id attribute.

Reported by: Jakub Ś Owned by:
Priority: Normal Milestone:
Component: General Version: 3.6.5
Keywords: Orcale Cc:

Description (last modified by Jakub Ś)

According to http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#the-id-attribute - there can't be any spaces in id attribute.

If you put in editor code like:

<p><a href="#first anchor">#first anchor</a></p>
<p>Lots of P</p>
<p><a id="first anchor" name="first anchor"></a></p>

it will work in e.g. Chrome or IE9. If you press preview button then click on link at the top you will see it works and browsers properly do the "jump" to the bottom.

If you put this code in HTML5 Validator you will get 2 messages:

  • "Bad value first anchor for attribute id on element a: An ID must not contain whitespace."
  • "Bad value #first anchor for attribute href on element a: Whitespace in fragment component. Use %20 in place of spaces."

I think that in this case first message is the one we should focus on and not allow entering spaces into anchor.

Problem can be reproduced from CKEditor 3.6.5 rev. [7618] when id for anchor was introduced.

I have written "if you paste such code" but same code is produced when you create anchor with dialog and then create link to anchor with another dialog.

Change History (3)

comment:1 Changed 6 years ago by Jakub Ś

Status: newconfirmed

Issue can be reproduced in both CKE 3.x and 4.x.

comment:2 Changed 6 years ago by Jakub Ś

Description: modified (diff)

comment:3 Changed 6 years ago by Jakub Ś

After consulting with @fredck it is not clear that we should not allow value with spaces being entered in anchor as it is not allowed (for id attribute) and they may end up in link href attribute (which is also invalid).
Perhaps some validation tip like “use _ or – instead” should also be used here.

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