-
Notifications
You must be signed in to change notification settings - Fork 33
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
fix bug in https://ractive.js.org/tutorials/hello-world/ step 1, code line 33 #154
base: dev
Are you sure you want to change the base?
Conversation
bug: var ractive = Ractive({ fix: var ractive = new Ractive({
Hi! Thanks for the PR (your very first one to be precise 🎉 ). Unfortunately, it's not a bug. See https://github.com/ractivejs/ractive/blob/dev/src/Ractive.js#L35 |
well, it didn't work in the tutorial when i pasted the code in.it
worked after l i clicked "fix code" which changed the instantiation to
an explicit "new". so i viewed that as a bug in the tutorial.
…On 6/1/18, Joseph ***@***.***> wrote:
Hi! Thanks for the PR (your very first one to be precise 🎉 ).
Unfortunately, it's not a bug. Ractive instances can be instantiated with or
without `new`. Under the hood, Ractive has a "constructor guard" which
creates a new instance with `new` if the constructor was like a regular
function.
See https://github.com/ractivejs/ractive/blob/dev/src/Ractive.js#L34
--
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
#154 (comment)
|
i'll re-try it and send so screen captures
…On 6/1/18, Steve ***@***.***> wrote:
well, it didn't work in the tutorial when i pasted the code in.it
worked after l i clicked "fix code" which changed the instantiation to
an explicit "new". so i viewed that as a bug in the tutorial.
On 6/1/18, Joseph ***@***.***> wrote:
> Hi! Thanks for the PR (your very first one to be precise 🎉 ).
> Unfortunately, it's not a bug. Ractive instances can be instantiated with
> or
> without `new`. Under the hood, Ractive has a "constructor guard" which
> creates a new instance with `new` if the constructor was like a regular
> function.
>
> See https://github.com/ractivejs/ractive/blob/dev/src/Ractive.js#L34
>
> --
> You are receiving this because you authored the thread.
> Reply to this email directly or view it on GitHub:
> #154 (comment)
|
Ahh... It might be because the copy-paste code looks like var ractive = Ractive({
target: output,
template: template,
data: { greeting: 'Hello', name: 'world' }
}); but the Fix Code code looks like:
Notice the |
![captureafterfixcode](https://user-images.githubusercontent.com/38381823/40844255-6e9c3c10-6581-11e8-8624-7404607d89e8.PNG)
![capturebeforefixcode](https://user-images.githubusercontent.com/38381823/40844256-6ebab974-6581-11e8-8443-2ae062e52e76.PNG)
this may help--screen captures attached
…On 6/1/18, Joseph ***@***.***> wrote:
Ahh... It might be because the copy-paste code looks like
```js
var ractive = Ractive({
target: output,
template: template,
data: { greeting: 'Hello', name: 'world' }
});
```
but the Fix Code code looks like:
```
var ractive = new Ractive({
target: '#target',
template: '#template',
data: { greeting: 'Hello', name: 'world' }
});
```
Notice the `target` and `template`. If this is the case, this would be the
bug.
--
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
#154 (comment)
|
bug:
var ractive = Ractive({
fix:
var ractive = new Ractive({