Problem/Motivation

Two things:

  1. $ce = CustomElement::create('MYTAG')
      ->setSlot('content', 'FIRST')
      ->addSlot('content', 'SECOND');
    

    sets slotNormalizationStyle NORMALIZE_AS_SINGLE_VALUE. (Specifically: a setSlot() call without $index parameter does this.)

  2. Rendering $ce as HTML produces
    <mytag><div slot="content">FIRST</div><div slot="content">SECOND</div></mytag>
    

    But normalizing JSON produces

    [ 'element' => 'mytag', 'content' => 'FIRST']
    

    In other words, the CustomElement::$slotNormalizationStyles property is only used for JSON output, not HTML.

Remaining tasks

Work out what we want to do with this.

  • Do we not care about the difference between outputs? Then document the fact that setSlotNormalizationStyle() does nothing for HTML. Otherwise fix?
  • Is it a known fact that a setSlot*() call without $index parameter 'breaks' subsequent addSlot*() calls for the same slot name but only for JSON, not HTML? Then document this.
  • ...

(CustomElement and set/addSlot() calls' documentation could use an overhaul/extension, apart from this. I'll later decide whether to do this in this same issue, or maybe file a followup, or maybe I will have already done that before this issue is addressed...)

Comments

roderik created an issue.