@@ -256,12 +256,6 @@ <h2>Extensibility</h2>
256
256
257
257
< section > < h2 > Extensions to the < code > < a > Element</ a > </ code > interface</ h2 >
258
258
259
- < pre class ="idl ">
260
- partial interface Element {
261
- [CEReactions] undefined insertAdjacentHTML(DOMString position, HTMLString text);
262
- };
263
- </ pre >
264
-
265
259
<!-- outerHTML -->
266
260
267
261
< span id ="dom-element-outerhtml "> </ span >
@@ -270,116 +264,9 @@ <h2>Extensibility</h2>
270
264
271
265
<!-- insertAdjacentHTML -->
272
266
273
- < dl class =domintro >
274
- < dt > < var > element</ var > . < a data-link-for ="Element "> insertAdjacentHTML</ a > ( < var > position</ var > , < var > text</ var > )
275
- < dd > Parses the given string < var > text</ var > as HTML or XML and inserts the resulting nodes into
276
- the tree in the position given by the < var > position</ var > argument, as follows:
277
-
278
- < dl >
279
- < dt > "beforebegin"
280
- < dd > Before the element itself (i.e., after < var > element</ var > 's previous sibling)
281
-
282
- < dt > "afterbegin"
283
- < dd > Just inside the element, before its first child.
284
-
285
- < dt > "beforeend"
286
- < dd > Just inside the element, after its last child.
287
-
288
- < dt > "afterend"
289
- < dd > After the element itself (i.e., before < var > element</ var > 's next sibling)
290
- </ dl >
291
-
292
- < p > Throws a "< code > < a > SyntaxError</ a > </ code > " < code > < a > DOMException</ a > </ code > if the arguments
293
- have invalid values (e.g., in the case of an < a > XML document</ a > , if the given string is not
294
- well-formed).
295
-
296
- < p > Throws a "< code > < a > NoModificationAllowedError</ a > </ code > " < code > < a > DOMException</ a > </ code > if
297
- the given position isn't possible (e.g. inserting elements after the root element of a
298
- < code > < a > Document</ a > </ code > ).
299
- </ dl >
300
-
301
- < p > The
302
- < dfn data-dfn-for ="Element " data-lt ="insertAdjacentHTML "> < code > insertAdjacentHTML(< var > position</ var > , < var > text</ var > )</ code > </ dfn >
303
- method must run these steps:
304
-
305
- < ol >
306
- < li > Use the first matching item from this list:
307
-
308
- < dl class =switch >
309
- < dt > If < var > position</ var > is an < a > ASCII case-insensitive</ a > match for the string
310
- "< code > beforebegin</ code > "
311
- < dt > If < var > position</ var > is an < a > ASCII case-insensitive</ a > match for the string
312
- "< code > afterend</ code > "
313
- < dd > Let < var > context</ var > be the < a > context object</ a > 's < a > parent</ a > .
314
-
315
- < p > If < var > context</ var > is null or a < a > Document</ a > , throw a
316
- "< code > < a > NoModificationAllowedError</ a > </ code > " < code > < a > DOMException</ a > </ code > .
317
-
318
- < dt > If < var > position</ var > is an < a > ASCII case-insensitive</ a > match for the string
319
- "< code > afterbegin</ code > "
320
- < dt > If < var > position</ var > is an < a > ASCII case-insensitive</ a > match for the string
321
- "< code > beforeend</ code > "
322
- < dd > Let < var > context</ var > be the < a > context object</ a > .
323
-
324
- < dt > Otherwise
325
- < dd > Throw a "< code > < a > SyntaxError</ a > </ code > " < code > < a > DOMException</ a > </ code > .
326
- </ dl >
327
-
328
- < li > If < var > context</ var > is not an < code > < a > Element</ a > </ code > or the following are all true:
329
- < ul >
330
- < li > < var > context</ var > 's < a > node document</ a > is an < a > HTML document</ a > ,
331
-
332
- < li > < var > context</ var > 's < a > local name</ a > is "< code > html</ code > ", and
333
-
334
- < li > < var > context</ var > 's < a data-lt ="concept namespace "> namespace</ a > is the
335
- < a > HTML namespace</ a > ;
336
- </ ul >
337
-
338
- < p > let < var > context</ var > be a new < code > < a > Element</ a > </ code > with
339
-
340
- < ul >
341
- < li > < code > body</ code > as its < a > local name</ a > ,
342
-
343
- < li > The < a > HTML namespace</ a > as its < a data-lt ="concept namespace "> namespace</ a > , and
344
-
345
- < li > The < a > context object</ a > 's < a > node document</ a > as its < a > node document</ a > .
346
- </ ul >
347
-
348
- < li > Let < var > fragment</ var > be the result of invoking the < a > fragment parsing algorithm</ a > with
349
- < var > text</ var > as < var > markup</ var > , and < var > context</ var > as the < var > context element</ var > .
350
-
351
- < li > Use the first matching item from this list:
352
-
353
- < dl class =switch >
354
- < dt > If < var > position</ var > is an < a > ASCII case-insensitive</ a > match for the string
355
- "< code > beforebegin</ code > "
356
- < dd > < a > Insert</ a > < var > fragment</ var > into the < a > context object</ a > 's < a > parent</ a > before
357
- the < a > context object</ a > .
358
-
359
- < dt > If < var > position</ var > is an < a > ASCII case-insensitive</ a > match for the string
360
- "< code > afterbegin</ code > "
361
- < dd > < a > Insert</ a > < var > fragment</ var > into the < a > context object</ a > before its
362
- < a > first child</ a > .
363
-
364
- < dt > If < var > position</ var > is an < a > ASCII case-insensitive</ a > match for the string
365
- "< code > beforeend</ code > "
366
- < dd > < a > Append</ a > < var > fragment</ var > to the < a > context object</ a > .
367
-
368
- < dt > If < var > position</ var > is an < a > ASCII case-insensitive</ a > match for the string
369
- "< code > afterend</ code > "
370
- < dd > < a > Insert</ a > < var > fragment</ var > into the < a > context object</ a > 's < a > parent</ a > before
371
- the < a > context object</ a > 's < a > next sibling</ a > .
372
- </ dl >
373
- </ ol >
267
+ < span id ="dom-element-insertadjacenthtml "> </ span >
374
268
375
- < p class =note > No special handling for < code > < a > template</ a > </ code > elements is included in the
376
- above "< code > afterbegin</ code > " and "< code > beforeend</ code > " cases. As with other direct
377
- < a > Node</ a > -manipulation APIs (and unlike < a data-link-for ="Element "> innerHTML</ a > ),
378
- < a data-link-for ="Element "> insertAdjacentHTML</ a > does not include any special handling for
379
- < code > < a > template</ a > </ code > elements. In most cases you will wish to use
380
- < a > template</ a > .< a data-lt ="template contents "> content</ a > .< a data-link-for ="Element "> insertAdjacentHTML</ a >
381
- instead of directly manipulating the < a > child nodes</ a > of a < code > < a > template</ a > </ code >
382
- element.</ p >
269
+ < p > The definition of < code > insertAdjacentHTML</ code > has moved to < a href ="https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#the-insertadjacenthtml()-method "> the HTML Standard</ a > .</ p >
383
270
384
271
</ section > <!-- end Extensions to the Element interface -->
385
272
@@ -1540,6 +1427,7 @@ <h2>Dependencies</h2>
1540
1427
< li > The < dfn data-lt ="CEReactions "> < a href ="https://www.w3.org/TR/html5/single-page.html#cereactios "> [CEReactions]</ a > </ dfn > IDL < a > extended attribute</ a >
1541
1428
< li > The < dfn > < a href ="https://html.spec.whatwg.org/dynamic-markup-insertion.html#dom-element-innerhtml "> innerHTML</ a > </ dfn > property;
1542
1429
< li > The < dfn > < a href ="https://html.spec.whatwg.org/dynamic-markup-insertion.html#dom-element-outerhtml "> outerHTML</ a > </ dfn > property;
1430
+ < li > The < dfn > < a href ="https://html.spec.whatwg.org/dynamic-markup-insertion.html#dom-element-insertadjacenthtml "> insertAdjacentHTML</ a > </ dfn > method;
1543
1431
</ ul >
1544
1432
1545
1433
The DOM specification [[!DOM4]] defines the following terms used in this document:
0 commit comments