Sparnatural
Sparnatural copied to clipboard
Analyse the feasibility to remove the dependency to JQuery
document.getElementsByClassName
+ Array.prototype.forEach.call(..., function(el) { ... }
should give good replacement for most of JQuery usages
FYI @SteinerPascal - a few months ago I had a discussion with folks at https://semapps.org/fr/ that also wanted to integrate Sparnatural in React, but were reluctant to do so because Sparnatural is using JQuery and - as they explained to me - JQuery does not live well with React.
If you have any insights about this or if you have some conclusions on how well Sparnatural can be integrated with React, please don't hesitate to share them here. Thanks.
Hey thanks for the input. I just did a quick research. I can see that it is dangerous to use JQuery and React together. If they both manipulate the same HTMLElements, then they will override each other and leave the application state inconsistent. The only "real" way would be to rewrite the whole thing into react i guess. But I think it will be possible to use it in a React App if you just put the Sparnatural into a "Box" and let it run by itself. You just have to make sure React doesn't rerender Sparnatural. I will definitely test it =)
@tfrancart : Idée, pour peu à peu remplacer jQuery et ne pas continuer à l'utiliser dans nos développements.
Ici exemple de code portable pour créer à la volée un objet node HTML (très utilisé dans nos scripts):
const placeholder = document.createElement("div");
placeholder.innerHTML = html;
const node = placeholder.firstElementChild;
Pourrions nous commencer par créer des fonctions globales "helpers" facilement accessibles dans les scripts ?