W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2014

[editing] insertHorizontalRule into <p> while its ancestor is non-editable

From: Marta Pawlowska <m.pawlowska@samsung.com>
Date: Thu, 20 Mar 2014 17:38:13 +0100
To: ayg@aryeh.name
Cc: public-webapps@w3.org
Message-id: <01c301cf445a$c9dfb360$5d9f1a20$%pawlowska@samsung.com>
Hello Aryeh,

I've encountered lately problem with algorithm for
<https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html#the-inserthorizont
alrule-command> insertHorizontalRule when ancestor of an elements (<p>)
parent is not editable and I need to put <hr> there. 

 

Problem:

What to do when you want to insert <hr> in <p> element however its (<p>'s)
ancestor is not editable?

 

Specification:

According to my interpretation of the specification when inserting line into
text on below test case final effect would be:
 

<body>

   <p id="text" contenteditable="true">

      Simple text1.

   </p>

   <hr>

   <p id="text" contenteditable="true">

      Simple text2.

   </p>

</body>

 
This is my problem! Now <hr> is embedded into <body> which is non-editable.
However this is not entirely logical to move element from editable parent
into non-editable parent, you need to consider undo operation here also.
 
Specification details that lead me to my conclusions:
 
<https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html#the-inserthorizont
alrule-command>
https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html#the-inserthorizonta
lrule-command
-> step 2. If "p" is not an allowed child of the editing host of node, abort
these steps. 
  -->
<https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html#fix-disallowed-anc
estors>
https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html#fix-disallowed-ance
stors <-- p is not allowed child of p
-> step 4: While node is not an allowed child of its parent, split the
parent of the one-node list consisting of node. 
  --> split the parent:
    --->
<https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html#split-the-parent>
https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html#split-the-parent

 

 

TC: 

<html>

    <head>

        <script type="text/javascript">

            window.onload = function()

            {

              var text_input = document.getElementById( "text" );

              

              text_input.focus();

              text_input.select();

            }

        </script>

    </head>

 

    <body>

        <button onclick="document.execCommand( 'insertHorizontalRule',
false, null );">insertHorizontalRule</button>

 

        <p id="text" contenteditable="true">

            Simple text1.

      Simple text2.

        </p>

    </body>

</html>

 

 

Could you point errors in my logic or any solution you have described in
spec but I did not found it? 

 

 

Best regards,

Marta
Received on Thursday, 20 March 2014 16:38:50 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:14:22 UTC