silexlabs / Cocktail

An HTML/CSS rendering engine for the Haxe language
http://www.silexlabs.org/haxe/cocktail/
Other
192 stars 34 forks source link

innerHTML doesn't seem to work in loops / events #385

Closed clemos closed 10 years ago

clemos commented 11 years ago

One more very weird thing :) innerHTML seem to work only during the "onload" call stack. I can't seem to make it change anything in the DOM in response to a user event or in a timer loop: the node just doesn't change at all. I've attempted to fix what seemed weird to me here : https://github.com/clemos/Cocktail/commit/e3bd59d92a9aca3b86a3dee47b10167080b9bff0 But this doesn't seem to solve anything...

Do you have any idea what might happen ?

yanhick commented 11 years ago

This is a tricky one, this is probably just a small regression, but I don't see anything obvious and I'm sure it used to work. In this case, it is necessary to remove the dom elements in reverse order by removing index 0 until it is empty because of the element renderer tree, though I don't remember the details.

You can first make sure that :

clemos commented 11 years ago

Ok right, I reverted my "fix".

As for the actual issue : Yes, both get called. Actually if you change any other property at the same time, such as elem.style.backgroundColor, it works...

I'll try to come up with a minimal reproductible example ASAP.

yanhick commented 11 years ago

Yes an example will be useful !

I think it's probably an issue with attachement/detachement of the rendering tree. More info here : http://www.silexlabs.org/haxe/cocktail/cocktail-technical-articles/the-rendering-tree/

yanhick commented 10 years ago

I was able to reproduce the bug while working on the video sample, and I fixed it, at least for my test case. You can pull the bug fix from the master branch.

clemos commented 10 years ago

Awesome ! I confirm it fixes my issue as well.

yanhick commented 10 years ago

Good to know ! That was a bad regression. Also, I've closed all the issues by mistake, I'm reopening those not fixed but I may miss some.