Re: [editing] What caret positions do we need to allow? (#51)

> > 2. After any inline element that is not a text node.

> If we allow this caret location, and cE=typing inserts characters by default on typing that means we have to allow cE=typing to insert DOM text nodes in our content as needed. Is that correct?

Correct. If we allow the insertion of characters, we need to create text nodes if they don't exist beforehand.

I had been thinking of the alternative first: only allow the caret in places where there already are text nodes. I think this should also work in cases where one is creating new content. 

The problem I see with that is what happens if the user saves a document and reopens it. I would guess that in most cases editors would save the DOM structure as HTML. So all empty text strings will be lost and have to be manually recreated when document is reloaded to make sure that the caret can go in these places.

And these empty text nodes will have to be insertted quite a lot of places. For example, in between elements if we want the caret to be able to go there:

```
<img ...>|<img ...>
```

| = caret

or 

```
<i>|</i>
```

Altogether I think it would make most sense if we don't let cE=typing create any new content by default and instead only create intentions (this is what the specification currently says). Also notice that the default caret movement behavior that was previously proposed, and the "legal caret positions" are not the same thing: The default movement would not move it into all the positions that the caret could be put in by means of legal caret positions.


> > The caret cannot be placed inside, before or after a `comment node` or a node that has it's display-value set to `none`.

> Why can't you place the caret before or after something that is invisible?

> ` abc<span style="display:none">ghost content</span>def`

>With that rule it means I can't place the caret between `c` and `d`.

Right, I guess the wording is not very good. I tried to make sure that the same position would not be mentioned twice (these positions are already mentioned as before the first or last characters in the sibling text nodes), but I understand that the current wording may also be interpreted as saying that the caret cannot be put in these positions at all. I will try to reword this to make sure this isn't misunderstood.


---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/editing/issues/51#issuecomment-111752249

Received on Saturday, 13 June 2015 20:58:43 UTC