Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(258)

Issue 59220044: make ref bindable (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 2 months ago by rafaelw
Modified:
11 years, 2 months ago
Base URL:
https://github.com/Polymer/TemplateBinding.git@master
Visibility:
Public.

Description

make ref bindable R=arv BUG= Committed: https://github.com/Polymer/TemplateBinding/commit/2799341

Patch Set 1 #

Patch Set 2 : moar #

Patch Set 3 : moar #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+78 lines, -1 line) Patch
M src/TemplateBinding.js View 1 5 chunks +47 lines, -1 line 4 comments Download
M tests/tests.js View 2 chunks +31 lines, -0 lines 0 comments Download

Messages

Total messages: 11
rafaelw
ptal. note that having Template capture bind here is only necessary in cases where MutationObservers ...
11 years, 2 months ago (2014-02-06 23:31:32 UTC) #1
rafaelw
Committed patchset #3 manually as r2799341 (presubmit successful).
11 years, 2 months ago (2014-02-06 23:56:59 UTC) #2
arv
https://codereview.appspot.com/59220044/diff/40001/src/TemplateBinding.js File src/TemplateBinding.js (right): https://codereview.appspot.com/59220044/diff/40001/src/TemplateBinding.js#newcode483 src/TemplateBinding.js:483: templateObserver.observe(this, { attributes: true, Why are we doing this ...
11 years, 2 months ago (2014-02-07 18:43:42 UTC) #3
rafaelw
https://codereview.appspot.com/59220044/diff/40001/src/TemplateBinding.js File src/TemplateBinding.js (right): https://codereview.appspot.com/59220044/diff/40001/src/TemplateBinding.js#newcode483 src/TemplateBinding.js:483: templateObserver.observe(this, { attributes: true, It's an interesting point. Do ...
11 years, 2 months ago (2014-02-09 00:33:16 UTC) #4
arv
I guess I just don't understand the motivation for treating the ref attribute this way. ...
11 years, 2 months ago (2014-02-10 16:13:54 UTC) #5
rafaelw1
I willing to be convinced. My answer is that ref is useful as a bindable ...
11 years, 2 months ago (2014-02-11 22:02:09 UTC) #6
John Messerly
Really good question :) So with "ref" the idea seems to be that it's a ...
11 years, 2 months ago (2014-02-11 23:10:35 UTC) #7
John Messerly
(oops, meant to CC Pete, he is pretty interested in this topic too) On Tue, ...
11 years, 2 months ago (2014-02-11 23:11:29 UTC) #8
John Messerly
https://codereview.appspot.com/59220044/diff/40001/src/TemplateBinding.js File src/TemplateBinding.js (right): https://codereview.appspot.com/59220044/diff/40001/src/TemplateBinding.js#newcode443 src/TemplateBinding.js:443: return Element.prototype.bind.call(this, name, value, oneTime); here's a question, can ...
11 years, 2 months ago (2014-02-11 23:14:51 UTC) #9
blois
Not to rathole, but my initial feedback on ref was that I expected it to ...
11 years, 2 months ago (2014-02-11 23:32:37 UTC) #10
rafaelw1
11 years, 2 months ago (2014-02-25 21:17:50 UTC) #11
I'm willing to consider allowing the ref binding to accept both a string
which is treated as an id reference, or an actual template element
reference.

I'm interested in hearing specific use cases for the later.


On Tue, Feb 11, 2014 at 3:32 PM, Pete Blois <blois@google.com> wrote:

> Not to rathole, but my initial feedback on ref was that I expected it to
> take an HTMLTemplateElement instance rather than an ID. The issue that I
> was running into was that I had a complex custom element hierarchy and
> wanted to pass an item renderer (template) from one location to a deeply
> nested location. For 'repeat', I was expecting a property which is the
> array to iterate over. That said, with complex controls and virtualization
> I've mostly moved away from template repeat- but it would be nice if the
> APIs could be consistent.
>
>
> On Tue, Feb 11, 2014 at 3:10 PM, John Messerly <jmesserly@google.com>wrote:
>
>> (oops, meant to CC Pete, he is pretty interested in this topic too)
>>
>>
>> On Tue, Feb 11, 2014 at 3:09 PM, John Messerly <jmesserly@google.com>wrote:
>>
>>> Really good question :)
>>>
>>> So with "ref" the idea seems to be that it's a DOM property of
>>> HTMLTemplateElement, so it makes sense to reflect the property to the
>>> attribute and vice versa. Likewise, it makes sense for it to be bindable.
>>>
>>> Currently "bind" and "repeat" are not properties of HTMLTemplateElement.
>>> In some sense "bind" corresponds to "model". They aren't really interpreted
>>> except as part of <template> instantiation.
>>>
>>> IMHO, it seems like generally a good thing if DOM attributes have
>>> corresponding properties, and most of them do. At that point it would be
>>> nice if "bind" and "repeat" worked the same as "ref": the property responds
>>> to attribute changes, and is data bindable via Node.bind. Whether it is
>>> useful or not, I'm not sure. I think the main benefit would be general
>>> consistency (especially if "bind" and "model" could be reconciled) but if
>>> no one has asked for it, maybe not high priority.
>>>
>>>
>>> On Tue, Feb 11, 2014 at 2:02 PM, Rafael Weinstein
<rafaelw@google.com>wrote:
>>>
>>>> I willing to be convinced. My answer is that ref is useful as a
>>>> bindable attribute. It's not to hard to imagine switching what is getting
>>>> stamped based on something dynamic. Binding to the bind/repeat/if seems
>>>> less obviously useful (at least without asking questions why you didn't do
>>>> it differently).
>>>>
>>>> John?
>>>>
>>>>
>>>> On Mon, Feb 10, 2014 at 8:13 AM, Erik Arvidsson <arv@chromium.org>wrote:
>>>>
>>>>> I guess I just don't understand the motivation for treating the ref
>>>>> attribute this way. Why does this one warrant two way binding for the
>>>>> attribute. We don't allow it for any other attribute .
>>>>>
>>>>> On Sat, Feb 8, 2014 at 7:33 PM,  <rafaelw@chromium.org> wrote:
>>>>> >
>>>>> >
>>>>> https://codereview.appspot.com/59220044/diff/40001/src/TemplateBinding.js
>>>>> > File src/TemplateBinding.js (right):
>>>>> >
>>>>> >
>>>>>
https://codereview.appspot.com/59220044/diff/40001/src/TemplateBinding.js#new...
>>>>> > src/TemplateBinding.js:483: templateObserver.observe(this, {
>>>>> attributes:
>>>>> > true,
>>>>> > It's an interesting point. Do you think that the attribute values of
>>>>> if,
>>>>> > bind, & repeat should be observed and react dynamically as well? ref
>>>>> is
>>>>> > somewhat different in that it is bindable, where-as there's no way to
>>>>> > bind to the attribute value of bind, if & repeat.
>>>>> >
>>>>> >
>>>>> > On 2014/02/07 18:43:42, arv wrote:
>>>>> >>
>>>>> >> Why are we doing this for ref but not for bind and repeat?
>>>>> >
>>>>> >
>>>>> > https://codereview.appspot.com/59220044/
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> erik
>>>>>
>>>>
>>>>
>>>
>>
>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b