public class DomIdProvider extends Object
While not required, IDs are strongly encouraged to be legal to use in CSS expressions without any escaping, as
various tools such as HtmlLayoutContainer, DomQuery, and XElement will do no escaping when using them. According
to http://www.w3.org/TR/CSS21/grammar.html#scanner, these IDs should match this grammar:
%option case-insensitive
h [0-9a-f]
nonascii [\240-\377]
unicode \\{h}{1,6}(\r\n|[ \t\r\n\f])?
escape {unicode}|\\[^\r\n\f0-9a-f]
nmstart [_a-z]|{nonascii}|{escape}
nmchar [_a-z0-9-]|{nonascii}|{escape}
ident -?{nmstart}{nmchar}*
or roughly expressed as a regex, -?[_a-zA-Z][_a-zA-Z0-9-]*
.
You can replace the default implementation of this class with your own type that extends it through a replace-with
directive in your module file, something like this:
<replace-with class="path.to.my.CustomDomIdProvider">
<when-type-is class="com.sencha.gxt.core.client.dom.DomIdProvider" />
</replace-with>
In that custom implementation, you can override the two non-static methods:
#generateIdForElement(com.google.gwt.dom.client.Element)
, and
#generateIdForWidget(com.google.gwt.user.client.ui.Widget)
.Constructor and Description |
---|
DomIdProvider() |
Modifier and Type | Method and Description |
---|---|
static String |
generateId(Element element) |
static String |
generateId(Widget widget) |
String |
generateIdForElement(Element element) |
String |
generateIdForWidget(Widget widget) |
Copyright © 2018. All rights reserved.