-
Notifications
You must be signed in to change notification settings - Fork 10
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
Add "value( v : object )" in AttrEngine #15
Comments
Yes, I was thinking about this. At the end I used string to avoid upcasting by mistake, but I guess we'll need the flexibility of obj. Are you thinking in some specific members or the general MakeAttr helper? |
For now I was going to specialise value only. It's only a requirement for
binding Frameworks and actually shouldn't be allowed through to the browser
DOM. We have to rely on the implementation for that though
…On Mon, 1 Mar 2021 at 13:51, Alfonso Garcia-Caro ***@***.***> wrote:
Yes, I was thinking about this. At the end I used string to avoid
upcasting by mistake, but I guess we'll need the flexibility of obj. Are
you thinking in some specific members or the general MakeAttr helper?
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#15 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACFV3NIJ6YNV3MFHK2ZVUDTBOLXTANCNFSM4YLNW76A>
.
|
My workaround is to overload my derived AttrEngine as follows, and my immediate requirement is satisified
|
I think the engine is justified in converting everything to string (since HTML attributes are string based), but I would like to see it performed in such a way that we can capture the original (typed) value in the DSL implementation before this happens, and control how it is performed. For example, we currently have
if it was more like this
with overloads in the Helper class like this:
then we have given the implementer complete control over how |
Hi David! Again, thanks a lot for the discussion and the comments, I've thinking (and coding) through this. Probably not exactly what you wanted 😅 but I've made the following changes:
So the question is, why have I not added function arguments to convert int and float attributes? (Boolean attributes are already a special case because they have different syntax in HTML.) I actually did it, but I realized there were several conflicting cases so I was worried this could cause more confusion. For example, So that's basically the reason I refrained from adding extra arguments for making attributes from ints or floats. Besides the |
Again, wow. Thank you. I will be checking this out. I had actually convinced myself during discussion that I think though (I need to actually look at the code) that you've given all options here, so again, thank you. Incredible response. |
I can work around it with a specialization if I have to, but frameworks can do things like cache a reference to the JS value that was set (as Sutil does, and possibly Svelte). Having to stringify the value loses information that's useful for binding functionality.
The text was updated successfully, but these errors were encountered: