Skip to content

Commit 3dedc6e

Browse files
authored
Fix warnings from tidy-html (#113)
This change is editorial. Fix warnings reported by [Tidy](https://github.com/w3c/edit-context/actions/workflows/tidy.yml). Slightly change wording in Abstract.
1 parent 2632c28 commit 3dedc6e

File tree

1 file changed

+37
-41
lines changed

1 file changed

+37
-41
lines changed

index.html

+37-41
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,9 @@
5757

5858
<body>
5959
<section id='abstract'>
60-
<p>The {{EditContext}} is a new API that allows authors to more directly participate in the text input process.</p>
61-
</section>
62-
<section id='sotd'>
63-
<p>
64-
</p>
60+
<p>{{EditContext}} is an API that allows authors to more directly participate in the text input process.</p>
6561
</section>
62+
<section id='sotd'></section>
6663
<section>
6764
<h2>Introduction</h2>
6865
<section id="background" class="informative">
@@ -110,7 +107,7 @@ <h4>EditContext state</h4>
110107
<li><dfn>selection start</dfn> which refers to the offset in [=text=] where the selection starts. The initial value is 0.</li>
111108
<li><dfn>selection end</dfn> which refers to the offset in [=text=] where the selection ends. The initial value is 0. [=selection end=] may be less than [=selection start=] in the case of a "backwards" selection (in reverse of document order).</li>
112109
<li><dfn>is composing</dfn> which indicates if there is an active composition. The initial value is false.</li>
113-
<li><dfn>composition start</dfn> which refers to the offset in [=text=] representing the start position of the text being actively composed. The initial value is 0.</p></li>
110+
<li><dfn>composition start</dfn> which refers to the offset in [=text=] representing the start position of the text being actively composed. The initial value is 0.</li>
114111
<li><dfn>composition end</dfn> which refers to the offset in [=text=] representing the end position of the text being actively composed. The initial value is 0. [=composition end=] must always be greater than or equal to [=composition start=].</li>
115112
<li><dfn>text formats</dfn> which is an array of [=text format=]. The array is initially empty.</li>
116113
<li><dfn>control bounds</dfn> is a {{DOMRect}} describing the area of the viewport in which [=text=] is displayed. It is in the [=client coordinate system=] and the initial x, y, width, and height are all 0.</li>
@@ -178,7 +175,6 @@ <h4>Association and activation</h4>
178175
{{HTMLElement/editContext}} property will prevent the element from being garbage
179176
collected until the property is cleared or the {{EditContext}} is garbage collected.
180177
</p>
181-
</p>
182178
<p>
183179
If an {{EditContext}}'s <a>associated element</a>'s
184180
<a href="https://dom.spec.whatwg.org/#concept-tree-parent">parent</a> is not
@@ -228,7 +224,7 @@ <h4>Association and activation</h4>
228224
[=Handle Input for EditContext=] given the [=EditContext editing host=] .
229225
</p>
230226
<h4 id="edit-context-differences">Differences for an EditContext editing host</h4>
231-
<p>
227+
<div>
232228
<p>
233229
In many ways, an <a>EditContext editing host</a> behaves in the same way as other types of [=editing host=],
234230
e.g. for a [^html-global/contenteditable^] element. Notable similarities include:
@@ -262,7 +258,7 @@ <h4 id="edit-context-differences">Differences for an EditContext editing host</h
262258
event as specified in [[uievents]].
263259
</li>
264260
</ul>
265-
</p>
261+
</div>
266262

267263
<h4>EditContext events</h4>
268264
<p>
@@ -321,18 +317,18 @@ <h4>Event loop changes</h4>
321317
<h4>Examples</h4>
322318
<p>Using an {{EditContext}}, an author can mark a region of the document editable by <a data-lt="associated element">associating</a> an {{EditContext}} object with an element as shown in the example below: </p>
323319
<aside class="example" title="Associate an EditContext with an Element">
324-
<pre><xmp><script type="module">
325-
let canvas = document.querySelector("canvas")
326-
canvas.editContext = new EditContext()
327-
// When the associated element is focused, the EditContext is automatically activated.
328-
canvas.focus();
329-
</script>
330-
<canvas></canvas></xmp></pre></aside>
320+
<pre>&lt;script type="module"&gt;
321+
let canvas = document.querySelector("canvas")
322+
canvas.editContext = new EditContext()
323+
// When the associated element is focused, the EditContext is automatically activated.
324+
canvas.focus();
325+
&lt;/script&gt;
326+
&lt;canvas&gt;&lt;/canvas&gt;</pre></aside>
331327

332328
<p>In the example below, the author is using a canvas to draw an editable region that allows the user to input a single line of text rendered with a monospace font. The text for the editable region is maintained by the author as a String. The text offsets for the selection in the editable region are maintained by the author as a pair of Numbers: selectionStart and selectionEnd. The Numbers refer to the count of the number of UTF-16 codepoints to the left of the start and end of the selection respectively. For the sake of communicating the bounding boxes for the current selection and the editable region of the document to Text Input Services, the author also computes the bounding rectangle in CSS pixels for the selection and the editable region of the document. The offset of the rectangle is expressed relative to the origin of the canvas element since that is the element to which the author has <a data-lt="associated element">associated</a> an EditContext. Since the model for the author’s representation of text and selection location matches the form expected by the EditContext API, the author can simply assign those properties to the EditContext <a data-lt="associated element">associated</a> with the canvas whenever those values change. </p>
333329

334330
<aside class="example" title="Using EditContext with editing model, view, and controller">
335-
<pre><xmp><script type="module">
331+
<pre>&lt;script type="module"&gt;
336332
// This example is built on top of example 1.
337333
// Only the added logic is shown here for brevity.
338334
class EditingModel {
@@ -400,8 +396,8 @@ <h4>Examples</h4>
400396
editingView, canvas.editContext);
401397

402398
editingController.render()
403-
</script>
404-
<canvas></canvas></xmp></pre>
399+
&lt;/script&gt;
400+
&lt;canvas&gt;&lt;/canvas&gt;</pre>
405401
</aside>
406402

407403
<p>Building on the previous example, in response to user input, authors should handle the events of both the editable element (in this case a canvas) and the EditContext.</p>
@@ -410,7 +406,7 @@ <h4>Examples</h4>
410406

411407
<p>The below example shows how to handle {{TextUpdateEvent}}, {{TextFormatUpdateEvent}}, and {{CharacterBoundsUpdateEvent}} to update the model and render the result to the canvas.</p>
412408
<aside class="example" title="Event handlers for TextUpdateEvent, TextFormatUpdateEvent, and CharacterBoundsUpdateEvent">
413-
<pre><xmp><script>
409+
<pre>&lt;script&gt;
414410
// This example is built on top of example 1 and example 2.
415411
// Only the added logic is shown here for brevity.
416412
class EditingModel {
@@ -495,7 +491,7 @@ <h4>Examples</h4>
495491
editContext.addEventListener("characterboundsupdate", e => {
496492
editingcontroller.handleCharacterBoundsUpdate(e.rangeStart, e.rangeEnd);
497493
});
498-
</script></xmp></pre>
494+
&lt;/script&gt;</pre>
499495
</aside>
500496
</section>
501497
</section>
@@ -504,8 +500,8 @@ <h3>Interactions with Other Editing Primitives </h3>
504500
<p>An author doesn’t have to use a canvas element with an EditContext. In the example below the author uses a div to establish an editable region of the document and renders the contents into that editable region using various other styled elements, images and text. This allows the author to leverage other built-in editing primitives from the user agent such as selection and spellcheck. </p>
505501

506502
<aside class="example" title="How native selection can be leveraged to handle caret navigation.">
507-
<pre><xmp><div></div>
508-
<script>
503+
<pre>&lt;div&gt;&lt;/div&gt;
504+
&lt;script&gt;
509505
// This example reuses EditModel and EditController in Example 2 and 3.
510506
let div = document.querySelector("div")
511507
div.editContext = new EditContext()
@@ -562,11 +558,11 @@ <h3>Interactions with Other Editing Primitives </h3>
562558
document.addEventListener("selectionchange", e => {
563559
editingController.handleSelectionChange()
564560
});
565-
</script></xmp></pre>
561+
&lt;/script&gt;</pre>
566562
</aside>
567563

568564
<aside class="example" title="How beforeinput can be used to catch insertReplacementText to apply spelling changes">
569-
<pre><xmp><script>
565+
<pre>&lt;script&gt;
570566
// This example is built on top of example 4.
571567
// Only the added logic is shown here for brevity.
572568
class EditingController {
@@ -591,11 +587,11 @@ <h3>Interactions with Other Editing Primitives </h3>
591587
editingController.handleSpellCheck(newText, range)
592588
}
593589
})
594-
</script></xmp></pre>
590+
&lt;/script&gt;</pre>
595591
</aside>
596592

597593
<aside class="example" title="How beforeinput can be used to catch deleteByDrag and insertFromDrop to apply drag and drop changes">
598-
<pre><xmp><script>
594+
<pre>&lt;script&gt;
599595
// This example is built on top of example 4.
600596
// Only the added logic is shown here for brevity.
601597
class EditingController {
@@ -628,7 +624,7 @@ <h3>Interactions with Other Editing Primitives </h3>
628624
editingController.handleInsertFromDrop(newText, caretPosition)
629625
}
630626
})
631-
</script></xmp></pre>
627+
&lt;/script&gt;</pre>
632628
</aside>
633629

634630
</section>
@@ -999,7 +995,7 @@ <h4><dfn>Determine the active EditContext</dfn></h4>
999995

1000996
</section>
1001997
<h3 id="editcontext-interface">EditContext Interface</h3>
1002-
<pre class="idl"><xmp>dictionary EditContextInit {
998+
<pre class="idl">dictionary EditContextInit {
1003999
DOMString text;
10041000
unsigned long selectionStart;
10051001
unsigned long selectionEnd;
@@ -1014,22 +1010,22 @@ <h3 id="editcontext-interface">EditContext Interface</h3>
10141010
undefined updateSelection(unsigned long start, unsigned long end);
10151011
undefined updateControlBounds(DOMRect controlBounds);
10161012
undefined updateSelectionBounds(DOMRect selectionBounds);
1017-
undefined updateCharacterBounds(unsigned long rangeStart, sequence<DOMRect> characterBounds);
1013+
undefined updateCharacterBounds(unsigned long rangeStart, sequence&lt;DOMRect&gt; characterBounds);
10181014

1019-
sequence<HTMLElement> attachedElements();
1015+
sequence&lt;HTMLElement&gt; attachedElements();
10201016

10211017
readonly attribute DOMString text;
10221018
readonly attribute unsigned long selectionStart;
10231019
readonly attribute unsigned long selectionEnd;
10241020
readonly attribute unsigned long characterBoundsRangeStart;
1025-
sequence<DOMRect> characterBounds();
1021+
sequence&lt;DOMRect&gt; characterBounds();
10261022

10271023
attribute EventHandler ontextupdate;
10281024
attribute EventHandler ontextformatupdate;
10291025
attribute EventHandler oncharacterboundsupdate;
10301026
attribute EventHandler oncompositionstart;
10311027
attribute EventHandler oncompositionend;
1032-
};</xmp></pre>
1028+
};</pre>
10331029
<dl>
10341030
<dt>text</dt>
10351031
<dd>The {{EditContext/text}} getter steps are to return [=this=]'s [=text=].</dd>
@@ -1179,7 +1175,7 @@ <h3 id="editcontext-interface">EditContext Interface</h3>
11791175
<h2>EditContext Events</h2>
11801176
<section>
11811177
<h3>TextUpdateEvent</h3>
1182-
<pre class="idl"><xmp>dictionary TextUpdateEventInit : EventInit {
1178+
<pre class="idl">dictionary TextUpdateEventInit : EventInit {
11831179
unsigned long updateRangeStart;
11841180
unsigned long updateRangeEnd;
11851181
DOMString text;
@@ -1197,7 +1193,7 @@ <h3>TextUpdateEvent</h3>
11971193
readonly attribute DOMString text;
11981194
readonly attribute unsigned long selectionStart;
11991195
readonly attribute unsigned long selectionEnd;
1200-
};</xmp></pre>
1196+
};</pre>
12011197
<dl>
12021198
<dt>{{TextUpdateEvent/updateRangeStart}}, of type unsigned long, readonly</dt>
12031199
<dd>The start position of the range that is to be replaced.</dd>
@@ -1217,7 +1213,7 @@ <h3>TextUpdateEvent</h3>
12171213
</section>
12181214
<section>
12191215
<h3>TextFormatUpdateEvent</h3>
1220-
<pre class="idl"><xmp>enum UnderlineStyle { "none", "solid", "dotted", "dashed", "wavy" };
1216+
<pre class="idl">enum UnderlineStyle { "none", "solid", "dotted", "dashed", "wavy" };
12211217
enum UnderlineThickness { "none", "thin", "thick" };
12221218

12231219
dictionary TextFormatInit {
@@ -1237,14 +1233,14 @@ <h3>TextFormatUpdateEvent</h3>
12371233
};
12381234

12391235
dictionary TextFormatUpdateEventInit : EventInit {
1240-
sequence<TextFormat> textFormats;
1236+
sequence&lt;TextFormat&gt; textFormats;
12411237
};
12421238

12431239
[Exposed=Window]
12441240
interface TextFormatUpdateEvent : Event {
12451241
constructor(DOMString type, optional TextFormatUpdateEventInit options = {});
1246-
sequence<TextFormat> getTextFormats();
1247-
};</xmp></pre>
1242+
sequence&lt;TextFormat&gt; getTextFormats();
1243+
};</pre>
12481244
<dl>
12491245
<dt>{{TextFormat/rangeStart}}, of type unsigned long, readonly</dt>
12501246
<dd>An offset that respresents the position before the first codepoint that should be decorated.</dd>
@@ -1262,7 +1258,7 @@ <h3>TextFormatUpdateEvent</h3>
12621258
</section>
12631259
<section>
12641260
<h3>CharacterBoundsUpdateEvent</h3>
1265-
<pre class="idl"><xmp>dictionary CharacterBoundsUpdateEventInit : EventInit {
1261+
<pre class="idl">dictionary CharacterBoundsUpdateEventInit : EventInit {
12661262
unsigned long rangeStart;
12671263
unsigned long rangeEnd;
12681264
};
@@ -1272,7 +1268,7 @@ <h3>CharacterBoundsUpdateEvent</h3>
12721268
constructor(DOMString type, optional CharacterBoundsUpdateEventInit options = {});
12731269
readonly attribute unsigned long rangeStart;
12741270
readonly attribute unsigned long rangeEnd;
1275-
};</xmp></pre>
1271+
};</pre>
12761272
<dl>
12771273
<dt>{{CharacterBoundsUpdateEvent/rangeStart}}, of type unsigned long, readonly
12781274
</dt>

0 commit comments

Comments
 (0)