Firefox 5.x JS errors when applying elRTE to hidden element
Added by Jake Wilson 10 months ago
I found a bug I can reproduce every time. I have a textarea inside a div that is initially hidden when the page loads.
<div id='featured_fields'>
<textarea id='wysiwyg'></textarea>
</div>
When I apply the javascript:
$('textarea#wysiwyg').elrte();
Javascript in Firefox throws an exception. Here is the Firebug output:
uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMNSHTMLDocument.execCommand]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://www.mydomain.com/js/backend/libs/elrte.full.js :: <TOP_LEVEL> :: line 1250" data: no]
Same error with elrte.min.js (but different line number obviously).
The bug does not occur in Chrome.
Replies (5)
RE: Firefox 5.x JS errors when applying elRTE to hidden element
-
Added by Dmitry Levashov 10 months ago
This is known problem with designMode on hidden elements - every browser do it by own
RE: Firefox 5.x JS errors when applying elRTE to hidden element
-
Added by Troex Nevelin 10 months ago
You need to init elRTE after the element is shown
RE: Firefox 5.x JS errors when applying elRTE to hidden element
-
Added by Steven Applegate 9 months ago
Just ran across this problem as well. If your textarea is hidden, you need to call .show() on the element before you call .elrte().
In my case, my issue was that the textarea was wrapped in a div that was hidden. I had to call .show() on the parent div, and then initialize elrte to fix the issue.
Hope that helps.
RE: Firefox 5.x JS errors when applying elRTE to hidden element
-
Added by E R 6 months ago
Thanks for the fix guys. I was having the same problem in Firefox 8.
-Twitch
RE: Firefox 5.x JS errors when applying elRTE to hidden element
-
Added by Chris Hoopes 5 months ago
Oh wow this completely fixed my problems too. Apparently it works fine in Chrome but for every other browser you have to re-init after you unhide the element. Thanks!
(1-5/5)