Skip to content

Spring 2023 DOM Parts F2F #999

Closed
Closed

Description

@rniwa

During today's web components F2F, we came to a conclusion that we need a longer separate meeting time to discuss DOM parts proposal.

Please indicate your availability in when2meet.

Update: Current proposal is to have this on Tuesday, May 2nd 9am through 11am PDT (Tuesday, May 2nd 4pm through 6pm UTC)

Activity

  1. tbondwilkinson commented on Apr 18, 2023

    @tbondwilkinson
    Contributor

    Should we throw some ideas around for an agenda?

    Question I would like to see answered:

    1. Is main document {{}} as an authoring format feasible or not?
    2. If main document {{}} is not feasible, is processing instruction for main document and <template> feasible?
    3. Are there any other contenders for declarative part syntax?
    4. What is the right API for exposing declarative parts to the application? Should they be accessible from Document? DocumentFragment? Elements?
    5. How are ranges "live" - what represents a range in the DOM? Can comments be the start and end markers for ranges?
  2. bahrus commented on Apr 18, 2023

    @bahrus

    One (perhaps the only?) viable alternative if we must support the table element as is, would be empty template elements, which was the direction I was going before I learned of the ability to query processing instructions with xpath. I was able to get nested loops working without bookending before and after, relying instead on the cnt attribute. But I only tested that two levels deep, and didn't yet convince myself it wouldn't run into trouble as the complexity of scenarios increased. So I would be hesitant to adopt that solution without far bigger implementations from high usage libraries trying it out.

    As my comments indicate, I would have preferred using the data element, as that seems to be its purpose, but as I recall, table elements spit them out as well.

    Has anyone done performance comparisons between the two? (empty template elements vs processing instructions). Yes, my intuition tells me processing instructions would win out, but you never know, I guess?

  3. rniwa commented on Apr 19, 2023

    @rniwa
    CollaboratorAuthor

    Looks like Tuesday, May 2nd 10-11am is the only time slot in which everyone is available with Tuesday, May 2nd 9am-10am being the second slot with most availability (only smaug is unavailable).

    With that in mind, I tentatively propose we host this on Tuesday, May 2nd 9am through 11am PDT (UTC 4pm through 6pm)

  4. bahrus commented on Apr 19, 2023

    @bahrus

    In case anyone's interested, I ran a simple test of creating thousands of empty template elements vs processing instructions. Performance was roughly equal.

  5. bahrus commented on Apr 19, 2023

    @bahrus

    Are there any notes of what was discussed that led to doubts whether {{}} is a feasible authoring tool? If it isn't a feasible authoring tool, then there doesn't seem much point to supporting interpolation beyond what spans can provide. However, I think the output of what is rendered needs to provide enough information so we can reverse engineer everything.

    I earlier endorsed (to the wind, I'm sure) the comment idea, but if my quick analysis is correct that the cost of a processing instruction matches the cost of an empty template, templates would be much easier to apply an xslt transform to reverse engineer the server rendered content to extract the data and {{}} based template (which would keep the syntax the originating template needs to support simpler).

    A quick lookup indicates comments can be used for ranges, so not sure where that question came from either. Maybe there's some more subtle nuance I'm missing?

    I also did my usual second guessing about the possibility of using "flat" elements (no bookending) to model nested structures. I don't yet have 100% in my solution. But I remember now where I got the idea. There are actually plenty of robust grids (starting with slickgrid) that managed this quite well (using "levels" to keep track of the nested structure). This would reduce the number of (unnecessary) elements, I think, which could only help performance. At least something to consider?

  6. tbondwilkinson commented on Apr 20, 2023

    @tbondwilkinson
    Contributor

    @bahrus I'm not sure how you would suggest that we replace processing instructions in the current proposal with <template> and what benefit <template> has to mark nodes and child node ranges rather than processing instructions/comments? Ack that we could throw data into a <template> in attributes or other child nodes, but I don't think that's much easier than just parsing metadata as JSON or whatever in userland.

    The question is whether or not comments should mark the beginning and end of a child node range. Meaning, if you remove one of the comment nodes from the DOM, the range would be invalid, and whatever nodes are between the two comments be precisely what the range represents, rather than some abstract non-DOM based concept of a child node range where you would have to explicitly add or replace nodes in the range via a new API, and sibling additions would have no impact (which leads to unintuitive behavior like if a node gets added in between two nodes that are part of the range, should that node be part of the range too?). It's really a question of whether the placeholders representing ranges should be serialized to the DOM as nodes (in the declarative case, comment nodes, but in the imperative case whatever nodes the user provides) or not.

    Not sure I understand what a "flat" element possibility would be, perhaps you could explain.

  7. bahrus commented on Apr 20, 2023

    @bahrus

    @tbondwilkinson , thanks for the clear explanation on the child node range issue.

    I'm sure I don't yet fully understand the processing instruction proposal, and that will quickly become apparent with my examples below, but the way I see our options is this:

    Suppose we do use {{}} as out authoring tool.

    And suppose our template looks like this:

    <template>Hello, {{name}}</template>

    And say the host object is:

    {"name": "Adam"}

    The server could generate:

    Hello, Adam

    which would leave us unable to reverse engineer the output and update the name property, nor infer what the original template looked like. Hence the need for some markers, which could include a "book-ended", "non-flat" child processing instruction:

    A:

    Hello, <?child-node prop="name"?>Adam</?child-node?>

    or a book-ended, non flat empty templates:

    B:

    Hello <template prop=name start/>Adam<template end/>

    or a "non-book-ended", "flat" representation with empty templates:

    C:

    Hello <template prop=name node-count=1 level=0/>Adam

    or a "non-book-ended", "flat" representation with processing instructions:

    D:

    Hello <?child-node prop=name node-count=1 level=0 ?>Adam

    I'm suggesting C and D might perform a little better, especially with many nodes, because it cuts the number of nodes in half (roughly).

    Although I agree with full access to JS and sufficient grunt work, it is possible to extract out the same information with all of these, I'm suggesting that I have more options to do it more simply when I compare B with A. With B I can query using CSS (in addition to XPath), and XSLT instructions might be simpler, because I'm not sure "attributes" inside the processing instruction come pre-parsed? Same goes with JS manipulation. If the performance is the same, doesn't that give empty templates the edge as far as what we should prefer?

  8. keithamus commented on Apr 20, 2023

    @keithamus
    Collaborator

    Is main document {{}} as an authoring format feasible or not?

    Are there any notes of what was discussed that led to doubts whether {{}} is a feasible authoring tool?

    The main objection (attempting to summarise from the notes) is that {{}} may leave artefacts in the rendered DOM, as there's no default value. What does <div>{{name}}</div> do if name isn't supplied in the data? For templates this is not an issue as they're not user visible until processed.

  9. bahrus commented on Apr 20, 2023

    @bahrus

    Another potential benefit of using empty template elements: I could see the microdata initiative of itemprops attributes being extended to support empty template elements. Extending it to support processing instructions seems less likely to me.

  10. justinfagnani commented on Apr 20, 2023

    @justinfagnani
    Contributor

    I don't think this is the issue to discuss these things. It would be much easier to track the syntax discussion in a syntax issue. This one should be about planning the meeting.

  11. tbondwilkinson commented on Apr 20, 2023

    @tbondwilkinson
    Contributor

    Opened #1003

  12. EisenbergEffect commented on May 2, 2023

    @EisenbergEffect
    Contributor

    Are we meeting today, Tuesday, May 2nd 9am through 11am PDT (UTC 4pm through 6pm)??? I need to make some plans...

  13. bkardell commented on May 2, 2023

    @bkardell

    I'm curious as well

  14. sashafirsov commented on May 2, 2023

    @sashafirsov

    the meeting still not on WCCG calendar, could someone send an invite, please?
    https://www.w3.org/groups/cg/webcomponents/calendar

  15. 8 remaining items

  16. mfreed7 commented on May 8, 2023

    @mfreed7

    Mine:
    Week of June 5th to 9th
    Week of June 12th to 16th
    Week of June 19th to 23rd
    Week of July 3rd to 7th (3/4 are US holidays at least for me)
    Week of July 10th to 14th
    Week of July 17th to 21st
    Week of July 24th to 28th

  17. tbondwilkinson commented on May 23, 2023

    @tbondwilkinson
    Contributor

    Should we decide on a week?

  18. rniwa commented on May 23, 2023

    @rniwa
    CollaboratorAuthor

    Looks like the week of July 17th and July 24th are only weeks in which everyone is available.

  19. tbondwilkinson commented on May 24, 2023

    @tbondwilkinson
    Contributor

    Works for me! Can you put together a whenisgood for those two weeks?

  20. rniwa commented on May 24, 2023

    @rniwa
    CollaboratorAuthor
  21. rniwa commented on May 25, 2023

    @rniwa
    CollaboratorAuthor

    Looks like Tue, July 18th 10am to 12pm PDT (5pm to 7pm UTC) is the current winner so far.

  22. R3D-CODE commented on Jun 29, 2023

    @R3D-CODE

    @tbondwilkinson I've started to write a template engine, and I decided to use this format:

    1. ${}, which is familiar format in JS, and can be used everywhere
    <template>Hello, ${ name }</template>
    1. $[], for partial templates
    $[ extends "base.html" ]
    $[ header ]
    $[ content ]
    
    <template id="header">
      <h1>${ title }</h1>
    </template>
  23. tbondwilkinson commented on Jul 17, 2023

    @tbondwilkinson
    Contributor

    Myself and a few other folks (Justin, Mason) are planning on attending the meeting tomorrow, if it still works for you Ryosuke and anyone else who was originally interested.

  24. EisenbergEffect commented on Jul 17, 2023

    @EisenbergEffect
    Contributor

    I've got it on my calendar and am planning to attend. Just need the meeting invite when it's available.

  25. bkardell commented on Jul 17, 2023

    @bkardell

    I'm not sure if I can come but can I get an invite in case I can? I'd like to.

  26. rniwa commented on Jul 17, 2023

    @rniwa
    CollaboratorAuthor

    DOM Parts F2F
    Tuesday, July 18 · 10:00 – 12:00 (PDT)
    Time zone: America/Los_Angeles
    Google Meet joining info
    Video call link: https://meet.google.com/gbu-spbc-mzk

  27. rictic commented on Jul 17, 2023

    @rictic
    Contributor

    I did some prototyping over the weekend with Chrome Canary's experimental implementation in rictic/web-template-workbench#1. I'll plan to attend and share feedback.

  28. mfreed7 commented on Jul 18, 2023

    @mfreed7

    Updated meeting link for today:

    DOM Parts F2F
    Tuesday, July 18 · 10:00am – 12:00pm
    Time zone: America/Los_Angeles
    Google Meet joining info
    Video call link: https://meet.google.com/hgj-rwkp-cww
    Or dial: ‪(US) +1 509-676-2430‬ PIN: ‪798 465 786‬#
    More phone numbers: https://tel.meet/hgj-rwkp-cww?pin=9066503354465

  29. rictic commented on Jul 18, 2023

    @rictic
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions