-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Write title as innerText instead of innerHTML #3173
base: dev
Are you sure you want to change the base?
Conversation
Are you able to run the test suite? Let me know if you need any help! |
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.
lgtm!
fyi I can't approve the PR, just trying to help other contributors :)
Edit: as @Telroshan pointed out, this should still be .innerText
, the type cast just makes it treat titleElt
as an HTMLElement
instead of the Element | null
type that is output by find()
.
I need more sleep.
I must admit I'm a bit confused here ; Moreover, the PR mentions replacing Could you also share the ouput of the failing security checks you mentioned in the PR description? |
@Telroshan The first commit changed You're right that Agreed it would be nice to have the output of the failing security test. |
8ec2d75
to
8f85142
Compare
Okay, so I accidentally rebased The fix is in now, but the tests are failing since the type casting didn't seem to do the trick. Either I get
Or if I move the type cast to where
|
Well, I borked the commit history obviously... I'll see what I can do to fix it.. |
Ok I see, thanks for the screenshot Tbh, this kind of warning is kinda a lost cause regarding htmx as we support As for the property itself, I would maybe recommend
|
Some security checks are grumpy when using innerHTML. Using innerText instead calms them. Signed-off-by: Emil Hemdal <[email protected]>
As for the branch, you would indeed want to rebase to |
8f85142
to
c16d1f2
Compare
Also remove type hinting/casting since it is no longer needed Signed-off-by: Emil Hemdal <[email protected]>
Done! Thanks @Telroshan ! :) |
One benefit to this change is it's one less usage of a Trusted Types sink that will need handling if HTMX ever wants to support running in Trusted Types enforced environments. |
Description
Changing the title update to use
innerText
instead ofinnerHTML
calms some security checks such as GitHub's own code checking.tsc
is grumpy now though with the errorProperty 'innerText' does not exist on type 'Element'.
Not sure if i agree with
tsc
fully.Checklist
master
for website changes,dev
forsource changes)
approved via an issue
npm run test
) and verified that it succeeded