Skip to content

Should not try to read optional props from a document fragment #1139

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

Closed
cheapsteak opened this issue Aug 10, 2015 · 5 comments
Closed

Should not try to read optional props from a document fragment #1139

cheapsteak opened this issue Aug 10, 2015 · 5 comments

Comments

@cheapsteak
Copy link
Contributor

fiddle: http://jsfiddle.net/o65b85e1/1/

var Foo = Vue.extend({
    props: {
        optionalProp: {
            type: Number,
            required: false
        }
    }
})

new Foo({
    el: document.createDocumentFragment()
})

results in:

Uncaught TypeError: el.getAttribute is not a function
@yyx990803
Copy link
Member

Hmm, looks like all props should be just skipped in this case. But under what situation would a fragment be passed to the instance?

@cheapsteak
Copy link
Contributor Author

Probably not useful for practical usage, but I was trying to get Vue working again in the framework benchmark :)

http://jsfiddle.net/garnwraly/nfd216t3/1/

@yyx990803
Copy link
Member

Hah, that seems to be a lot faster than the old version...

@cheapsteak
Copy link
Contributor Author

Yeah :D
A friend at work is saying Vue's a lot slower than React for style-attribute based animations, I was thinking that can't be right, and even if it is slower it can't be by much
Found the benchmarks from a couple months ago, looks like Vue's about twice as fast as React
http://jsfiddle.net/garnwraly/jkbqk8xo/5/

@yyx990803
Copy link
Member

Well, the bottleneck for style-attribute-based animations is almost never the framework, but the properties you are animating ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants