Closed shubik22 closed 3 years ago
Hi Sam!
Thanks for bringing this to our attention. 'coupla things:
Now, I understand that "it's complicated" - this is the syntax pushed by libraries like Alpine, standards be damned. Here's the olive branch I can extend: if you can show me the functionally equivalent Nokogiri code that doesn't choke on this HTML-adjacent markup, I'll try hard to figure out a way to give you an escape hatch that you can call with an option.
Thanks for the detailed reply @leastbad, point taken about passing invalid HTML. Given an alternative solution exists (not using invalid HTML and using x-on:click instead), I'm happy to just close this issue and move on. The one thing I'm wondering is if you think it makes sense to note somewhere in the docs that the HTML passed to morph must be valid HTML? I'm happy to put out a PR doing that (maybe adding a note to the Morphing Sanity Checklist), please let me know what you think.
And I upgraded to the new SR/CR versions, thanks :)
Right on. 👍
We can't actually accept documentation PRs due to silliness with our documentation system, but I will see if I can work in something about how HTML has to be HTML. 😉
Awesome, thanks so much.
Hey Sam, I almost forgot: there's a non-zero chance that https://github.com/stimulusreflex/stimulus_reflex/pull/492 might have fixed this issue. YMMV! Clearly, you succeeded regardless. 🥇
Bug Report
Describe the bug
I came across this issue when passing HTML with an Alpine.JS @click attribute to a selector morph.
A simplified example:
The HTML received by the client was
"<div true></div>"
.I believe this is due to these lines and the use of Nokogiri:
There's a pretty straightforward workaround for my situation (using x-on:click instead of @click), but I just wanted to file this bug as the behavior described above seems a bit unexpected and SR may want to support the use of those types of attributes.
To Reproduce
Call a selector morph with an @click attribute.
Expected behavior
The HTML received by the client should match what's passed to the selector morph serverside.
Versions
StimulusReflex