Setting CSS props and timers from JavaScript

David Faure david at mandrakesoft.com
Sun Nov 3 16:13:11 GMT 2002


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sunday 03 November 2002 16:47, Koos Vriezen wrote:
> On Sun, 3 Nov 2002, David Faure wrote:
> > > Another thing is that setting the top property. Now a property is first
> > > removed and than added, marking it as changed trggering a recalcStyle.
> > > Adding 'if (styleDecl.getPropertyValue(prop) == propvalue) return;'
> > > in DOMCSSStyleDeclaration::tryPut does seem to prevent this (but may slow
> > > down cases where propvalue != current value).
> >
> > Hmm, indeed. Which is why it might not be a good idea - in the common case
> > it _is_ different. And if not, the recalc might be intentionnal. Websites which
> > want to do this in a smarter way (for this case where the value is usually
> > unchanged), can query the prop before setting it...
> 
> Yes maybe, but how do you judge the programming skills of an average web
> developer :). I rather protect my CPU for this... 

I don't understand. IMHO this solution makes the common case slower: all the
cases that actually modify the value, will be slower. So this might make things worse,
CPU-wise, on the whole.

> If a developer wants to
> trigger a recalc this way, it probably read the KHTML sources first :)
> And what effect would a recalc have if nothing is changed?

Something else could have been changed first, which didn't trigger a recalc
 - see MS docu on StyleSheet::removeRule (which I implemented but didn't
commit yet, due to my other CSS-related patch waiting for approval...)
What they suggest is elem.innerText=elem.innerText :}

> > [ The real problem IMHO is that there is no DOM event for "scrollbars moved",
> > which such sites could use to move the static thingie, instead of polling :} ]
> 
> IE has onScroll events, which are imo very suitable for this.

Yup, sounds great. So
1) we need to implement it
2) we need to suggest it to the W3C DOM people
3) we can finally ask the "makeStatic" people to rewrite their stuff :)

I think CSS already has some 'static' stuff (as seen on some w3c page iirc),
maybe this would be even better for this?

- -- 
David FAURE, david at mandrakesoft.com, faure at kde.org
http://people.mandrakesoft.com/~david/
Contributing to: http://www.konqueror.org/, http://www.koffice.org/
Get the latest KOffice - http://download.kde.org/stable/koffice-1.2/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9xUsX72KcVAmwbhARAkVgAKCIYclAjTt8Byx75UKpaDSzMaWfEwCcDg/w
0rHB4IgP5jxSIrCg1xLG+6o=
=MP8E
-----END PGP SIGNATURE-----





More information about the kfm-devel mailing list