Closed mrdotb closed 1 year ago
Thanks for the idea / contribution.
I haven't pulled this down to check it out yet. But, do have 2 questions.
If so, should we offer backwards compatibility? Realize this isn't a massive lib, but, still.
Am I missing something? Or, is your solution better?
Will take look when I get a sec later.
Thanks!
1.It's not a breaking change.
2.It's not possible to solve my issue without changing the generated ID or changing the logic to find the ID.
I have the following scenario where I need to create two readsmore one after the page is loaded another one after an Ajax request.
This produces two identical ID.
ReadSmore(el).init()
-> create a link with an ID {blockClassName}_{iterator}
link_0
-> creating a new dom after Ajax req
-> ReadSmore(el).init()
create a link with an ID {blockClassName}_{iterator}
link_0
Using the internal state to retrieve the link dom instead of an ID seems appropriate.
Okay. I see now.
Makes sense.
Thanks!
Hello,
Thanks for the lib :+1: I'm using it and a website which is not static. I notice that calling
ReadSmore(el).init()
two time in a page create duplicate link id which break the attachment of the event listener.I replaced the logic that rely on an id by using the internal state and nextSibling.