WICG / WICG/declarative-partial-updates

Elements with special parsing rules

Open
#30 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Bikeshed
Stars
135
Forks
13
Avg merge
12m
Merged PRs (30d)
3

Description

Many elements have special parsing rules that end up limiting what kind of nodes can appear inside. For example, https://html.spec.whatwg.org/multipage/parsing.html#parsing-elements-that-contain-only-text is used for <xmp> and as a result there will be either no child node, or a single text node child.

Should <template patchfor> ensure that result will be the same as if it was parsed at the target location?

Test case:

<!DOCTYPE html>
<xmp id=target></xmp>
<template patchfor=target><span>hello</span></template>

Or should be behave exactly like setting innerHTML? https://software.hixie.ch/utilities/js/live-dom-viewer/?saved=13929 tests that and at least <xmp> behaves the same as the main parser. Spec is at https://html.spec.whatwg.org/multipage/parsing.html#html-fragment-serialisation-algorithm and I'm not very familiar with where it differs from the main parser.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the supplied xmp/template test case with the HTML fragment serialisation algorithm and the main parser rules cited in the issue. Determine whether template patching should match parsing at the target location or innerHTML behavior, then document the decision and its expected result for this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.