[Wikiwyg-dev] Issue in 'proto.format_span' for IE
Hi,
I've found something that makes IE crash in my tests.
The problem comes from the file *wikitext.js*, more precisely in the
function '*proto.format_span()*' : on line 713. When there is a link
that comes from wikitext then I switch to the wysiwyg mode ( the link
comes between <span> </span> ). After that if I want to go back to
wikitext mode IE just doesn't make the conversion.
After some tests, I have found in the code : ( L719) :
*var style = element.getAttribute('style', 'true' );
if (!style ) {
this.pass(element);
return;
}*
Firefox 1.5 goes into this test ( I mean firefox execute
this.pass(element) and return ), but IE doesn't do so.
IE executes the lines after ( if ( style.match(/\bbold\b/)) ) and just
crash.
So I've made a little patch :
-----------------------------------------------------------
Here is the original code :
-----------------------------------------------------------
proto.format_span = function(element) {
if (this.is_opaque(element)) {
this.handle_opaque_phrase(element);
return;
}
var style = element.getAttribute('style','true');
* if (!style ) {
this.pass(element);
return;
}*
this.assert_space_or_newline();
* if
(style.match(/\bbold\b/)) //
make IE crash*
this.appendOutput(this.config.markupRules.bold[1]);
if (style.match(/\bitalic\b/))
this.appendOutput(this.config.markupRules.italic[1]);
if (style.match(/\bunderline\b/))
this.appendOutput(this.config.markupRules.underline[1]);
if (style.match(/\bline-through\b/))
this.appendOutput(this.config.markupRules.strike[1]);
this.no_following_whitespace();
this.walk(element);
if (style.match(/\bline-through\b/))
this.appendOutput(this.config.markupRules.strike[2]);
if (style.match(/\bunderline\b/))
this.appendOutput(this.config.markupRules.underline[2]);
if (style.match(/\bitalic\b/))
this.appendOutput(this.config.markupRules.italic[2]);
if (style.match(/\bbold\b/))
this.appendOutput(this.config.markupRules.bold[2]);
}
-----------------------------------------------------------
Here is the patch :
-----------------------------------------------------------
proto.format_span = function(element) {
if (this.is_opaque(element)) {
this.handle_opaque_phrase(element);
return;
}
var style = element.getAttribute('style','true');
if (!style ) {
this.pass(element);
return;
}
if ( !Wikiwyg.is_ie ) {
this.assert_space_or_newline();
if (style.match(/\bbold\b/))
this.appendOutput(this.config.markupRules.bold[1]);
if (style.match(/\bitalic\b/))
this.appendOutput(this.config.markupRules.italic[1]);
if (style.match(/\bunderline\b/))
this.appendOutput(this.config.markupRules.underline[1]);
if (style.match(/\bline-through\b/))
this.appendOutput(this.config.markupRules.strike[1]);
}
this.no_following_whitespace();
this.walk(element);
if ( !Wikiwyg.is_ie ) {
if (style.match(/\bline-through\b/))
this.appendOutput(this.config.markupRules.strike[2]);
if (style.match(/\bunderline\b/))
this.appendOutput(this.config.markupRules.underline[2]);
if (style.match(/\bitalic\b/))
this.appendOutput(this.config.markupRules.italic[2]);
if (style.match(/\bbold\b/))
this.appendOutput(this.config.markupRules.bold[2]);
}
}
-----------------------------------------------------------
Regards.
Jean-Nicolas.
This archive was generated by a fusion of
Pipermail (Mailman edition) and
MHonArc.