These are chat archives for canjs/canjs

15th
May 2015
dylanrtt
@dylanrtt
May 15 2015 17:32
is there a way to sort a can.List by multiple fields without using a comparator function?
Chris Gomez
@akagomez
May 15 2015 17:32
@dylanrtt Not currently.
Chris Gomez
@akagomez
May 15 2015 18:14
@justinbmeyer is {{{key}}} different from can.stache.safeString()?
David Luecke
@daffl
May 15 2015 18:51
{{{key}}} is the opposite
It prints it unescaped
Chris Gomez
@akagomez
May 15 2015 19:16
Thanks.
Gerard Finnerty
@halcyonandon
May 15 2015 20:42
hey, i hit a weird issue with nested mustache conditions where a child component renders when it shouldn't without the custom tag wrapper... trying to create a jsbin for it now
Adam L Barrett
@BigAB
May 15 2015 20:52

Probably a question I should already know the answer to, but since I don’t, if you create a can.Component can you the do somehthing like

var myComponent = new MyComponent();
$(‘body’).append(myComponent);

…make a node instance of the component? Is that a thing, or did I just make that up in my head?

Gerard Finnerty
@halcyonandon
May 15 2015 21:23
I don't know if that'll work, what I do is extend components

import can from 'can/util/string';
import TemplateID from './someComponent.stache';
import SomeComponent from '../shared/features/create/someComponent/someComponent';

export default SomeComponent.extend( {
tag : 'extcomp',
template : can.view('TemplateID')
});

ES6 module syntax aside.... I extend the base component with a new template, extra events or whatever
Adam L Barrett
@BigAB
May 15 2015 21:43
@halcyonandon I am not really talking about Inheritance as much as creating a DOM HTMLElement (or whatever) instance

Like web-components can do something like this:

var XFoo = document.registerElement('x-foo');
document.body.appendChild(new XFoo());

Can can.Component do the same?

(does can use registerElement?)
Gerard Finnerty
@halcyonandon
May 15 2015 21:48
ah gotcha, not sure off hand there
Here is the weird issue I'm seeing... in a component, when attempting to conditionally render a child component using if/else logic, the if condition hits correctly, but still renders the else condition if it is a component, but it either only renders the child component content (not the tag) or it renders the child component tag then outside of it it renders its content
logic like this
{{#if somevar}}
<button class="btn btn-link"> something </button>
{{else}}
<somecomponent></somecomponent>
{{/if}}
it will render both the button and the content of somecomponent
i tried {{#somevar}}, {{#unless somevar}}, {{#is somevar.length 1}}, ect and it behaves like that always... i didnt find any broken markup or anything like that either
Gerard Finnerty
@halcyonandon
May 15 2015 21:59
nvm, figured it out... it barfs on camelCase... i figured it was okay to use camelCase for tags assuming they were converted to lowercase automatically, i was wrong