Skip to content

Remove inline Javascript, part I #9513

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

Draft
wants to merge 3,830 commits into
base: master
Choose a base branch
from
Draft

Conversation

pabzm
Copy link
Member

@pabzm pabzm commented Jun 21, 2024

As part of #9508 here's a change that removes add_script() and transports js_commands in JSON, which then gets interpreted as callbacks to call with given arguments, instead of evaling strings.

This does not tackle the many inline event handlers, in order to keep it manageable.

alecpl and others added 30 commits February 9, 2024 21:11
* enable phpstan bleading edge

* gen baseline using CI

* Revert "gen baseline using CI"

* fix baseline

* enable phpstan strict rules

* gen baseline using CI

* Revert "gen baseline using CI"
pabzm added 21 commits September 5, 2024 14:41
This allows to call it on specific elements only, e.g. after they've
been inserted late to the DOM.
There's no apparent reason for them to be static, and no explanation,
but as instance methods they are directly callable from the de-inlined
event-handlers and we save some helper methods, which is good.
This make it easier for the calling code.
Have to repeat attaching event handlers after a clone().
This allows to strip 'unsafe-eval' from the CSP.
innerHTML requires 'unsafe-eval' in the CSP, while innerText doesn't.
If the last argument to a data-on* attribute is an object (associative
array in PHP), it is used as options, which allow to specify if
preventDefault() should be called on the event.
This is relevant for some parts of the code and got lost in previous
changes.
@pabzm pabzm force-pushed the extract-inline-js branch from 72cfd49 to fedc7d2 Compare September 5, 2024 12:41
@pabzm
Copy link
Member Author

pabzm commented Sep 5, 2024

(Rebased to latest of "master")

@pabzm
Copy link
Member Author

pabzm commented Oct 30, 2024

@alecpl I would really appreciate if you would take the time to reply again on this topic. Just getting the ball dropped is a pretty frustrating collaboration experience.

@alecpl
Copy link
Member

alecpl commented Nov 19, 2024

I'll need more time. Maybe @johndoh have some thoughts on this.

Copy link

github-actions bot commented Dec 4, 2024

@pabzm, @alecpl
🛎️ This PR has had no activity in two weeks.

@pabzm pabzm force-pushed the extract-inline-js branch from fedc7d2 to b737876 Compare February 20, 2025 10:05
@pabzm pabzm marked this pull request as draft February 20, 2025 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support CSP nonces in message frames so that unsafe-inline isn't required.