Ticket #100 (closed defect: fixed)
Calling wymeditor.html('') returns the contents of the editor
| Reported by: | jf.hovinne | Owned by: | jf.hovinne |
|---|---|---|---|
| Priority: | major | Milestone: | 0.5 |
| Component: | editor | Version: | trunk |
| Keywords: | api | Cc: |
Description
Calling
wymeditor.html('')
returns the contents of the editor instead of removing the current html. This happens, because empty string is evaluated as false in the function:
Code:
WYMeditor.editor.prototype.html = function(html) {
if(html) jQuery(this._doc.body).html(html);
else return(jQuery(this._doc.body).html());
};
possible fix: Code:
WYMeditor.editor.prototype.html = function(html) {
if(typeof html === 'string') jQuery(this._doc.body).html(html);
else return(jQuery(this._doc.body).html());
};
alternate fix: Code:
WYMeditor.editor.prototype.html = function(html) {
if(typeof html !== 'undefined') jQuery(this._doc.body).html(html);
else return(jQuery(this._doc.body).html());
};
See also http://forum.wymeditor.org/forum/viewtopic.php?t=296
Change History
Note: See
TracTickets for help on using
tickets.