HeinrichApfelmus / threepenny-gui

GUI framework that uses the web browser as a display.
https://heinrichapfelmus.github.io/threepenny-gui/
Other
439 stars 77 forks source link

The `getElementsBy..` functions do not work with a custom HTML file #60

Closed jaccokrijnen closed 9 years ago

jaccokrijnen commented 10 years ago

getElementsByClassName is giving me problems. When calling it, I get the following error:

user error (Pattern match failure in do expression at Graphics/UI/Threepenny/Core.hs:143:5-15)

To reproduce:

HeinrichApfelmus commented 10 years ago

Thanks a lot for the report! Turns out that this is essentially the same issue as #59.

It occurs to me that version 0.3 has a fundamental problem with garbage collection of elements when using a custom HTML file. The problem is that I want to represent all DOM elements on the server side in order to use the Haskell runtime to keep track of garbage. However, the server currently only keeps track of DOM elements that it has created itself, and ignores all those in a custom HTML file.

The only workaround I can think of right now is to create the HTML DOM via the UI.div combinators etc. Sorry about that!

HeinrichApfelmus commented 9 years ago

As of commit ca8c84b277a4257e5a0e404f2fa10122c757c2a5, the getElementsById function and its friends should work again.

HeinrichApfelmus commented 9 years ago

The aforementioned commit will be part of the 0.6 release.