-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Remove unsave inline scripts and styles #1445
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR. My comments vary between discussions and change requests.
- I'd like to see the scripts moved to the panel classes.
- I also feel pretty strongly about moving the check to the
Makefile
. - The comment regarding the
applyStyle
approach is more of a discussion.
.github/workflows/test.yml
Outdated
@@ -220,3 +220,6 @@ jobs: | |||
|
|||
- name: Test with tox | |||
run: tox -e docs,style,readme |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's more appropriate for this check of inline styles or scripts to exist in the Makefile
, then including it here with the other static checks run by tox.
Doing so will also make it easier for developers to run this check before pushing to github and having CI catch it.
@@ -0,0 +1,3 @@ | |||
(function () { | |||
djdt.applyStyle('padding-left'); | |||
})(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd be more in favor of an approach that would find all elements that have a class such as djdt-dynamic-style
, then have it apply the styles listed in the data attribute. That way the javascript doesn't need to know anything about the specific styles that the HTML elements are having applied.
Thanks for the quick feedback. I had tried to simply revert 87364f7 which I now realize was a bit naive. I would like to avoid making |
926f727
to
7bf8686
Compare
Codecov Report
@@ Coverage Diff @@
## master #1445 +/- ##
==========================================
- Coverage 87.68% 86.80% -0.88%
==========================================
Files 29 29
Lines 1591 1591
Branches 224 224
==========================================
- Hits 1395 1381 -14
- Misses 145 153 +8
- Partials 51 57 +6
Continue to review full report at Codecov.
|
7bf8686
to
6f30c88
Compare
@xi I squashed your commits and converted the |
I'm afraid I don't understand how this works. Does ( |
@matthiask There's a brief mention of using the dashed names here in the docs of CSSStyleDeclaration. However, you're right, it's probably best to avoid using the dashed names. |
6f30c88
to
7b97c3c
Compare
I updated the applyStyles function to mention the expected format and switched |
For completeness' sake:
So apperantly |
7b97c3c
to
905e572
Compare
I missed |
Thank you! 🎉 |
Fixes #1248
As a first step I pushed a test. It works locally but I was not sure whether it would work with CI, so I pushed it. I hope that is OK.For some reason CI does not run so I have no clue whether the test I added actually works.