-
Notifications
You must be signed in to change notification settings - Fork 31
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
Consider an append/insert variant #132
Comments
Hm, not sure yet. Though I do want to point out that some of the this could be easily done without adding yet another function:
Let's hear what the others think.. |
In practice, it's probably only |
@mozfreddyb You could do that, but it has issues:
You can also work around it by using |
|
@koto - |
So, I think there is a need for better HTML APIs regardless of the Sanitizer API. |
In the meantime, I think developers might call |
@mozfreddyb - I don't understand your point about better HTML APIs and solving this elsewhere. The DOM already has this ( Re Let's hear what others think. |
Personally, as a user, using |
Adding |
Oh, let's fold this into #184. |
Very excited to see this Sanitizer API!
If
.setHTML(x)
is, in some sense, the new.innerHTML = x
, it probably makes sense to handle the common use case that is currently often (unfortunately) handled with.innerHTML += x
(but without the antipattern round-trip through markup).Perhaps
insertHTML
, accepting the sameposition
argument thatinsertAdjacentHTML
takes:It may need to throw if called with
position
set to"beforebegin"
or"afterend"
if the element it's called on doesn't have a parent (yet), since as I understand it the sanitizer needs to know what element it's sanitizing for.Example:
It's tempting "just" to add a third optional argument to
insertAdjacentHTML
, butsetHTML
sanitizes whether it has that sanitizer argument or not, whereasinsertAdjacentHTML
doesn't, so probably best if it's separate.(Apologies if I've missed previous discussion on this, as seems likely. Didn't find anything relevant in the issues or Q&A.)
The text was updated successfully, but these errors were encountered: