-
Notifications
You must be signed in to change notification settings - Fork 781
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
Odd issue with svg #43
Comments
I was able to run the program correctly locally using a simple server. The only instance in which svg fails is on CodePen or when opening an index.html file directly in the browser locally (no server). This is weird. |
For me, no problem rendering the SVG clock example running on localhost, Chrome and Safari both. But I can't get the setLocation example to work running locally. Maybe something to do with localhost? I see it works fine on the Gomix server. |
I was just looking at the error from the svg clock in Codepen. The error is being thrown by the patch function" |
@rbiggs not the only bug coming from @jbucaran when I was playing with the "todo example with components approach" i faced some similar issue or maybe it was kinda "length of undefined" from kinda related #39 |
@tunnckoCore I ran into that I was using components approach as well: https://github.com/selfup/hyperapp-idea-box/blob/master/src/views/IdeaBox.js |
@tunnckoCore 🤔 Any code you could share? |
Ah, components, haven't forgotten about #2. We'll get there too, somewhat, somehow. |
@jbucaran yep, i'm working on it ;d |
Router examples using a local server should work. Make sure you are not using a buggy release, there were a few of those recently (like literally the router was broken for a while), during the ES6ish rewrite. |
@tunnckoCore I guess it's one component but with multiple views (stateless functional components in React). Using model as the entire application state tree. Just wanted to try it out haha |
@jbucaran I am on 0.0.9, I can update to see if I get the same behavior Update Everything seems fine with 0.0.11: http://selfup.me/hyperapp-idea-box/ Still amazed at how fast that reloads (refresh render is super fast even from localStorage) mind blown 🎉 Another Update With 10 "todos" from I am using my own |
@jbucaran Hey, SVG rendering is failing for me once again on 0.4.2 It breaks when you assign attributes to the svg. Here's a CodePen for a working but useless svg and the broken one. |
@juxtar IIRC Thanks, I've updated the examples to use So, to summarize, SVG works when running from your own server (gomix, localhost), but fails in CodePen, specifically, when using attributes. Could this be like a CodePen/JsFiddle security feature or something? |
@jbucaran It's actually failing in my localhost too. Am I doing something wrong? The code (and the error) is the same as in the CodePens. |
@juxtar Something obvious is happening on the server that works that we're just missing. |
@juxtar You're right, 0.2.1 works, but 0.4.2 doesn't! This bug is fun.
|
Okay, this is really weird, but it seems SVG elements (namespace) Back in 0.2.1 we were still using commonjs, so the example that works is using the source directly. Maybe this is an uglifyjs issue or how we're using it. |
hmmm... Maybe it's a Browserify issue with the SVG. I've used SVG with JavaScript in the browser without namespaces before. |
Could this be a race condition? Very cool bug, should get the hyperapp bug awards this month. |
Maybe something about how Browserify injects things into the browser, combined with iframes on GoMix causing, well, iframe pain. |
I'll dig more. Now that I know the cause, the fix is rather simple, but now I have to know why .ns is undefined only when using the uglified bundle. |
Well, I noticed on the failing GoMix svg that's JSX that you have viewbox but no namespace. Try putting it in. |
i'm sure the JSX Babel plugin doesn't add it automatically. |
So i'm getting an error: 155:118TypeError: Attempted to assign to readonly property. |
So after looking at the clock and playing with it locally I think I see why it sometimes doesn't work. x2 and y2 are attributes on the svg line. Therefore we're sometimes getting the error: Attempted to assign to a readonly property. That's because the example is trying to set the value of an attribute dynamically directly on that. Bad boy. Gotta use setAttribute in those cases. |
Bug is/was
|
Fixed in 0.5.0! 💥 |
Yup, I notice after I updated my GoMix to 0.5.0 |
Ok I take 5.0 seems to be a healthy version :) I will update all my things to 5.0 now and report back! |
The svg clock example live here works fine.
But it fails on CodePen or when run locally.
The text was updated successfully, but these errors were encountered: