Closed Bug 1777904 Opened 2 years ago Closed 2 years ago

Add tentative WPT for checking the handling of `insertParagraph` in elements outside `<body>`

Categories

(Core :: DOM: Editor, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
104 Branch
Tracking Status
firefox104 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

(Blocks 2 open bugs)

Details

Attachments

(1 file)

Web apps sometimes insert <div> or something outside <body> element. Currently, I know it's used for only temporarily, e.g., for a placeholder of pasting content.

On the other hand, we sometimes get bug reports about editing outside <body>, for example, <title> and <style>. Currently, our HTMLEditor does not support editing outside <body> for avoiding to delete important elements and to avoiding to create odd DOM tree. However, this is also a potential web-compat risk. So for when we work on supporting it, we need a rough design of how to handle it.

There are some cases which may put <div> elements outside <body> especially when the document type is XHTML etc. For backward compatibility, I think that we should keep allowing browsers split/join normal elements which are visible in <body> by default, however, we should not allow to delete <head>, <body>, <script>, <style>, <meta>, <title>, <link> by users' operation.

I think that these edge cases are not reasonable for any web apps, but browsers
need to take care for avoiding odd result including crash.

I believe that the simplest approach is, elements which are children of <html>
or <head> should be treated like as <body> which is never unwrapped nor
joined with the other elements. However, the behavior is incompatible with
browsers, so doing it may break existing web apps.

Therefore, I think that the reasonable approach is, browsers should split
normal elements which is usually visible and appear in <body> should be
split even if they are outside the <body>. However, some special elements
such as <style> and <script> which may be appear in <head> but usually
invisible and affects entire the document should not be split.

The following patch adds delete/join cases.

Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/0c0cf642957c Add tentative WPT for checking the handling of `insertParagraph` in elements outside <body> r=m_kato
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/35218 for changes under testing/web-platform/tests
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 104 Branch
Upstream PR merged by moz-wptsync-bot
No longer depends on: 1777660
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: