11ty / 11ty/webc

Always ignore parent component tags outside of `<body>`

Open
#137 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
JavaScript
Stars
1.4k
Forks
46
Avg merge
10m
Merged PRs (30d)
2

Description

We should never output a custom element name as a child of <html> or <head>. They are invalid there.

<!doctype html>
<html>
	<head webc:is="my-component"></head>
	<body>
		<my-component></my-component>
	</body>
</html>

Even if my-component has script or style (not an HTML-only component) we should exempt the parent tag from being rendered (outside of <body>)

Inspired by https://github.com/11ty/webc/issues/135#issuecomment-1478557230

Contributor guide

No contributing guide indexed for this repository

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 reproducing the HTML example in the issue and inspect how parent components are rendered inside and . Confirm that custom element names are omitted outside , including components with script or style, then add or run focused coverage for these cases and verify the generated HTML.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.