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
3 of 7 tasks
wintercounter opened this issue Mar 27, 2017 · 4 comments
Closed
3 of 7 tasks

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

wintercounter opened this issue Mar 27, 2017 · 4 comments

Comments

@wintercounter
Copy link

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 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

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

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

@CodeKris
Copy link

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
Development

No branches or pull requests

3 participants