Problem in using &nbps; in Mozilla.

11 views
Skip to first unread message

Sunita Mittal

unread,
Apr 20, 2007, 2:29:01 AM4/20/07
to Google Web Toolkit
Hello,

I am unable set the border of Label in Mozilla.

In a Label we can set a blank string.
By calling label.setText(" ");

Now If I set the HTML of this Label in Grid by using DOM function

String innerHTML =
DOM.getInnerHTML(label.getElement()); (I
checked it returns : &nbps;)
DOM.setInnerHTML(td, innerHTML);

The label is properly visible with border in IE but not in Mozilla.

the border provided is

.color {
border: 1px solid #F0F8FF;
}

What I am missing, is this related to style I may be using or any
thing
else.

When some text is present in label then the border's are correctly
visible
in both i.e. IE and Fire Fox .

Thanks
Sunita Mittal.

fud...@gmail.com

unread,
Apr 20, 2007, 2:48:55 AM4/20/07
to Google Web Toolkit
Try   instead of &nbps; ....

Sunita Mittal

unread,
Apr 20, 2007, 3:35:35 AM4/20/07
to Google-We...@googlegroups.com
Sorry I wrongly spelt it as  &nbps I am actually using &nbsp.

Thanks
Sunita Mittal.

Reinier Zwitserloot

unread,
Apr 20, 2007, 9:33:34 AM4/20/07
to Google Web Toolkit
What's your context? borders are drawn outside the rendering box of an
element, so if there is no space on the outside (E.g. it's a cell in a
table), the border isn't visible, though some browsers make room for
it, which could explain why it works on some browsers but not on
others.


On Apr 20, 9:35 am, "Sunita Mittal" <sunita.mit...@daffodildb.com>
wrote:


> Sorry I wrongly spelt it as &nbps I am actually using &nbsp.
>
> Thanks
> Sunita Mittal.
>

Fred Sauer

unread,
Apr 20, 2007, 11:00:17 AM4/20/07
to Google-We...@googlegroups.com
Sunita,

A few thoughts
  1. #F0F8FF is extremely close to white. You may barely see it on a white background.
  2. If you really want a &nbsp; you ought to use HTML instead of Label and then html.setHTML ("&nbsp;"), or simple new HTML("&nbsp;");
  3. Browser differences
    • IE: In DOMImplIE6#setInnerText elem.innerText is used, which translated spaces to &nbsp;
    • FF: In DomImpl#setInnerText createTextNode() is used, which does not translate the spaces
    • FF then does the right thing (http://www.w3.org/TR/CSS21/text.html#white-space-prop) and collapses the white-space, which then leaves a DIV with no text content; The DIV still takes 100% of the width of the parent (because "display:block" is in effect), and so you get a DIV which is vertically collapsed, i.e. it's a horizontal line instead of a rectangle
I would call the difference you are seeing between IE/FF in #3 a bug. Would you mind filing an issue for that?

Hope that helps
Fred

Fred Sauer

unread,
Apr 21, 2007, 3:58:24 PM4/21/07
to Google-We...@googlegroups.com
Filed issue 960.

On 4/20/07, Fred Sauer < fr...@allen-sauer.com> wrote:
Sunita,

A few thoughts
    1. #F0F8FF is extremely close to white. You may barely see it on a white background.
    2. If you really want a &nbsp; you ought to use HTML instead of Label and then html.setHTML ("&nbsp;"), or simple new HTML("&nbsp;");
    3. Browser differences
      • IE: In DOMImplIE6#setInnerText elem.innerText is used, which translated spaces to &nbsp;
      • FF: In DomImpl#setInnerText createTextNode() is used, which does not translate the spaces
      • FF then does the right thing (http://www.w3.org/TR/CSS21/text.html#white-space-prop ) and collapses the white-space, which then leaves a DIV with no text content; The DIV still takes 100% of the width of the parent (because "display:block" is in effect), and so you get a DIV which is vertically collapsed, i.e. it's a horizontal line instead of a rectangle
    Reply all
    Reply to author
    Forward
    0 new messages