Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Any Point To class and style on XUL iframe?

11 views
Skip to first unread message

white...@fastmail.us

unread,
Feb 21, 2012, 7:42:08 PM2/21/12
to
My addon has an iframe in a dialog in which I am displaying an xhtml
help file that is located in the contents folder.

I have tried specifying a class attribute on the iframe in an effort to
style the xhtml (for example the font-family to use). I get no joy. So I
alternatively tried specifying a style attribute on the iframe to reach
the same result. Again no joy.

Are these attributes basically ignored? If so, is there some way to
communicate this style information into the iframe by my addon?

Thanks

alta88[nntp]

unread,
Feb 21, 2012, 10:22:24 PM2/21/12
to
your xhtml needs something like:

<head>
..
<link rel="stylesheet" type="text/css" media="all"
href="chrome://myext/skin/mycss.css"/>
..
</head>

nothing on the iframe will apply to the iframe's document. plus, using
a style attribute is poor form (imo).

white...@fastmail.us

unread,
Feb 22, 2012, 10:05:26 AM2/22/12
to
Thanks very much. I will try this. I agree that the style attribute is
lame here. But I was just trying things out. Seems that the style and
class attributes on the iframe are simply ignored. This is a bit
misleading to me. But your suggestion is ideal (if it works). Cheers!

white...@fastmail.us

unread,
Feb 22, 2012, 10:40:17 AM2/22/12
to
Well that works and gets me part of the way there. Perhaps you can tell
me how to over come this...

The font family used by TB in the XUL elements also on the dialog which
includes the iframe show up in a font that is sans-serif. I am guessing
this comes somehow from OS settings as the remainder of the TB interface
is in sans-serif (which I prefer). But for some reason, the xhtml in the
iframe is rendered using a serif font of some sort. I don't know why
this is. What I really want is to have the xhtml get rendered in
whatever font is used for the rest of the dialog. It looks rather
strange to have just this one widget displaying a different font. ANy
ideas? Thanks

Jonathan Protzenko

unread,
Feb 22, 2012, 10:58:10 AM2/22/12
to white...@fastmail.us, dev-ext...@lists.mozilla.org
I guess https://github.com/protz/GMail-Conversation-View/wiki/Fonts
applies to your case, since the Conversations UI also comes inside a
XUL iframe.

The interface of Thunderbird is styled to use sans-serif, and when
outputting a message, we add special CSS classes ("moz-txt-plain" for
instance) so that the message displays in sans-serif, but the contents
of a XUL iframe remain a *web page*, and therefore, are subject to the
same restrictions that any web page in, say, Firefox : the default font
is that chosen in the font preferences dialog. (Preferences > Display >
Formatting > Advanced). Web pages style their contents with CSS such as:

html {
font-family: sans-serif;
}

If you want the same for you iframe, you need to explicitly say so, or
have your addon flip the default font preferences (that's a bad idea,
though).

jonathan
> _______________________________________________
> dev-extensions mailing list
> dev-ext...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-extensions
0 new messages