Skip to content
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

[search addon] Make compatible with Trusted Types #6746

Closed
wants to merge 2 commits into from

Conversation

vrana
Copy link
Contributor

@vrana vrana commented Jul 20, 2021

https://web.dev/trusted-types/ doesn't allow string innerHTML assignments. This change avoids it by using DOM instead.

https://web.dev/trusted-types/ doesn't allow string innerHTML assignments. This change avoids it by using DOM instead.
@marijnh
Copy link
Member

marijnh commented Jul 20, 2021

This looks good, in general, but would you be open to adding a feature to el where you can pass children as extra arguments, so that the code gets a bit less verbose? Something like

for (let i = 2; i < arguments.length; i++) {
  let child = arguments[i]
  element.appendChild(typeof child == "string" ? document.createTextNode(child) : child)
}

@vrana
Copy link
Contributor Author

vrana commented Jul 20, 2021

Done.

marijnh added a commit that referenced this pull request Jul 20, 2021
@marijnh
Copy link
Member

marijnh commented Jul 20, 2021

Merged as 68d3399, updated in 3362178 (there was an undefined reference to dialogText in the replace code)

@marijnh marijnh closed this Jul 20, 2021
@vrana
Copy link
Contributor Author

vrana commented Jul 21, 2021

Thanks.

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.

None yet

2 participants