Skip to content

Commit c940b29

Browse files
authored
Update weaknesses section in patching explainer
Clarified weaknesses of the design regarding node replacement and patching constraints.
1 parent 7e35cab commit c940b29

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

patching-explainer.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,8 @@ Weaknesses of this design are:
262262

263263
- Doesn't support replacing arbitrary ranges of nodes, only an element or all of its children.
264264
- In order to support patching `<title>`, which uses the [RCDATA tokenizer state](https://html.spec.whatwg.org/multipage/parsing.html#rcdata-state), the tag name of the target element must be repeated. This is because switching to the RCDATA (or RAWTEXT) state in a `<template>` element would change how the content is parsed in supporting and non-supporting parsers, which could be a security concern.
265-
- `prepend` can fail if the original first child of the element is removed, meaning that a patch can fail mid-stream, requiring some error handling/reporting.
265+
266+
These constraint seemed to restrictive for early adopters and frameworks looking at this API - a range of the DOM to be later updated cannot be constrained in advance to an "append"/"prepend"/"replace all" - often this range is an arbitrary range in the DOM defined by the user of the platform/framework.
266267

267268
### Using a new node type
268269

0 commit comments

Comments
 (0)