w3c / w3c/DOM-Parsing

Sort out what's happening with innerHTML on <script> and <style> in XML documents

Open
#6 15 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
28
Forks
14
Avg merge
3h 10m
Merged PRs (30d)
1

Description

In at least Chrome, Safari, and Firefox, it looks like this:

var style = document.createElementNS("http://www.w3.org/1999/xhtml", "style");
style.innerHTML = "<foo></foo>";

will create a textnode with the text "<foo></foo>" as a child of the <style> element. Even if this is happening in an XML/XHTML document.

Per spec, I would think in an XML document this should create a child element named "foo", no?

I haven't had a chance to check what IE/Edge do here yet. /cc @annevk @smaug----

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 checking the reported innerHTML behavior for style elements created with createElementNS in XML/XHTML documents across the cited browsers. Compare those results with the applicable DOM Parsing and XML/HTML specifications, including the expected handling of the foo element. Done means the normative behavior and any required specification change are clearly determined.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
web-dev
Issue type
Bug
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.