bigopon / templating

An extensible HTML templating engine supporting databinding, custom elements, attached behaviors and more.
MIT License
0 stars 0 forks source link

Shadow dom issue #1

Open bigopon opened 6 years ago

bigopon commented 6 years ago

@StrahilKazlachev lets start our discussion here

StrahilKazlachev commented 6 years ago

Well, first I think we can, and should, ignore PassThroughSlot, as far as I can tell that's used for the cases where you have a <slot> targeting another <slot>, from the docs:

<slot name="slot1" slot="slot1">Fallback Content for Projected Slot 1</slot>

We probably should return later and see if it has the same issue.

StrahilKazlachev commented 6 years ago

Currently I'm focusing on first call/read to ShadowSlot.prototype.needsFallbackRendering. For root <slot>s, on first read, it returns correctly, false, if there is an override. projections has already been set. For nested <slot>s, on first read it returns true, if there is an override. projections has not been set yet and is 0. This is the path I'm following for now.

bigopon commented 6 years ago

I think it could be separated into:

  else if (nodeType === 1 || nodeType === 3) {
    if (currentNode.viewSlot instanceof PassThroughSlot) {
      // ...
    } else {
      // ...
    }
  } else {
    ...
  }