-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Goals
- improve performance
- reduce technical debt
- enable the use of CSP
Possible solutions
- since Trix's overall usage of JavaScript is limited, perhaps we could replace jQuery and Angular with more limited approaches such as HTMX and Alpine.js; they are also more appropriate for our update cadence
Tasks
- eliminate the use of inline styling
eliminate the use of inline scripts✔️- avoid use of
eval()functions
Inline styling:
✔️trix/trix_admin/templates/trix_admin/assignments/preview.django.html✔️trix/trix_admin/templates/trix_admin/editor/markdown_help.django.html✔️trix/trix_admin/templates/trix_admin/roleselect.django.html✔️*trix/trix_admin/templates/trix_admin/statistics.django.html+../include/progress_bar.django.html✔️trix/trix_course/templates/trix_course/add_course_admin.django.html✔️trix/trix_course/templates/trix_course/course_admin.django.html✔️trix/trix_student/templates/trix_student/assignment_list_base.django.html✔️ (removed)trix/trix_student/templates/trix_student/consent_form_base.django.html✔️trix/trix_student/templates/trix_student/include/assignment.django.html- inlined styling is added on the bottom of the course statistics page by angular-hotkeys (via cradmin_legacy)
(* Inline styling is removed from /trix_admin/statistics.django.html, but that has caused (at least) two changes:
- the table header styling now has working directional arrows («A-Z indicators») 🎉
- the course tag has a nonfunctional
X(should only be displayed on optional tags) ❌)
Inline scripts:
✔️trix/trix_admin/templates/trix_admin/statistics.django.html✔️ (removed)trix/trix_student/templates/trix_student/assignment_list_base.django.html
HTMX features that rely on eval() are:
- event filters
hx-on:attributeshx-valswith thejs:prefixhx-headerswith thejs:prefix
Note that all features removed by disabling
eval()can be reimplemented using your own custom javascript and the htmx event model.