removed slot's <content/>...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2026-06-28 16:01:17 +03:00
parent b9b11ecbda
commit 8b5f156816
2 changed files with 19 additions and 2 deletions

View File

@ -1321,7 +1321,7 @@ module.parser = {
: name in slots)
// set slot value...
// XXX simplify this...
/* XXX CONTENT...
var stack = []
slots[name]
&& stack.push(slots[name])
@ -1357,6 +1357,17 @@ module.parser = {
.filter(function(e){
return typeof(e) != 'function'
|| e.slot != name }) ) }
/*/
text = text ?
parser.expand(this, text ?? [], state)
: text
if(body && text){
var slot = text
} else {
var slot = body ?? text }
var original = slot
slots[name] = slot
//*/
return hidden ?
''
: Object.assign(
@ -1364,7 +1375,8 @@ module.parser = {
return ((st ?? state).slots ?? {})[name]
?? original },
{slot: name}) }) }),
'content': ['slot'],
// XXX CONTENT...
//'content': ['slot'],
//

View File

@ -54,6 +54,7 @@ test.Setups({
...ins.map(function(e){
return e + '<slot slot>third</slot>' }),
'third' ] },
/* XXX CONTENT...
slot_content_empty: function(assert){
return [
'@slot(slot body="[[ <content/> ]]")',
@ -71,7 +72,9 @@ test.Setups({
...ins.map(function(i){
return i +'@slot(slot value)' }),
expect.replace('default', 'value') ] },
//*/
// XXX these are an alternative to <content/>...
slot_nested: function(assert){
return [
'<slot slot>[[ <slot slot.content/> ]]</slot>@slot(slot.content value)',
@ -81,6 +84,7 @@ test.Setups({
'<slot slot>[[ <slot slot.content/> ]]</slot>@slot(slot value)',
'value' ] },
/* XXX CONTENT...
// XXX the question with the next tow is:
// should body override or nest?
// ...both are logical but in either case the result should be
@ -146,6 +150,7 @@ test.Setups({
...ins.map(function(i){
return i +'@slot(slot shown)' }),
'' ] },
//*/
})