Bug 24354 - Alternate stylesheets (without title attribute) are loaded on refresh
Summary: Alternate stylesheets (without title attribute) are loaded on refresh
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Dave Tharp
URL: http://robballou.com/switcher/sandbox...
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-04 07:58 PST by Rob
Modified: 2012-04-27 02:22 PDT (History)
6 users (show)

See Also:


Attachments
Patch (20.60 KB, patch)
2012-03-07 11:38 PST, Dave Tharp
no flags Details | Formatted Diff | Diff
Patch (19.85 KB, patch)
2012-03-09 09:07 PST, Dave Tharp
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rob 2009-03-04 07:58:50 PST
There is a bug in the manner that alternate stylesheets are handled by Safari 4, Safari 3, and webkit:

Description:

Alternate stylesheets without a title attribute are rendered on reload (but not on initial load):

Steps to reproduce:

- Visit http://robballou.com/switcher/sandbox/alternate2.php
- The page should load with a blue border on top.
- Refresh the page
- The page now has a red border (which is from the "alternate stylesheet")

While the spec [1] mentions to add both alternate and title to an alternate stylesheet, it seems odd behavior that it does not load the altenerate on first page load, but not on subsequent loads. For what it's worth, both Firefox (3) and Opera (9.63) do not load the alternate stylesheet on reload (or at all). FF does not seem to even request the stylesheet from the server.

[1]: http://www.w3.org/TR/REC-html40/present/styles.html#h-14.3.2
Comment 1 Alexey Proskuryakov 2012-02-01 11:22:07 PST
In Safari 5.1, the wrong stylesheet appears to be always loaded, not just on reload.

See also: bug 77549.
Comment 2 Dave Tharp 2012-03-06 16:11:43 PST
(In reply to comment #1)
> In Safari 5.1, the wrong stylesheet appears to be always loaded, not just on reload.
> 
> See also: bug 77549.
Investigated the complete test suite for alternate stylesheets (5 tests) at http://robballou.com/switcher/sandbox/alternate2.php .  Here are the results:

     Test # ->  | 1 | 2 | 3 | 4 | 5 
                +---+---+---+---+---
FF              | P | P | P | P | P 
Chrome (webkit) | P | F | F | P | F 
IE              | P | P | P | P | P

Note the 3 failures for Chrome.  This similar to the issue in bug 77549: the spec implies that alternate stylesheets must have a title. IE and FF have interpreted the spec this way, and the draft CSSOM spec (http://dev.w3.org/csswg/cssom/#requirements-on-user-agents-implementing-the-xml-stylesheet-processing-instruction) spells this out in detail.
Comment 3 Dave Tharp 2012-03-07 11:38:08 PST
Created attachment 130659 [details]
Patch
Comment 4 Alexey Proskuryakov 2012-03-07 15:52:38 PST
Comment on attachment 130659 [details]
Patch

Please make the tests text-only.
Comment 5 Dave Tharp 2012-03-07 19:53:56 PST
(In reply to comment #4)
> (From update of attachment 130659 [details])
> Please make the tests text-only.
Will do.  I expected you to mention this based on the review of 77549.  Thanks!
Comment 6 Dave Tharp 2012-03-09 09:07:23 PST
Created attachment 131044 [details]
Patch
Comment 7 Dave Tharp 2012-03-09 09:09:41 PST
(In reply to comment #6)
> Created an attachment (id=131044) [details]
> Patch
- re-wrote tests as text tests
- removed code comment (being consistent with the code change on bug 77549)
Comment 8 Dave Hyatt 2012-03-13 11:17:52 PDT
Comment on attachment 131044 [details]
Patch

r=me
Comment 9 WebKit Review Bot 2012-03-13 15:40:33 PDT
Comment on attachment 131044 [details]
Patch

Clearing flags on attachment: 131044

Committed r110626: <http://trac.webkit.org/changeset/110626>
Comment 10 WebKit Review Bot 2012-03-13 15:40:38 PDT
All reviewed patches have been landed.  Closing bug.
Comment 11 Arunprasad 2012-04-27 02:22:38 PDT
will this bug resolves https://bugs.webkit.org/show_bug.cgi?id=56932 ..?