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

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

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

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

wintercounter opened this issue Mar 27, 2017 · 4 comments

Comments

@wintercounter
Copy link

@wintercounter wintercounter commented Mar 27, 2017

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
Copy link
Author

@wintercounter 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
Copy link
Member

@GianlucaGuarini 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
Copy link
Author

@wintercounter wintercounter commented May 8, 2017

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

@CodeKris
Copy link

@CodeKris CodeKris commented May 14, 2017

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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.