innerHTML bug

Allan Sandfeld Jensen kde at carewolf.com
Wed Aug 8 21:37:11 BST 2007


On Wednesday 08 August 2007 22:16, Allan Sandfeld Jensen wrote:
> On Wednesday 08 August 2007 16:35, Maksim Orlovich wrote:
> > > I don't remember but I think someone worked on innerHTML recently?
> > > It doesn't seem to reflect changes made to the render tree like it does
> > > with other browsers,
> > > I can't log into ingdirect.fr.
> > >
> > > Testcase attached.
> > >
> > > Basically foo.style.color = "#101065"; works but later on innerHTML
> > > doesn't show that new color.
> > > Any ideas? I'm not sure how CSS changes are applied to both trees...
> >
> > It's a super-weird quirk we don't really implement... When you do this
> > construct it actually changes the style attribute (!). Unfortunately I
> > can't think of a nice way of implementing this :( Obviously
> > special-casing access to ATTR_STYLE over the place would suck, since the
> > attribute code is way complex as-is, and updating the string form would
> > be expensive. Urgh. This needs a notion of a special computed attribute
> > type or something.
> >
> > P.S. Allan: this seems related to what you told me you were planning, no?
>
> No. The test-case is wrong.. Setting foo.style.anything should not change
> the style attribute. foo.style is the calculated style, not the style
> attribute. Maybe the original bug however is related to the bug we talked
> about. The issue is that KHTML forgets any changes made to the style
> whenever the style is recalculated, which can happen when style.display
> changes, or any other time when a user-event triggers a restyle.
>
Oh damn.. Turns out this is only wrong as in grown men dressing up as giant 
gay badgers, not wrong as in that this is not what the other browsers does.

It can probably be implemented pretty simple, and solves the other issue 
partly. Just catch the style property in HTMLElement and return the 
style-attribute generated list of style-rules. The built-in toString should 
just return all the rules as valid STYLE attribute content. The order and 
syntax of the STYLE attribute though would then change from setting it to 
getting it, but that would match Iceweasel.

`Allan





More information about the kfm-devel mailing list