Re: [whatwg/dom] Proposal: ParentNode.replaceAll() / ParentNode.replaceChildren() (#478)

A few responses to @domenic’s tweet poll caught my attention.

1. `parentNode.children` returns only elements, which could lead to some misunderstanding when first encountering `replaceChildren`. However, replacing _only_ child elements with other content while also preserving sibling text nodes seems illogical. Also, I could not find any other pattern of non-specificity inferring _Elements_ in the DOM API.
   - https://twitter.com/matthewcp/status/1113542506975776768

   - https://twitter.com/tabatkins/status/1113543149069058048

   - https://developer.mozilla.org/en-US/docs/Web/API/ParentNode/children


2. `range.selectNodeContents`, `range.extractContents`, and other range functions target elements, text, or a mixture of both. Following this pattern would lead to `replaceContents`, although this name was not an option in the poll.
   - https://twitter.com/bwrrp/status/1113550101857886208

   - https://twitter.com/naugtur/status/1113533978986930181

   - https://twitter.com/tabatkins/status/1113543149069058048

   - https://developer.mozilla.org/en-US/docs/Web/API/Range/cloneContents

   - https://developer.mozilla.org/en-US/docs/Web/API/Range/deleteContents

   - https://developer.mozilla.org/en-US/docs/Web/API/Range/extractContents

   - https://developer.mozilla.org/en-US/docs/Web/API/Range/selectNodeContents

   - https://developer.mozilla.org/en-US/docs/Web/API/Range/surroundContents


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/478#issuecomment-480133409

Received on Friday, 5 April 2019 03:06:17 UTC