Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Component Boolean Arguments #407
I'm not convinced if this small improvement is worth introducing another syntax that is:
Since I don't find the
It's worth noticing that
The main intention of this RFC is not to save few keystrokes but rather bring unison in how arguments work with how attribute works.
It's possible that I'm thinking of this incorrectly, but in my brain
I understand the desire to make it function more like HTML however I think in this case it would be more confusing that passing an argument without a value somehow defaults the value to
As an aside, I think that in HTML, valueless attributes that affect rendering or behavior do so by way of either css selectors (
For example, after adding
button.attributes.hasOwnProperty('disabled') true button.attributes.disabled disabled="" button.getAttribute('disabled') ""
[Suggestion] So I guess what I think would be cool would be if this didn't set the value to
tl;dr defaulting argument values to
@hakubo I don't see bringing unison between attributes and arguments like a very desirable goal.
Also at first glance this syntax reminds me a bit more more of positional arguments (which are not a thing in angle-bracket components, and IDK if they will ever be) than of valueless attributes.
First, I don't think that the current API (
Second, I would expect that
While I don't think it'd be that big of a deal if it was supported, I think we should resist any new complexity to the API unless there's a clear win.
I understand the desire to make it function more like HTML however I think in this case it would be more confusing that passing an argument without a value somehow defaults the value to true."
You might be coming from your experience with Ember templates and Angle Brackets as you know them currently. I strongly believe that for new comers, people that come from HTML, React, Vue, Polymer etc it would be natural to think that
"Also at first glance this syntax reminds me a bit more more of positional arguments (which are not a thing in angle-bracket components, and IDK if they will ever be) than of valueless attributes."
It does because you know they existed. Again for new comers that would not be an issue. What will be an issue is a realization that they cannot use knowledge that they already posses about passing properties to HTML elements
"Second, I would expect that <FooBar @baz>, if supported (which I'd oppose), would do something like
, and though that would be more in line with my personal expectations, I'd rather it not be supported either given the limited gains and the movement towards tagless components.
What you're describing here IS possible but you do that with components attributes/properties not arguments. e.g.
Similar to what is described here: https://developers.google.com/web/fundamentals/web-components/customelements
but that feels clunky IMO