[patch] #67453/#68504 js induced crashes on disabling/enabling <link> elements
Germain Garand
germain at ebooksfrance.org
Thu Nov 27 19:23:52 GMT 2003
Hi,
while I was on stylesheets,
I've worked a bit on javascript style switchers problems.
The first problem: unbalanced calls to addPendingSheet()/styleSheetLoaded()
that cause assertion failures.
Those calls are there to ensure that an alternate sheet which has been
explicitly enabled via a script is properly loaded.
But since ordinarily we don't wait for alternate sheets, this causes
out-of-sync problems on stylesheet count from other places that don't expect
them.
WebCore address this with a strange "tri-state boolean", and other
enabledViaScript() hacks, but it still looks complicated.
So the idea: when those alternate sheets are enabled via script, they behave
exactly like preferred stylesheets. Thus why not pretend they _are_ indeed
preferred sheets when enabled... This pretty much solve all problems because
preferred sheets are properly tracked, and their selection is sound (i.e:
only one sheet among a set of alternates will be applied)
Second problem: disabled sheets were discarded from the available
alternatives.
I believe this is incorrect, because <link>'s "disabled" attribute is only a
DOM extension describing if a sheet is applied or not. It's not part of HTML
and should not have such side effect on link elements.
For reference, both Mozilla 1.5 and Opera 7 keep disabled sheets in the
available alternatives, so that you can pick them by hand.
I have tested the attached patch[1] with all style switchers I could find [2]
and it works seemingly fine.
I'll let you review :-)
Germain
[1] includes the previous patch I sent, because they otherwise conflict...
Dirk, was it OK?
[2] a good example being:
http://www.meyerweb.com/eric/css/ => the "presentation" menu.
Most js style switchers are derivated from this reference implementation:
http://www.alistapart.com/articles/alternate/
e.g:
http://cnx.rice.edu/content/m11255/latest/
http://www.thinksecret.com
http://lordofthemoon.com
http://www.zeldman.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix_js_enabled_stylesheets.diff
Type: text/x-diff
Size: 6348 bytes
Desc: not available
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20031127/a8549eba/attachment.diff>
More information about the kfm-devel
mailing list