Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Odd bug messes up entire page #18234

Closed
AlbertMarashi opened this issue Mar 7, 2017 · 3 comments
Closed

Odd bug messes up entire page #18234

AlbertMarashi opened this issue Mar 7, 2017 · 3 comments

Comments

@AlbertMarashi
Copy link

AlbertMarashi commented Mar 7, 2017

  • 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
```
@AlbertMarashi
Copy link
Author

AlbertMarashi commented Mar 7, 2017

http://i.imgur.com/EZ7W1qL.png here is an image of how it looks with the @slot inlined

http://i.imgur.com/Ovpc6bT.png and this is how it looks with the @slot and @endslot

@AlbertMarashi
Copy link
Author

Also, this problem only happens when the $firstname is null or empty, from what i've gathered.

@themsaid
Copy link
Member

themsaid commented Mar 7, 2017

Fixed in #18246

@themsaid themsaid closed this as completed Mar 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants