Webcomponents: Template/part proposals - Naming for DOM Parts API

Created on 27 Oct 2020  ·  9Comments  ·  Source: WICG/webcomponents

In our virtual F2F breakout discussion for DOM Parts API, naming for the new APIs, Part, could cause confusion with CSS Shadow Parts.

Current Proposal: DOM Parts

interface Part {...};
interface NodePart : Part {...};
interface AttributePart : NodePart {...};
interface ChildNodePart : NodePart {...};
interface PropertyPart : NodePart {...};
interface CustomPart : NodePart{...};
interface PartGroup {...};

Naming alternatives to the Parts API :

  1. Location can be an alternative to Part since they point to locations in the DOM where mutation can happen.
    The API becomes:
interface Location {...};
interface NodeLocation : Location {...};
interface AttributeLocation : NodeLocation {...};
...
  1. Another common term used to indicate a placeholder for future data is binding.
    Frameworks like Angular and Vue uses binding to mark a place in an element where application data is inserted.
interface Binding {...};
interface NodeBinding : Binding {...};
interface AttributeBinding : NodeBinding {...};
...

What do you guys think?

@EisenbergEffect @caridy @JanMiksovsky @rniwa @hober @justinfagnani @mfreed7

templates

Most helpful comment

I like the concept of Reference too. The shortened version, NodeRef, AttrRef, PropertyRef sounds appealing.

All 9 comments

Drive by: Attribute -> Attr would be nice for consistency and conciseness :)

Location already exists (see HTML). Binding doesn't have a lot of precedent other than IDL, but seems a bit confusing to me personally.

Did you consider "marker" or "insertion point" or some such?

Location already exists (see HTML). Binding doesn't have a lot of precedent other than IDL, but seems a bit confusing to me personally.

Did you consider "marker" or "insertion point" or some such?

point might be a good terminology to use here given we already have boundary points for Range.

Maybe mutation points or manipulation points? Perhaps replacement points?

I like mutation points. Ties it right back to mutation observers and the mutation algorithms in general.

Perhaps something like AttrMutator, ChildNodeMutator, PropertyMutator. Maybe LifecycleMutator for the custom callback scenario?

Reference is name that somewhat naturally falls out of what the object is. I often talk about Parts as being cloneable references into the DOM.

Maybe keep it short like WeakRef.: DOMRef

NodeRef, but yes, that is kinda nice too.

I like the concept of Reference too. The shortened version, NodeRef, AttrRef, PropertyRef sounds appealing.

Was this page helpful?
0 / 5 - 0 ratings