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

Take advantage of existing DOM when using a single yield #2296

Closed
wintercounter opened this Issue Mar 27, 2017 · 4 comments

Comments

Projects
None yet
3 participants
@wintercounter

Help us to manage our issues by answering the following:

  1. Describe your issue:

Currently we're using riot in a PHP based environment. So we're having our templates coming from PHP. We introduced a simple way to allow riot expressions in those templates. It's pretty simple:

Markup from PHP

<my-tag>
    <div class="{cls}">Content</div>
</my-tag>

Tag

<my-tag>
    <yield></yield>
    this.cls = 'my-cls'
</my-tag>

This works fine, the only issue is FOUC which could be easily prevented if riot would take the advantage of the existing DOM when only using a single yield in the tag. The DOM structure isn't changing there anyway. This would have performance benefits also. (I know this won't ever make it into riot, but worth a shot).

  1. How would you tag this issue?
  • Question
  • Bug
  • Discussion
  • Feature request
  • Tip
  • Enhancement
  • Performance
@wintercounter

This comment has been minimized.

Show comment
Hide comment
@wintercounter

wintercounter Mar 27, 2017

Or maybe it can work by leaving out the yield tag (no markup). It's like just simply attaching riot's functionality to a natural DOM element, sound pretty clear.

wintercounter commented Mar 27, 2017

Or maybe it can work by leaving out the yield tag (no markup). It's like just simply attaching riot's functionality to a natural DOM element, sound pretty clear.

@GianlucaGuarini

This comment has been minimized.

Show comment
Hide comment
@GianlucaGuarini

GianlucaGuarini May 5, 2017

Member

In the next riot release for the tags declared with no template riot will use just their inline html as template http://plnkr.co/edit/DYp1iSiqpeM5XogBmB1n?p=preview

Member

GianlucaGuarini commented May 5, 2017

In the next riot release for the tags declared with no template riot will use just their inline html as template http://plnkr.co/edit/DYp1iSiqpeM5XogBmB1n?p=preview

@wintercounter

This comment has been minimized.

Show comment
Hide comment
@wintercounter

wintercounter May 8, 2017

Wow! I didn't expect this, you guys are great!

Wow! I didn't expect this, you guys are great!

@CodeKris

This comment has been minimized.

Show comment
Hide comment
@CodeKris

CodeKris May 14, 2017

Awesome!
There's a syntax error in the docs:

riot.tag.('tag-name', false, function(opts) { // Extra dot after 'tag'

Kris

Awesome!
There's a syntax error in the docs:

riot.tag.('tag-name', false, function(opts) { // Extra dot after 'tag'

Kris

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment