Repository navigation
Conversation
a9825e0 to
56d3b70
Compare
|
lgtm. but let's wait for @tbosch before merging |
68f5728 to
b5c1bd2
Compare
|
CI failing: |
|
Imo interpretting false as "remove an attribute" makes sense only for boolean attributes. I need to check what happens with regular DOM if you assign false programatically to an attribute. |
|
@pkozlowski-opensource I'd argue that I want the property handled as a boolean attribute if the assigned value is of type boolean. Otherwise I can assign |
|
So, after thinking about it some more I'm +1 for moving stringify logic to a renderer but -1 for removing attributes on false. IMO this opens a can of worms that we might not to open (or at least not just now). What I mean by this is that all of the sudden we need to think about cases like It all boils down to deciding what is falsy enough to remove an attribute and with JS it is never easy.... |
|
Let's discuss with @tbosch, @mhevery and me before merging this one.
|
… evaluate to false BREAKING CHANGE: - `Renderer.setElementAttribute()` `attributeValue` parameter could be anything (was a string). It is up to the implememtation to decide what to do with the value, - The `DomRenderer` has been updated to remove the attribute when the expression evaluates to `false` (boolean). It used to set the attribute value to `"false"` (string).
|
The current situation is kind of weird, we remove the attribute on The options I have considered: ** new prefix It could work. If we pick this solution, I would prefer a very explicit prefix ("boolattr"). ** boolean value ** IMO this is a "nicer" solution, assign a boolean value means that you deal with a boolean attribute. The drawback is obviously the rare case where you really want also I would prefer that Also I think the is no question |
|
@vicb I hear you. I'm not saying that I've got a perfect solution but at the same time I feel like the current state is slightly less bad as compared to |
There is a unit test for that :) it will be There is no falsy/truthy in the current state of the PR, it's either true or false. This PR as is is not a perfect solution either. I've opened it to start the discussions. |
|
This needs proper design with @mhevery |
|
Can someone poke holes why my simplistic thinking is not correct.
But given that we have 2 why do we need 3?
Assuming that attribute boolean on false does not sound right to me. |
|
@mhevery some component libraries use attributes for styling (e.g. material // @jelbourn On Sun, Dec 13, 2015 at 11:48 AM Miško Hevery notifications@github.com
|
|
|
I'm starting to think that an explicit "?" or similar symbol will make On Sun, Dec 13, 2015 at 2:21 PM Victor Berchet notifications@github.com
|
|
This gives us three choices of dealing with booleans (Please don't focus on exact syntax, which can be fine tuned later, but rather on semantics of it):
Given that To answer @IgorMinar question. Why do we need to know that an attribute is boolean, given that any expression could be Here we need to be able to remove What additional information would reader of code gaing from knowing that an attribute is boolean? |
|
Off the top of my head, the only time you would want setting As far as styling: |
|
My vote is option No. 2 - it's clear, easily distinguishable from other On Mon, Dec 14, 2015 at 10:48 AM Jeremy Elbourn notifications@github.com
|
|
@IgorMinar I have a different story. When people will see |
|
we should throw a clear error message if the result of the expression is On Mon, Dec 14, 2015 at 3:54 PM Victor Berchet notifications@github.com
|
|
@vicb what is the status of this PR? |
|
I think we should merge the PR as is. 'false' removes the attribute stringify otherwise. (We have spent a lot of time debating it, and in grand scheme of things it does not matter much which way we chose.) |
|
I would rather keep the current behavior. If we don't have good reasons, On Mon, Feb 1, 2016 at 8:30 PM Miško Hevery notifications@github.com
|
|
ok, lets close the PR then. |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
… evaluate to false
BREAKING CHANGE:
Renderer.setElementAttribute()attributeValueparameter could be anything (was a string). It is up to the implememtation to decide what to do with the value,DomRendererhas been updated to remove the attribute when the expression evaluates tofalse(boolean). It used to set the attribute value to"false"(string).relates to #4150