-
Notifications
You must be signed in to change notification settings - Fork 40
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
Edit text outside of <body> #405
Comments
FYI: Not only for |
@masayuki-nakano Edit: I did find a way to do this (see next comment). <!DOCTYPE html>
<html>
<head></head>
<p>cellow</p>
<body contenteditable="true">
<h1>hello</h1>
</body>
<h2>mellow</h2>
</html> But that is being normalized into this in Chrome: <!DOCTYPE html>
<html>
<head></head>
<body contenteditable="true">
<p>cellow</p>
<h1>hello</h1>
<h2>mellow</h2>
</body>
</html> And this in Firefox: <!DOCTYPE html>
<html>
<head></head>
<body>
<p>cellow</p>
<h1>hello</h1>
<h2>mellow</h2>
</body>
</html> |
I did find a way to do this:
The question is whether this is something that is actually needed for anything. |
@Comandeer @spocke Are there situations where you could see that this would be useful for editor projects? To let the user edit the contents of an element that is outside of the |
execCommand
outside of <body>
@johanneswilm Web apps needs to create the odd situation, which cannot be created by users. There are some possible scenarios: Make the root editable and insert visible elements around
|
Yes, it is. (Correct answer is "no", see #405 (comment)) |
@masayuki-nakano Can you give example of how those other cases work? I can see that it is possible to put an element before or after |
What is it useful for? I've tagged people from two of the main editor projects. Hopefully one of them can shed light on what, if anything, they need to use it for. |
Oops, sorry, I misread your comment. My answer is "no". These things may happen if web apps use tricky approach which shouldn't be used.
For example to make |
Indeed, this is possible: <!DOCTYPE html>
<html contentEditable="true">
<head>
<title>The title</title>
<style>
head, style, title {
display: block;
}
style, title {
white-space: pre;
}
</style>
</head>
<body>
<h1>body</h1>
</body>
</html> |
The only case I found for editables outside the I understand the need for supporting old versions of CKEditor 4 but I think that the current level of support for editing outside the |
One question here is what |
I've not tested enough for multiple |
Should browsers allow using
execCommand
outside the<body>
? If yes, then that behavior should be specced. There is a proposal on what such behavior should look like [1]. Alternatively, we could specify thatexecCommand
should not work outside of<body>
. See discussion on pro- and contra starting here [2].[1] web-platform-tests/interop-2022-editing#8 See "Tests inserting paragraph and delete in elements outside "
[2] web-platform-tests/interop-2022-editing#8 (comment)
The text was updated successfully, but these errors were encountered: