Hi,

On Fri, Jan 23, 2015 at 11:56 PM, Marek Šabo <[email protected]> wrote:

> Hi All,
>
> I would like to ask about two separate pieces of code in the Wicket
> codebase working with HTML Ids:
>
> 1. org.apache.wicket.markup.repeater.AbstractRepeater
>     This class uses regex SAFE_CHILD_ID_PATTERN and produces warning in
> case the repeater IDs are not just numerical. I found a post [1] where Igor
> gave an explanation eons ago. I tried to locate code that would rely on
> that fact but didn't find anything. Is it possible that the check and
> warning produced are obsolete nowadays? If so, I guess it could be removed
> (I'd happily provide pull request). Otherwise, would someone point me to
> the code that relies on this?
>

This code is a "best effort" to make sure that the application code doesn't
use the same id for each iteration.
I agree that it is not as smart as one would wish.
Probably a better way would be to use a Set<String> and fail when a
duplicate id is detected during the rendering of the repeater.
A patch or Pull Request is welcome!


>
> 2. org.apache.wicket.DefaultMarkupIdGenerator
>     This class, after generating an Id, goes on to "escape some
> noncompliant characters" (namely "_.- ") with underscores. I'm not sure
> what compliance it's referring to. I checked the HTML 4 spec [2] and HTML 5
> specs [3]. All mentioned characters except whitespace seem to be legit in
> that context. Could someone shed some light on this -- e.g. what purpose
> does it exactly serve?
>

Well, it would be a perfect world if browsers were following the standards
but there are always exceptions. The escaping has been added because of a
bad behavior (read "wrong implementation").
Does the escaping break your application anyhow ?
The good thing is that now it is possible to provide custom
IMarkupIdGenerator. This interface has been added for better Portlet
support. AFAIR you are also Portlet user.


>
>
> Many thanks in advance.
>
>
> Best regards,
>
> Marek
>
>
> [1] http://apache-wicket.1842946.n4.nabble.com/Is-SAFE-CHILD-
> ID-PATTERN-in-AbstractRepeater-correct-or-does-it-break-CSS-spec-
> td1869301.html#a1869308
> [2] http://www.w3.org/TR/html401/types.html#type-name
> [3] http://www.w3.org/TR/html5/dom.html#the-id-attribute
>

Reply via email to