On Mon, Mar 3, 2014 at 9:54 AM, Steve Orvell <[email protected]> wrote:
> Nice element. Here are some answers to your questions: > > >> 1. Is it recommended to use native HTML elements in our elements? If so, >> how we can make a modified version of them? > > > It depends. If a native element serves the need, use it. In this case, the > 'partially checked' feature that you want isn't supported by the native > version so it may not be a good fit. > FYI. Indeterminate checkboxes is part of HTML. The indeterminate state needs to be set through script. http://jsbin.com/ximahenu/1/edit > > 2. Why event.target is replaced with event.srcElement? What is >> event.target now? > > > The event.target is not replaced and it is correct. You should use the > target property instead of the non-standard srcElement property. Events are > re-targeted by ShadowDOM and this is why checking the 'all' checkbox > doesn't give you that element in the event's target property when you > listen on the grouped-checkbox element. There's more info here: > http://www.polymer-project.org/platform/shadow-dom.html. I recommend > listening on the 'group' div and the 'all' checkbox separately. > > 3. How can I avoid using "that"? > > > Polymer supports declarative event handlers. See the Declarative events > section here: http://www.polymer-project.org/docs/polymer/polymer.html. > > One other comment: it's improper to query the element's children in the > ready method. At this time, the element is not guaranteed to have any > children. Also, the set of children is dynamic. In this case, it's probably > best simply to query the children when the 'all' checkbox is checked. > > Sometimes, you need to do some processing on an element's children. As of > polymer, 0.2, we've included a 'domReady' method which is called at a time > when the element's initial set of children are guaranteed to exist. To > handle dynamically added/removed children, a mutation observer should be > used. > > > On Sun, Mar 2, 2014 at 6:49 PM, Mohsen Azimi <[email protected]> wrote: > >> To make it clear by what I mean by "some checked" I've implemented it. In >> this sample, if you check some of the checkboxes, all checkbox will show >> "some selected" status: >> >> http://jsbin.com/cogowopu/2/edit >> >> >> On Sunday, March 2, 2014 3:25:52 PM UTC-8, Mohsen Azimi wrote: >>> >>> Hi, >>> >>> I just started using Polymer. It's great and easy to pick up. My first >>> element is a grouped checkbox. Like ones that exist in native platforms. >>> There is a "select all" checkbox that select all options. >>> >>> Here is my element: >>> http://jsbin.com/cogowopu/1/edit >>> >>> I have three questions: >>> >>> 1. Is it recommended to use native HTML elements in our elements? If so, >>> how we can make a modified version of them? In this case, I need a checkbox >>> that supports "some checked" statue. (usually a solid square inside of it). >>> I want to use the CSS that defines checkbox appearance so I can make my >>> modified version looks like native ones in each platform. Where can I get >>> that CSS? >>> >>> 2. Why event.target is replaced with event.srcElement? What is >>> event.target now? >>> >>> 3. How can I avoid using "that"? >>> >> Follow Polymer on Google+: plus.google.com/107187849809354688692 >> --- >> You received this message because you are subscribed to the Google Groups >> "Polymer" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/polymer-dev/a07ad24f-36d9-46a4-aa17-a44e45833ac8%40googlegroups.com >> . >> >> For more options, visit https://groups.google.com/groups/opt_out. >> > > Follow Polymer on Google+: plus.google.com/107187849809354688692 > --- > You received this message because you are subscribed to the Google Groups > "Polymer" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/polymer-dev/CA%2BrMWZgni8233YDRmqQG1pg3wMQeFMyhGg5n_pXc_u4%3DeoQ71Q%40mail.gmail.com > . > > For more options, visit https://groups.google.com/groups/opt_out. > -- erik Follow Polymer on Google+: plus.google.com/107187849809354688692 --- You received this message because you are subscribed to the Google Groups "Polymer" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/CAJ8%2BGojcyynLEy69Vod6PWbwbP5-6G5ESeMz1duv2PD8jQmibw%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
