Bug 64690 - style switching overridden by view menu setting
Summary: style switching overridden by view menu setting
Status: RESOLVED WORKSFORME
Alias: None
Product: konqueror
Classification: Applications
Component: khtml renderer (show other bugs)
Version: 4.0
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-09-21 22:26 UTC by _
Modified: 2003-12-28 06:41 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ 2003-09-21 22:26:29 UTC
Version:           4.0 (using KDE 3.1.4)
Installed from:    compiled sources
Compiler:          gcc version 3.2.2
OS:          Linux (i686) release 2.4.22.2-mark-athlon-

I'll start off giving an example:
at http://www.howtocreate.co.uk/ try the style switcher. You'll see it works in any recent browser, except Konqueror!
My thoughts are that Konqueror overrides the script's setting by its own view menu-setting.

It DOES work in Safari and OmniWeb 4.5 (both using the KHTML engine).
Comment 1 TarquinWJ 2003-09-22 09:27:21 UTC
I am the author of the stylesheet switcher in question.

It does not use the document.styleSheets array (as recommended by the W3C), 
because:
'Konqueror and Safari [KHTML] incorrectly only populate the document.styleSheets 
collection with stylesheets that are enabled at any particular instant. The 
stylesheets cannot be disabled using document.styleSheets, and do not have the 
title property.' - I assume this should be logged as a separate bug, or someone 
needs to clarify the W3C's recommendations.

Instead, it uses document.getElementsByTagName with LINK elements with REL 
attribute of 'stylesheet' or 'alternate stylesheet', as well as STYLE elements. 
It then modifies the disabled property of these elements to switch stylesheets.

This technique is the most common in use for switching stylesheets. Another 
stylesheet switcher (the most popular one in use, which utilises the same 
technique) on http://www.meyerweb.com/ also fails in Konqueror.

In both cases, the stylesheet can still be switched using the 'view' menu.
Comment 2 TarquinWJ 2003-09-22 12:17:56 UTC
See also:

http://bugs.kde.org/show_bug.cgi?id=54335
Konqueror 3.1: first alternate CSS stylesheet replaces default stylesheet. 
Javascript can't change style

and

http://bugs.kde.org/show_bug.cgi?id=43513
'Konqueror 3.0 selects alternate stylesheet instead of default stylesheet'
Comment 3 Helge Deller 2003-11-02 16:31:52 UTC
TarquinWJ,  
switching with the "View"->"Usw stylesheet" doesn't work with konqueror either....
Just tested KDE 3.2 beta1 (CVS HEAD)....
Helge
Comment 4 Simon Perreault 2003-12-28 06:41:01 UTC
The JavaScript switcher and the View menu both seem to work now.