Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML selectedcontent element #1142

Open
zcorpan opened this issue Dec 9, 2024 · 1 comment
Open

HTML selectedcontent element #1142

zcorpan opened this issue Dec 9, 2024 · 1 comment
Assignees

Comments

@zcorpan
Copy link
Member

zcorpan commented Dec 9, 2024

Request for Mozilla Position on an Emerging Web Specification

Other information

Previously, I had looked only at changes to select parsing and had missed whatwg/html#10633 , which appears to be treated as part of the whole package. I'm worried about breaking the so far implied invariant that there is one DOM element node per non-erroneous (possibly implied) start tag. Even template, which changed the basic expectations of how markup corresponds to DOM constructs allows parsing conforming markup to a DOM tree and re-reserializing to round trip. selectedcontent causing one option start tag to result in two option element nodes breaks at least serialization round-trippability of conforming markup. I don't at this time have more concrete reasoning about what practical badness this can cause exactly, but this kind of departure from the (implied) invariants worries me, so I don't want to say "positive" about this particular aspect.

Originally posted by @hsivonen in #1086 (comment)

@zcorpan zcorpan moved this from Unscreened to Needs proposed position in standards-positions review Dec 9, 2024
@mfreed7
Copy link

mfreed7 commented Dec 17, 2024

Previously, I had looked only at changes to select parsing and had missed whatwg/html#10633 , which appears to be treated as part of the whole package. I'm worried about breaking the so far implied invariant that there is one DOM element node per non-erroneous (possibly implied) start tag.

I believe that invariant is still true here. The <selectedcontent> element is serialized correctly, as are its contents, and will completely round-trip. Now there is also a UA behavior in these cases (behavior that happens to be at parsing time, but also happens when the user changes selected options) that clones subsequent content back into the <selectedcontent>. In addition, that’s exactly equivalent to what you can do today with script. I.e. I don’t see that as different from this snippet:

<div id=foo>Some content</div>
<script>
  foo.innerText = "something else";
</script>

That will “round trip”, but #foo will now be “something else”. The new thing here is just that <selectedcontent> can have its content replaced. That’s new behavior for HTML elements, but the round tripping behavior seems like a natural fallout.

Even template, which changed the basic expectations of how markup corresponds to DOM constructs allows parsing conforming markup to a DOM tree and re-reserializing to round trip. selectedcontent causing one option start tag to result in two option element nodes breaks at least serialization round-trippability of conforming markup. I don't at this time have more concrete reasoning about what practical badness this can cause exactly, but this kind of departure from the (implied) invariants worries me, so I don't want to say "positive" about this particular aspect.

I’m not sure what you mean here, about one option tag resulting in two option element nodes… can you please clarify?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Needs proposed position
Development

No branches or pull requests

3 participants