Add set extend operation · whatwg/infra@8c74b2a
domenic
·
2025-01-29
·
via Recent Commits to infra:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1542,8 +1542,8 @@ list multiple assignment syntax is used.
|
1542 | 1542 | <p>To <dfn export for=list>append</dfn> to a <a>list</a> that is not an <a>ordered set</a> is to |
1543 | 1543 | add the given <a for=list>item</a> to the end of the list. |
1544 | 1544 | |
1545 | | -<p>To <dfn export for=list>extend</dfn> a <a>list</a> |A| with a <a>list</a> |B|, |
1546 | | -<a for=list>for each</a> |item| of |B|, <a for=list>append</a> |item| to |A|. |
| 1545 | +<p>To <dfn export for=list>extend</dfn> a <a>list</a> that is not an <a>ordered set</a> |A| with a |
| 1546 | +<a>list</a> |B|, <a for=list>for each</a> |item| of |B|, <a for=list>append</a> |item| to |A|. |
1547 | 1547 | |
1548 | 1548 | <div class=example id=example-list-extend> |
1549 | 1549 | <ol> |
@@ -1709,6 +1709,9 @@ ordered sets; implementations can optimize based on the fact that the order is n
|
1709 | 1709 | the given <a for=set>item</a>, then do nothing; otherwise, perform the normal <a>list</a> |
1710 | 1710 | <a for=list>append</a> operation. |
1711 | 1711 | |
| 1712 | +<p>To <dfn export for=set>extend</dfn> an [=ordered set=] |A| with a [=list=] |B|, [=list/for each=] |
| 1713 | +|item| of |B|, [=set/append=] |item| to |A|. |
| 1714 | + |
1712 | 1715 | <p>To <dfn export for=set>prepend</dfn> to an <a>ordered set</a>: if the set |
1713 | 1716 | <a for=list>contains</a> the given <a for=set>item</a>, then do nothing; otherwise, perform the |
1714 | 1717 | normal <a>list</a> <a for=list>prepend</a> operation. |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。