Closed rsaccon closed 12 years ago
The dynamically generated element must be in the dom tree when activate
is called.
yes, of course, and it is. I have no idea what is the reason of this error, somehow it seems to come from selection
Yes, the selection seems to be null. But this should not possible since in activate
the element's focus
method is called.
I will do some experimentation with my own barebone content editable wrapper, maybe this will shed some light on this issue.
Please make really sure that the element is in the DOM. As far as I know SproutCore defers the DOM insertion to synchronize bindings.
Well, I did also manually activate proper, at that stage it is sure stuff is in DOM
I did this:
var div = document.createElement('div');
document.body.appendChild(div);
var proper = new Proper();
proper.activate(div);
And it worked in Google Chrome 15 on Ubuntu. Can you try this on your Mac?
that works as expected (on the same page as the sproutcore stuff). but if I choose a domnode to activate which has been generated by a handlebar template, again the same error message. Maybe there is some overlapping in the setup of bindungs over the DOM node, from sproutcore and backbone inspired proper.js
It's true that proper uses Backbone's Event object, but nothing else from Backbone. Therefore, I don't think that this is caused by a overlapping between proper and Sproutcore. I suspect that this error is caused by a weird behavior of SproutCore or Handlebars. I can look into this if you give me some code.
the problem seems to be unique to my app, I created a jsfiddle, and there it works. I am closing the issue, it is definitely not propers fault. Thanks for the help.
observed this on latest Chrome and Safari on Mac OS X Lion.
Everything fine if the HTML node where I want to activate the editor exists statically at page load time.
I am using sproutcore and the app gets generated from JS templates. Now I try to activate the editor on a Node which has been dynamically generated via JS, and I get:
Chrome Error:
Safari Error: