A little update to this. I tried a different approach, hiding the form at the bottom of the page and appending it below a particular comment when a "reply" button is clicked. It seems that even just using append() will cause the same misbaheviour.
That is, if I do not hide the form on page load, it is entirely accessible. But, if it is moved--detached and reinserted into the DOM--I cannot gain focus and clicking any of the editor's buttons will cause the the error. $('button.CommentReply').click(function(event) { var path = $(this).attr('rel') // some stuff here left out for clarity $(this).parent('.CommentMeta') .append($('#comment_form')) .hide() .slideDown('slow'); }); On Sat, Jan 30, 2010 at 9:53 PM, brian <zijn.digi...@gmail.com> wrote: > jquery-1.4.1 > Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.7) Gecko/20100106 > Ubuntu/9.10 (karmic) Firefox/3.5.7 > > Using Scott Storborg's fork of jwysiwyg [1], when loading a form > through $.ajax() the editor area cannot get focus. If I open the > "source" pane and type in there, once I then close the pane, the text > will appear inside the editor. However, I cannot do anything with the > text. It seems that all keydown events are ignored. > > The script that is returned by the AJAX call is: > > $(function() {$('#CommentBody').wysiwyg({ > controls: { > // lots of key: val pairs ... > } > }); > > > > If I click on one of the buttons, I get the following error: > > uncaught exception: [Exception... "Component returned failure code: > 0x80004005 (NS_ERROR_FAILURE) [nsIDOMNSHTMLDocument.execCommand]" > nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: > http://mi_mtl.apollo/js/lib/jquery.wysiwyg.storborg.js :: anonymous :: > line 595" data: no] > > anonymous(form#CommentAddForm add, "handle", Object > name=data)jquery-1.4.1.js (line 1020) > anonymous(form#CommentAddForm add, "submit", function(), Object > name=data)jquery-1.4.1.js (line 1572) > anonymous()jquery-1.4.1.js (line 2331) > anonymous([form#CommentAddForm add selector=form context=document], > function(), Object name=args)jquery-1.4.1.js (line 572) > anonymous(function(), Object name=args)jquery-1.4.1.js (line 240) > anonymous("submit", Object name=data, function())jquery-1.4.1.js (line 2330) > anonymous(function())jquery-1.4.1.js (line 2495) > anonymous(textarea#CommentBody, Object)jquery.w...orborg.js (line 428) > Wysiwyg(textarea#CommentBody, Object)jquery.w...orborg.js (line 110) > Wysiwyg(textarea#CommentBody, Object)jquery.w...orborg.js (line 111) > anonymous()jquery.w...orborg.js (line 103) > anonymous([textarea#CommentBody length=1 0=textarea#CommentBody > context=document], function(), Object name=args)jquery-1.4.1.js (line > 572) > anonymous(function(), Object name=args)jquery-1.4.1.js (line 240) > anonymous(Object)jquery.w...orborg.js (line 101) > anonymous()language:en (line 41) > anonymous(function())jquery-1.4.1.js (line 250) > anonymous(function(), Object name=context)jquery-1.4.1.js (line 160) > anonymous(function(), Object name=context) > > > If I add some text through the source pane, select it, and then click > the bold button, I get this: > > uncaught exception: [Exception... "Component returned failure code: > 0x80004005 (NS_ERROR_FAILURE) [nsIDOMNSHTMLDocument.execCommand]" > nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: > http://mi_mtl.apollo/js/lib/jquery.wysiwyg.storborg.js :: anonymous :: > line 595" data: no] > > anonymous(html, "handle", Object name=data)jquery-1.4.1.js (line 1020) > anonymous(Object type=focus timeStamp=1264904061090, [Object > type=focus timeStamp=1264904061090 0=Object], html)jquery-1.4.1.js > (line 1805) > anonymous(Object type=focus timeStamp=1264904061090, [Object > type=focus timeStamp=1264904061090 0=Object], body)jquery-1.4.1.js > (line 1824) > anonymous()jquery-1.4.1.js (line 2352) > anonymous([body 0=body context=body length=1 jquery=1.4.1], > function(), Object name=args)jquery-1.4.1.js (line 572) > anonymous(function(), Object name=args)jquery-1.4.1.js (line 240) > anonymous("focus", Object name=data)jquery-1.4.1.js (line 2351) > anonymous(Object name=fn)jquery-1.4.1.js (line 2495) > anonymous()jquery.w...orborg.js (line 491) > anonymous(Object originalEvent=Event focus type=focus)jquery-1.4.1.js > (line 1884) > anonymous()jquery-1.4.1.js (line 1579) > > When I load the editor in a plain page (no AJAX) all is good. I > suspect this may be a jQuery bug with the way it runs script returned > by ajax(). Can anyone shed some light? > > Starting in safe mode gave the same error. It works fine in Opera, btw. > > [1] http://github.com/storborg/jwysiwyg >