-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
breaks when <script> tag is inside nested_fields block #46
Comments
Using script tags inside nested fields breaks, because nested_form_fields uses script tags to store the nested fields blueprints/templates. Nesting script tags within script tags breaks the html. See also the comment here in line 84: https://github.com/ncri/nested_form_fields/blob/master/lib/nested_form_fields.rb It's a bit tricky. Using inline js is not the best coding style anyway. Better use an external js file and the callbacks nested_form_fields provides. |
That’s what I figured. The reason for having inline js is accidentally the same reason nested_form_fields has inline js: to store a template (https://github.com/tomasc/simple_form_attachments). But yeah that’s a bit tricky. How about escaping the html? Quite hackish I guess :) |
Ah, that is unfortunate. I might try to make script tags work inside nested fields when I have some time, but so far it's a limitation of gem. Feel free to hack the js, it is not much code but hacking it is tricky because nested_form_fields supports deep nesting. In fact the whole gem is a bit of a hack. Ideally we should use the html5 template tag instead of script tags I guess. But that is not supported in IE/Edge. |
I'm using an input which appends a script tag to the input. This breaks the
nested_fields
<script>
tag and the view.It should be super easy to reproduce the bug, simply add a script tag to the
nested_fields
block, but I can provide example code if necessary :)The text was updated successfully, but these errors were encountered: