Issue #914Opened February 28, 2018by nojacko3 reactions

[BUG]: Grapes cannot be reinitiated with new HTML

Question

Calling init() on Grapes after changing HTML fails. This kinda situation happens on one page apps.

I think a destory() function to gracefully reset Grapes is needed.

  1. https://jsfiddle.net/wdtrg1je/ (very bare bones simulation of a one page app)
  2. Click "Add Grapes" (loads Grapes with a some HTML)
  3. Click the "Link", change it's href to http://yahoo.com
  4. Click "Remove Grapes". This grabs the HTML from Grapes before destorying the grapes element.
  5. Click "Add Grapes" again. This starts Grapes again with the new HTML which differs from the original HTML.
  6. Error in console.

screen shot 2018-02-28 at 14 54 20

If "Add Grapes" and "Remove Grapes" are clicked without any changes to HTML, it's fine.

Answers (3)

nojackoMarch 2, 20183 reactions

Looks like I'm not the only one who wants this 😉 . Single page apps are where this has value (the issue I raise but also freeing up some memory).

I'll look to raise a PR when I got something.

artfMarch 2, 20180 reactions

As already mentioned here, currently, I don't see any value in starting such a feature (creating a good destroy method) but would really happy to see some PR :)

lock[bot]September 18, 20190 reactions

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.