CSS selectors in web pages

Nico R. n-roeser at gmx.net
Wed Sep 22 07:09:31 PDT 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jeroen Coumans wrote:

> Nico R. said the following on 20-09-2004 15:20:
>> 
>> Please test the new version extensively and in different browsers,
>> because my testing possibilities on this system are currently a bit
>> too limited. I stumbled across one annoyance when loading a page for
>> the first time, but this seemed to be a browser bug to me, and I
>> could not safely reproduce it.
>> 
>> Try changing a few style sheets and keep an eye on the style
>> selector. It should change automagically.
>> 
>> Would be nice if you could also test with different numbers of style
>> sheets, e.g. 0, 1, 2, 3, >3. I didn't have the time to do so...
> 
> Very nice! I've tested it and it works in Mozilla, Safari and Opera.
> It doesn't work in IE6 though, which is actually the only browser who
> benefits from the styleswitcher! :-)

Hmm... I can't test in IE, but I *assume* that might be because the DOM
support of IE is incomplete or broken. Will try to find out by Googling
and checking microsoft.com and try to adjust the script if possible.

AFAIK, there is a JScript debugging facility in IE6
(Extras->Options->Internet Options->Extended???). It allows you to get
a dialog box or warning for all scripting errors. Could you please turn
this on and tell me what errors are displayed (or that none are
displayed)? Thanks.

Oh, by the way, once we change the script type from "text/javascript" to
"application/x-ecmascript" or something more sane (we will have to
check what seems to be best), client-side scripts will stop working in
IE6 anyway.
Using "text/javascript" is *completely wrong*, since this type is not
registered with IANA. Therefore using it is a violation of RFC 2045,
and because of that, of HTML 4, too, because HTML 4 has RFC 2045 as a
normative reference. XHTML 1.0 is affected as well, because it uses the
semantics of HTML 4, so we are effectively violating the XHTML 1.0 spec
at the moment. The W3C validator does not tell us that, though, because
it has some limitations regarding the parsing and handling of the
affected attribute values. It it could, it would complain loudly due to
this specs violation, I think.

We should also set a Content-Style-Type header for our pages, it's
currently missing.


> Also, there are still some small bugs left:
> - it seems that if no cookie exists (eg. on first page load, like you
> mentioned above), no style gets displayed. This happened to me in
> various browsers (IE, Mozilla, Safari), so it's not a browser bug. It
> should use the style with rel="stylesheet" or the one with no title.

Ahh, I'm now able to reproduce this bug. I'm debugging it, but it will
take some time... I haven't yet figured out what's causing the problem.

> - the generated markup doesn't seem to be complete. I'm not sure, but
> it seems that no end tags for <ul>, <li> and <a href> are generated.
> Can you adjust the script so it closes the tags?

I'm not sure what you're referring to. If you are talking about the
lines containing "createElement": they create *elements*, not tags. So
the tags are always closed.
By the way, note that this only happens in memory. Most browsers (I
think) won't display the modified document source, but only the
original one. So you won't see the styleswitcher there at all. ;-) If
you do, and closing tags are missing, can you please send me the
relevant source snippets?

> - the stylesheet which is in use doesn't get displayed in the
> generated markup. Is it possible to make this optional in the
> javascript?

Well, I considered that a feature. :-) If you don't like it, comment out
the first occurence of "&& link.disabled" in the script and retry. If
you like that better, the invocation of updateStyleSwitcherMarkup
should also be moved after the current last line of the function that
gets assigned to window.onload , as it makes no sense to update the
style switcher on each click on one of its elements if it won't change
anyway. ;-)

Please give it a try by commenting out "&& link.disabled" and tell me
what you like better. Making this an option (by setting a global
variable, for example), is no problem as well.


Enjoy,
- -- 
Nico
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFBUYegxI5uhYOGv4URAmL2AKCCxSimbbZvhTB2llWImTOlEkN/yACeNgOn
lFIFQF3G6jPx7ISymJW2MZE=
=w9dh
-----END PGP SIGNATURE-----



More information about the website mailing list