Duplicate BODY element created when Enter key is pressed twice

    General discussion

  • It is very easy in an editable document to accidentally get two BODY elements in both IE and Edge.

    Steps to recreate

    1. Create an HTML file containing this snippet:  

    <body contenteditable="true">

    2. Open the file with Internet Explorer or Edge.

    3. Press F12 to view the DOM.

    4. Set the cursor to after the three dashes "---".

    5. Press the Enter key twice.  Voila - you now have a document with TWO BODY elements! 


    Friday, December 15, 2017 10:48 PM

All replies

  • Hi dougthfiddler, 

    I notice that you use contenteditable, this property feature is it will create a same element.

    If you add this property in element p, it will divided the content into two elements p.  

    So if two body elements effect the page, you could set this property in element p. 

    Best Regards,

    Eric Du

    Friday, December 22, 2017 7:02 AM