r52416 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r52415‎ | r52416 | r52417 >
Date:21:20, 25 June 2009
Author:yaron
Status:deferred
Tags:
Comment:
Added handling in Javacript for "\r" newline character
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormInputs.inc (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_FormInputs.inc
@@ -363,11 +363,13 @@
364364 $autocomplete_string = "[['" . implode("'], ['", $autocomplete_values) . "']]";
365365 // replace any newlines in the string, just to avoid breaking the Javascript
366366 $autocomplete_string = str_replace("\n", ' ', $autocomplete_string);
 367+ $autocomplete_string = str_replace("\r", ' ', $autocomplete_string);
367368 $javascript_text .= "autocompletestrings['$options_str_key'] = $autocomplete_string;\n";
368369 }
369370 if ($cur_value) {
370371 // replace newlines with the literal '\n' to not break the Javascript
371372 $cur_value = str_replace("\n", '\n', $cur_value);
 373+ $cur_value = str_replace("\r", '\r', $cur_value);
372374 $text .= "document.getElementById('$input_id').value = \"$cur_value\"\n";
373375 }
374376 $text .= "/* ]]> */</script>\n";

Status & tagging log