Yew: HTML tags are not finding closing tags for longer <div> blocks

Created on 8 Jul 2019  路  9Comments  路  Source: yewstack/yew

Description

I'm submitting a ... (check one with "x")

  • question - please describe the problem you're trying to solve and give as much context as possible.
  • feature request - please describe the behavior you want and the motivation.
    x bug report - please describe shortly your bug and fill out the other sections.

HTML tags are not finding closing tags for longer div blocks.

Expected Results

Successful compilation.

Actual Results

   Compiling coolcats2 v0.1.0 (/Users/mahakal/Development/Apps/coolcats2/ui-src)
error: this open tag has no corresponding close tag
   --> src/application/interfaces/follow.rs:170:13
    |
170 |             <div class="panel panel-default",>
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Context (Environment)

  • Rust: v1.36.0

  • yew: v0.7.0 (https://github.com/DenisKolodin/yew#a33a89f0)

  • target: wasm32-unknown-unknown

  • cargo-web: v0.6.25

All 9 comments

If I remove some of the inner contents of the div block, the code will eventually compile, but of course this is missing part of the html then.

Can you post a minimal example?

This compiles:

https://gist.github.com/pythagorean/404414b5ae3f14de98a4f180dd1c60d0

By uncommenting the last inner div block, this does not compile, and gives the original error shown:

https://gist.github.com/pythagorean/9b75a25d26ef0d69af5ec470882dc6b7

I just tried this in one of my code, and it produces the same error:

html! {
    <div id="buttons">
        <div/>
    </div>
}

```
error: this open tag has no corresponding close tag
--> src/lib.rs:264:17
|
264 |


| ^^^^^^^^^^^^^^^^^^

So I guess that removing those will compile:
```rust
<div class="col-sm-1",/>
<div class="col-sm-4",/>

Then, I would say that the problem is with mixing self-closing and not-self-closing tags.

@pythagorean Can you try this PR and tell me if it fixes this issue? :slightly_smiling_face:

https://stackoverflow.com/a/3558200/2209243

Using self-closing div tags is invalid HTML5, so I closed my PR. You should use an empty pair instead (i.e. <div props="..."></div>).

@pythagorean Can you try this PR and tell me if it fixes this issue? 馃檪

Fixes.

JSX supports this, we should too. See here: https://reactjs.org/docs/jsx-in-depth.html

Was this page helpful?
0 / 5 - 0 ratings

Related issues

djahandarie picture djahandarie  路  3Comments

ghost picture ghost  路  5Comments

kellytk picture kellytk  路  4Comments

thienpow picture thienpow  路  3Comments

FrontMage picture FrontMage  路  4Comments