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

If template option is an actual template node, auto use its content. #335

Closed
yyx990803 opened this issue Jul 2, 2014 · 2 comments
Closed

Comments

@yyx990803
Copy link
Member

No description provided.

@rafaelrinaldi
Copy link

@yyx990803 Can you give an example in how it should behave? AFAIU this will remove the need to do things like:

Vue.extend({
  template: $('#my-thing-template').text()
});

Am I right?

@yyx990803
Copy link
Member Author

Well, currently the template option accepts three things:

  1. a template string
  2. an id selector of the template node (either a <script> node or a native <template> node)
  3. a DocumentFragment.

So you can already do:

Vue.extend({
  template: '#my-thing-template'
})

This fix is intended to make this possible:

Vue.extend({
    template: document.querySelector('template') // a <script> or <template> node
})

As for your example, it removes the need to call the extra text().

yyx990803 pushed a commit that referenced this issue Jul 8, 2014
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

2 participants