You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When Drupal loads new elements into the document it provides an API to respond to that. In this case the new elements might contain bulmaJS classes. The problem is that context.querySelectorAll() only checks for children of the context and the BulmaJS bahaviours are not added when I call Bulma.parseDocument(context)
Alternatives
I considered adding the context to the elements but a JS NodeList is a read-only thing.
Additional context
I currently workaround it by passing the parent of the context but this not the most optimal solution as it might be checking children twice.
I can try to provide the PR myself but you seems much more experienced with JS.
BTW: the following phrase in the documentation
Creating a plugin instance via the DOM API is as simple as creating the Bulma component via HTML and classes. The BulmaJS plugin will then pick up the element once it is loaded and set up all of the necessary features.
might create the confusion that BulmaJS is listening to modifications in the DOM. I would suggest something like:
Creating a plugin instance via the DOM API is as simple as creating the Bulma component via HTML and classes. Once the BulmaJS plugin is loaded in the page will then pick up the element and set up all of the necessary features. You are responsible for calling Bulma.parseDocument() if new elements are added after BulmaJS is loaded.
Thank you for such a great project!
The text was updated successfully, but these errors were encountered:
Sorry for the delay in replying. I'm just trying to understand what you're looking for. When Drupal fires the even that new elements have loaded are you not able to do the Bulma.parseDocument on those new elements? I'm assuming it gives you the new elements?
Yes, Drupal gives me all the new elements. What I am facing is when The new element is the one that needs to be parsed that element is ignored by Bulma.parseDocument(newElementWithBulmaClasses). Only the children of the new element will be parsed
Thank you for the suggestion, this has been implemented and is now in master ready for the 0.12 release. Should you wish to try it out please note master is generally not the most stable, however, documentation can be found within the 'master' section of the documentation.
When Drupal loads new elements into the document it provides an API to respond to that. In this case the new elements might contain bulmaJS classes. The problem is that
context.querySelectorAll()
only checks for children of the context and the BulmaJS bahaviours are not added when I callBulma.parseDocument(context)
Solution
Check also the context
Alternatives
I considered adding the context to the
elements
but a JS NodeList is a read-only thing.Additional context
I currently workaround it by passing the parent of the context but this not the most optimal solution as it might be checking children twice.
I can try to provide the PR myself but you seems much more experienced with JS.
BTW: the following phrase in the documentation
might create the confusion that BulmaJS is listening to modifications in the DOM. I would suggest something like:
Creating a plugin instance via the DOM API is as simple as creating the Bulma component via HTML and classes. Once the BulmaJS plugin is loaded in the page will then pick up the element and set up all of the necessary features. You are responsible for calling Bulma.parseDocument() if new elements are added after BulmaJS is loaded.
Thank you for such a great project!
The text was updated successfully, but these errors were encountered: