Closed ghost closed 8 years ago
Is <div id="fooBar">
empty?
It was not. Works if empty. Before it doesn't need to be empty. It could have nodes inside. Before it works like other VD implementations without this issue.
I also notice that CSS sometimes now become a object object.
It was not. Works if empty. Before it doesn't need to be empty. It could have nodes inside. Before it works like other VD implementations without this issue.
Yes, after #120 it was changed.
I also notice that CSS sometimes now become a object object.
Sometimes? I need case.
If you see how DOM normally works with appendChild and insertBefore, you can insert even if not empty. Mount should work like that, or?
No, it shouldn't. I want to be able to adopt existing DOM tree.
For CSS. Try to set a click event or css style inside a node you use as a reference in a component.
var InputComponent = vidom.createComponent({
onRender : function() {
return vidom.createElement('div')
.attrs({ className : 'input' })
.children(
this.setDomRef( // add "control" reference to get corresponding DOM node further
'control',
vidom.createElement('input')
.attrs({
type : 'text',
css: { width:"200px", height:"4200px"}, // not working!!
className : 'input__control',
onClick: function() { alert("Hello, World!!") }, // not working!!
onFocus : this.onFocus.bind(this)
})));
},
onMount : function() {
this.getDomRef('control').focus(); // use reference got in onRender()
},
onUnmount : function() {
},
onFocus : function() {
}
});
css: { width:"200px", height:"4200px"}
there's no such attribute, you have to use style
instead of css
Ok. I tried that too. Didnt work
And the event handler didnt work
vidom.createElement
??? vidom has no such method. Total mess.
Ok. I experimenting with sub/functions to figure out why it wont work. I tried to create a sub/function that could write some console.log data and tried to avoid conflictt with native methods.
var InputComponent = vidom.createComponent({
onRender : function() {
return vidom.createNode('div')
.attrs({ className : 'input' })
.children(
this.setDomRef( // add "control" reference to get corresponding DOM node further
'control',
vidom.createNode('input')
.attrs({
type : 'text',
style: { width:"200px", height:"4200px"}, // not working!!
className : 'input__control',
onClick: function() { alert("Hello, World!!") }, // not working!!
onFocus : this.onFocus.bind(this)
})));
},
onMount : function() {
this.getDomRef('control').focus(); // use reference got in onRender()
},
onUnmount : function() {
},
onFocus : function() {
}
});
This code works as expected:
And a hello wold pops up when you click? Or you can have double events? Not working here. Will check later
"Hello, World!!" popup shows as expected
I can't mount this anymore
Nothing get attached if I look into the console.