Skip to content

Odd bug messes up entire page #18234

@AlbertMarashi

Description

@AlbertMarashi
  • Laravel Version: 5.4
  • PHP Version: 5.6

Description:

Notice the class red in testpage.blade.php

If you reproduce this, the <div class="red"> is moved to the top, all the head data is also put inside the div.

I believe this has something to do with the @slot inlining

When I change @slot('value, $firstname) to

@slot('value')
{{ $firstname }}
@endslot

The problem disappears. So this must clearly be a problem with laravel.

ManagesComponents.php needs to be re-checked for any unthought of implementation issues.

Steps To Reproduce:

in resources/views create:

layouts/test.blade.php

<head>
    <meta name="" content="">
    <style>
.red{
margin: 50px;
background:red;
}
    </style>
</head>
<body>
    <div class="full">
        @yield('content')
    </div>
</body>

components/input.blade.php

<div class="item">
    <label for="{{ $name }}">{{ $slot }}</label>
    <input 
        type="{{ $type }}"
        name="{{ $name }}"
        placeholder="{{ $slot }}"
        value="{{ $value }}" >
</div>

testpage.blade.php

@extends('layouts.test')

<?php
    $firstname = null;
?>

@section('content')

    <div class="red">
        @component('components.input')
            @slot('name', 'firstname')
            @slot('type', 'text')
            @slot('value', $firstname)
            First Name
        @endcomponent
    </div>

@endsection
```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions