Re: Cleaning House

Daniel Glazman:
> Christoph Päper wrote:
>
>> Acceptable (perhaps):
>> : <h2>Foo bar <i>baz</i> quuz!</h2>
>> Inacceptable:
>> : <h2><i>Foo bar baz quuz!</i></h2>
>
> Christoph, please don't be upset by the following :

My calmness is that of a Buddhist monk, usually.

> your comment above just shows a total lack of consideration for  
> wysiwyg editors...

I confess I did not have them in mind in particular when I wrote  
that. I stand by it nevertheless.

> What you consider inacceptable above is the only way to preserve  
> italic
> text in an h2 with a cursor position generating normal text.
>
> 1. the user creates a new h2, clicks on the I button, enters some  
> text,
>    clicks again on the I button, enters mors text. Expected result:
>
>    <h2><i>bar</i>foo</h2>

This is not how I think WYSIWYG editors (for Web content) should  
work. If you press the 'I' button the highlighted portion of text  
should be wrapped between |i| tags (provided that no outer element  
borders are crossed). If nothing is currently highlighted there are  
two options imo.: either nothing happens, i.e. the button should not  
have been active in the first place, or the style of the (nearest  
(block)) element enclosing the caret is changed to italic.

   <h2>|</h2>
   <h2 style="font-style: italic">|</h2>
   <h2 style="font-style: italic">bar|</h2>
   <h2>bar|</h2>
   <h2>barfoo|</h2>

(I assume the button toggles, because otherwise you'd need a second  
one. I'm using the |style| attribute, which I dislike, here for  
brevity.)

I'll continue with the expected result under your paradigm. I  
considered such markup to be a valid possibility after all.

> 2. then the user places the caret after "foo" and hits three times
>    backspace. In my mind the result is:
>
>   <h2><i>bar</i></h2>

It is and it is the degenerate case of what I called acceptable. If  
one wants second-level headings to appear italic otoh., |i| is wrong  
and HTML generating software should not promote that wrong behaviour.

I think you didn't get my point. If you did, I didn't get yours.

>   AND the caret is placed just after the I element inside the H2.
>        </i>|</h2>
>   One more hit on the backspace key, and the caret is inside the I
>   just before its end  |</i></h2> or it deletes the last char inside
>   the I and places the caret before that position. It's a rather
>   religious choice, depending on how much you want your editor to
>   behave like a text processor.

I guess most users expect backspace to delete /something/ left of the  
caret, but my experience with WYSIWYG markup editors is small. Three  
other possibilities are to delete the end tag or the element  
altogether, including or excluding its textual content. In a  
"structural editor" I would expect the third one, i.e. deletion of  
start and end tag.

>   In your mind, it's probably something like
>
>   <h2 style="font-style: italic">bar</h2>
>
>   there is no ambiguity on the caret's position,

That's a good thing, right? Nevertheless, the point can be made about  
other inline elements, semantic ones, as well.

>   and there's no possibility to enter normal text directly.

With "normal" you mean upright (or roman), I assume, because that  
"bar" is "normal" text in my eyes and can easily be extended.

There is no element type in HTML to mark the normal state, because  
that's not how enclosing markup works.

If there was, in CSS, something like

   font-style: toggle(italic, normal);

you could use |i| or a better fitting element, of course. After all  
there would be a reason to make some parts of the text look different  
than the rest.

Received on Sunday, 6 May 2007 20:03:11 UTC