Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jaccokrijnen opened this issue Nov 17, 2013 · 3 comments
Closed
Milestone

Comments

@jaccokrijnen
Copy link

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:

  • add to <body> in wwwroot/chat.html:

    <div class="test">  
    </div>
    
  • replace in setup src/Chat.hs:

    getBody window #+
    

    by

      first <- head <$> getElementsByClassName window "test"
      element first #+
    
@HeinrichApfelmus
Copy link
Owner

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
Copy link
Owner

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

@HeinrichApfelmus HeinrichApfelmus added this to the 0.6 milestone May 2, 2015
@HeinrichApfelmus
Copy link
Owner

The aforementioned commit will be part of the 0.6 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants