Wednesday, September 8, 2010

Re: DisclosurePanel, class-name "content"

I agree with you that the reason for the prefixing is to prevent
collisions, but agree(assuming the following was the the GWT team's
reasoning) that only the parent element in a widget should have the
prefix and not the sub elements. If you wanted to add a prefix to
every class name in your UI, the further down in the DOM you go the
bigger the class names would be. This was the reason behind the
creation of CSS selectors. I will use a tab panel as an example.
Assume I want to change the width of the upper left hand corner of a
rounded tab on a specific class of tab panel.

gwt-DecoratedTabPanel > header > tab > upperLeft {}

vs

gwt-DecoratedTabPanel > gwt-DecoratedTabPanel-Header > gwt-
DecoratedTabPanel-Header-Tab > gwt-DecoratedTabPanel-Header-Tab-
UpperLeft

Yes this is more inconvenient for people integrating into other sites
that do not have prefixes, but I find it pretty hypocritical that you
would expect GWT to avoid collisions with classes that are blatantly
defined without the same consideration. I also do see your point that
within GWT they do tend to add the prefixes to most class names, so it
is interesting that they would choose to omit it here. Also, you have
to take into account a balance in selectors and the expense of
ancestor selectors. At IO there was a talk on efficiency for the past
couple years and one of the points was the way browsers handle
ancestor selectors and how it will cause slow down if you use a common
name as your root(upperLeft in the context above). It will walk the
entire DOM tree every time it sees an element with the class
upperLeft. So it is a balance and "content" is such a common one that
I may concede due to performance degradation.

On Sep 8, 3:09 pm, Jaroslav Záruba <jaroslav.zar...@gmail.com> wrote:
> Just to be clear, I don't need advices on workaround. I honestly believe
> this is just an omission. (The other option wold be 'blatant example of bad
> design', but we're not talking MSIE here.)
> The reason behind prefixing class-names used in GWT is, IMO, very obvious -
> to prevent exactly this kind of collisions.
> When virtually all the class-names used in GWT are "name-safe" to me it
> feels wrong to be forced to fix one nested class-name before releasing a
> GWT-component to the world. (Even the class-name for open DisclosurePanel is
> strongly prefixed: "gwt-DisclosurePanel-open".)
> Adding something like "fix your class-names before you use this" to your
> release notes is IMO a big 'no go'. Some people might want to use your
> component on a website that runs on something they did not write.
>
> Well, if you can't see it, I won't probably change your mind. So thanks for
> the discussion.
>
> Cheers
>   JZ
>
> On Wed, Sep 8, 2010 at 8:03 PM, lineman78 <linema...@gmail.com> wrote:
> > Then the problem isn't with GWT; it is with the site you are
> > integrating with not having a convention.  I do agree that it would be
> > nice to be able to change this and if it bugs you that much you can,
> > it's just not as easy as it could be.  They have a private static
> > string with the style name within disclosure panel, but you can't
> > change it as easy because everything is private, instead you will have
> > to remove the name after it is added and add your own by overriding
> > the setContent method
>
> > On Sep 7, 11:36 pm, Jaroslav Záruba <jaroslav.zar...@gmail.com> wrote:
> > > On Wed, Sep 8, 2010 at 2:43 AM, lineman78 <linema...@gmail.com> wrote:
> > > > It is because content and header all both children of the gwt-
> > > > DisclosurePanel class and they expect you to use child selectors.
> > > > Here is what they expect you use so that you don't end up with
> > > > collisions:
>
> > > > .gwt-DisclosurePanel .content {
> > > >  border: 2px solid black;
> > > > }
>
> > > In other words, this ^^^ does not address the issue.
>
> > > Regards
> > >   J. Záruba
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google Web Toolkit" group.
> > To post to this group, send email to google-web-toolkit@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-web-toolkit+unsubscribe@googlegroups.com<google-web-toolkit%2Bunsubscribe@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-web-toolkit?hl=en.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment