Bug 50833 - Need to implement document.createStyleSheet
Summary: Need to implement document.createStyleSheet
Status: RESOLVED UNMAINTAINED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml ecma (show other bugs)
Version: 3.0.3
Platform: Unlisted Binaries Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-11-17 00:30 UTC by soloturn99
Modified: 2012-06-18 14:16 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
demo of problem (1.17 KB, text/html)
2010-10-11 21:28 UTC, Ronald Lammers
Details

Note You need to log in before you can comment on or make changes to this bug.
Description soloturn99 2002-11-17 00:30:59 UTC
Version:            (using KDE KDE 3.0.3)
Installed from:    Unspecified Linux

www.treemenu.com
does not work ... even if it is one of the most browser independent js menus i know
Comment 1 David Faure 2002-11-18 20:34:22 UTC
You call this browser independent? 
 
// browser sniffing routine 
browserName = navigator.appName; 
browserVersion = parseInt(navigator.appVersion); 
if(browserName == "Netscape" && browserVersion >= 3) { 
  MTMUsableBrowser = (navigator.userAgent.indexOf("Opera") == -1) ? true : false; 
} else if(browserName == "Microsoft Internet Explorer" && browserVersion >= 4) { 
  MTMUsableBrowser = true; 
} else if(browserName == "Opera" && browserVersion >= 5) { 
  MTMUsableBrowser = true; 
} 
 
(from the top of the main page of www.treemenu.com) 
 
Ok after faking the useragent things start to actually happen.... 
Comment 2 David Faure 2002-11-18 20:34:35 UTC
Subject: kdelibs/khtml/ecma

CVS commit by faure: 

Support for document.styleSheets(i)  (function call instead of the usual [i])
Trick reused from HTMLCollection, and code simply calls tryGet().
Necessary for www.treemenu.com (with IE UA), but not enough for it.
CCMAIL: 50833@bugs.kde.org


  M +24 -0     kjs_css.cpp   1.58
  M +3 -0      kjs_css.h   1.25

Comment 3 David Faure 2002-11-18 20:43:18 UTC
The next step in the IE emulation would be to implement document.createStyleSheet. 
 
With a Mozilla useragent, it fails at <style>.sheet - ah that's a bug. Fixed too. 
 
Now the tree appears (yay!). But since the site then tests "document.layers" to identify 
the Mozilla code paths, instead of  the initial browser detection, the two methods are 
being mixed, leading to errors.... (argl, why don't they do it properly?) 
 
Back to the IE code path then - but for later (possibly after kde-3.1). 
Comment 4 Morten Wang 2002-11-18 23:10:36 UTC
Pardon me for bumping in here, a user tipped me about this bug.

The non-existant support for Konqueror is known to me, and I'll be having a 
look at it as soon as time allows.  There's an entry for it in the project's 
SourceForge bug database: http://sourceforge.net/tracker/index.php?
func=detail&aid=593070&group_id=19589&atid=369589

Feel free to contact me if you have any specific questions or just want to 
rant about the lack of cross-browser support in my code. :)
Comment 5 Stephan Kulow 2004-10-30 12:03:37 UTC
I'm just debugging why the tree menu on a acer DSL router doesn't appear - and yes, I'm ranting on lack of cross-browser support too. You don't even test for getElementById for your DOM support test? 

Looking on how hard we have to emulate the createStyleSheet property. It doesn't seem to be used that much, so perhaps a bit faking might be enough already.
Comment 6 Stephan Kulow 2004-10-30 15:52:23 UTC
For full reference on what is missing and what is expected: http://www.quirksmode.org/dom/w3c_css.html
Comment 7 George Goldberg 2007-12-19 03:40:34 UTC
Is this bug still there in a recent version of KDE, such as 3.5.8 or KDE4.0 RC2?
Comment 8 David Faure 2010-02-10 13:03:23 UTC
Problem is still there in KDE 4.4. The missing document.createStyleSheet is the first error I'm getting on http://sandbox.onconfluence.com/display/DEV/Development+Team+Home+Page

konqueror(7173)/khtml (jscript) KJS::DOMNode::getOwnPropertySlot: DOMNode::getOwnPropertySlot  "createStyleSheet"
WARNING: KJS Type error: Attempt to use a non-function object or a value as a function.
Comment 9 David Faure 2010-02-10 17:57:39 UTC
Ah. My investigation was wrong, createStyleSheet only exists on IE, the page works in Firefox because it goes into a different code path.

<D2xSadEagle> What the website does is test for SVG DOM. If it's not there, it falls to an IE-specific path.
Comment 10 Ronald Lammers 2010-10-11 15:58:49 UTC
try-catch won't work for createStyleSheet: Konqueror still shows the errormessage (version 4.4.2)
This makes using try { if(doc.createStyleSheet){IE-code}else{normal code} }catch(err){} not userfriendly in Konqueror
Comment 11 Maksim Orlovich 2010-10-11 18:22:23 UTC
re: comment #10: please elaborate. It should just take the {normal code} 
branch in your example.
Comment 12 Ronald Lammers 2010-10-11 21:28:36 UTC
Created attachment 52423 [details]
demo of problem
Comment 13 Ronald Lammers 2010-10-11 21:30:17 UTC
The demo gives the following results:
IE & FF: as expected 4 messages
Chrome & Safari: 3 messages, the one that does not throw an error does not print
Konqueror: 3 messages (same as Chrome & Safari) but with errors thrown
Comment 14 Myriam Schweingruber 2012-06-18 14:16:08 UTC
Message from the Bugsquad and Konqueror teams:
This bug is closed as outdated, as we do not have the manpower to maintain the KDE3 version anymore.
If you still can reproduce this issue with Konqueror 4.8.4 or later, please open a new report.
Thank you for your understanding.