WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED DUPLICATE of
bug 4309
6680
DOMCSSStyleSheet not implemented but still reported as supported?
https://bugs.webkit.org/show_bug.cgi?id=6680
Summary
DOMCSSStyleSheet not implemented but still reported as supported?
Todd Ditchendorf
Reported
2006-01-19 22:26:26 PST
I'm not really sure if this totally qualifies as a bug... I suspect it's just a matter of these features not yet being implemented just yet. Then again, WebKit's ObjC DOM implementation will <a href="http:// www.ditchnet.org/wp/2006/01/19/webkit-dom-conformance/">report that it fully supports "CSS","2.0"</a>. However, it appears to not even come close yet. Therefore, it's a bug worth reducing and reporting. Seems a bit odd that WebKit reports supporting this module although it doesn't. Okay... here's my reduction in a nutshell. I have a very simple XHTML document: <div><pre><code> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
;> <html xmlns="
http://www.w3.org/1999/xhtml"
; xml:lang="en" lang="en"> <head> <title>Untitled</title> <link type="text/css" rel="stylesheet" href="stylesheet.css" /> <style type="text/css"> html { border:1px solid lime; } </style> </head> <body> <h1>dude</h1> </body> </html> </code></pre></div> And a very simple CSS stylesheet: <div><pre><code> body { border:1px solid orange; } </code></pre></div> As you can see, my XHTML document has two associated stylesheets. One linked via a <code>link</ code> tag and one embedded via a <code>style</code> tag. Here's what I'd like to do. I'd like to get a reference to the <code>DOMDocument</code> object representing my XHTML document. From this document object, I'd like to get references to its two <code>DOMStyleSheet</ code> objects. However, these two stylesheets (by virtue of the fact that they both contain <code>type="text/css"</code> attributes) should actually be instances of the more derived <code>DOMCSSStyleSheet</code> type. I should be able to cast these two <code>DOMStyleSheet</ code> instances down to the more specific <code>DOMCSSStyleSheet</code> interface. Again, this is due to my declaration that these two stylesheets are of type <code>"text/css"</code> <a href="
http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/css.html#CSS
- CSSStyleSheet">according to the DOM Level 2 CSS spec</a>. Unfortunately, if my tests are correct it doesn't look like WebKit DOM supports this basic type (<code>DOMCSSStyleSheet</code>) of the CSS Level 2 Module. This type is the most central interface of that Module, and claiming support without that type is pretty silly. Here's the code from my reduction that fails: <div><code><pre> DOMDocument *doc = [[webView mainFrame] DOMDocument]; DOMStyleSheetList *styleSheets = [doc styleSheets]; NSLog(@"num : %i",[styleSheets length]); // get reference to first stylesheet. should be a CSS stylesheet, but its not DOMStyleSheet *styleSheet1 = [styleSheets item:0]; DOMCSSStyleSheet *cssStyleSheet1 = (DOMCSSStyleSheet *)styleSheet1; // get reference to second stylesheet. should be a CSS stylesheet, but its not DOMStyleSheet *styleSheet2 = [styleSheets item:1]; DOMCSSStyleSheet *cssStyleSheet2 = (DOMCSSStyleSheet *)styleSheet2; // check the type of first stylesheet, both should return YES NSLog(@"styleSheet1 is DOMStyleSheet ? %i", [cssStyleSheet1 isKindOfClass:[DOMStyleSheet class]]); NSLog(@"styleSheet1 is DOMCSSStyleSheet ? %i", [cssStyleSheet1 isKindOfClass:[DOMCSSStyleSheet class]]); // check the type of second stylesheet, both should return YES NSLog(@"styleSheet2 is DOMStyleSheet ? %i", [cssStyleSheet2 isKindOfClass:[DOMStyleSheet class]]); NSLog(@"styleSheet2 is DOMCSSStyleSheet ? %i", [cssStyleSheet2 isKindOfClass:[DOMCSSStyleSheet class]]); // these methods should exist, but will raise error DOMCSSRuleList *ruleList1 = [cssStyleSheet1 cssRules]; DOMCSSRuleList *ruleList2 = [cssStyleSheet2 cssRules]; </code></pre></div> And here is the output: <div><code><pre> 36 -0600.] num : 2 [styleSheet isKindOfClass:[DOMStyleSheet class]] ? 1 [styleSheet isKindOfClass:[DOMCSSStyleSheet class]] ? 0 *** -[DOMStyleSheet cssRules]: selector not recognized [self = 0x3a4580] *** -[DOMStyleSheet cssRules]: selector not recognized [self = 0x3a4580] </code></pre></div> If my code is correct, appears that the stylesheets are not returned as specifically being CSS stylesheets as the DOM spec mandates. Apple really should report that DOM Level 2 CSS is not supported until this is implemented. <a href="
http://ditchnet.org/csstest/CSSTest.zip
">Download Xcode project reduction</a>.
Attachments
Xcode project test case
(35.02 KB, application/octet-stream)
2006-01-20 06:42 PST
,
Todd Ditchendorf
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Joost de Valk (AlthA)
Comment 1
2006-01-20 01:14:26 PST
Hi Todd, although your bugreport looks interesting, it also looks a bit cluttered :) could you add the testcase as an attachment to this bug? Thx!
Todd Ditchendorf
Comment 2
2006-01-20 06:42:52 PST
Created
attachment 5799
[details]
Xcode project test case Xcode project that demonstrates the problem in as few lines as possible.
Todd Ditchendorf
Comment 3
2006-01-20 06:45:16 PST
Hi Joost... sorry was attempting to be thorough, but it turned out a big mess! I've added an attachment for the Xcode project test case and a URL to my blog where the text of the desc can be read with much better formating.
Alexey Proskuryakov
Comment 4
2006-07-28 05:16:16 PDT
I have verified that the test works correctly now: 2006-07-28 16:12:19.852 CSSTest[24125] num : 2 2006-07-28 16:12:19.852 CSSTest[24125] styleSheet1 is DOMStyleSheet ? 1 2006-07-28 16:12:19.852 CSSTest[24125] styleSheet1 is DOMCSSStyleSheet ? 1 2006-07-28 16:12:19.853 CSSTest[24125] styleSheet2 is DOMStyleSheet ? 1 2006-07-28 16:12:19.853 CSSTest[24125] styleSheet2 is DOMCSSStyleSheet ? 1 *** This bug has been marked as a duplicate of
4309
***
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug