-
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
Should iframe have setSrcdoc
method?
#117
Comments
It took me a moment to realise what the point of this was, because I forgot that people used |
We've talked about this in our regular check-in and I had a thought that didn't totally convince @otherdaniel: setHTML()
|
This makes some sense to me, but should probably be proposed against whatwg/html instead. @securityMB mind proposing it there? (It does need some thought as to what the actual string ends up being as we don't really want to expose serialization per se. Perhaps the |
I suggest we close this and if there continues to be demand that will hopefully result in someone feeling motivated enough to request it in the proper place (whatwg/html). |
My two cents here are that this should be part of setHTML rather than a new function, and maybe even require an option on the second param. But agree with Anne that for now it's probably fine not to cover?The trusted types API will exist as a fallback security measure for any sinks such as this that aren't covered. Also would the getHTML spec help with the serialization side of things? |
I guess you are combining this with #124 somehow? I'm not really sure how this fits into |
I was referencing a comment above. #117 (comment) (though I realise it might be outdated at this point) |
|
That's an interesting idea, but that would not work for this case: const frame = document.createElement("iframe");
// frame.contentDocument is still null at this point |
How about: const frame = document.createElement("iframe");
frame.src = "about:blank";
document.body.appendChild(frame);
// contentDocument now exists (tested in Firefox and Edge)
frame.contentDocument |
Well sure, but that doesn't seem like what you'd want? |
The current version of the spec extends
Element
withsetHtml
method. Another use-case for sanitization (although less common) is to setsrcdoc
of iframes, for instance:It seems that currently there's no canonical way of doing so in the sanitizer API.
Maybe we should extend
HTMLIFrameElement
withsetSrcdoc
method (similarly tosetHtml
), which would keep in mind thatsrcdoc
is normally being parsed as the document (not as a fragment)?The text was updated successfully, but these errors were encountered: