Please add a global function check_js() to drupal. I found a nice code snippet in common.inc used inside the function drupal_to_js.
function check_js($var) {
// alters strings to be HTML-safe strings, i.e. with <, > and & escaped
return '"'. str_replace(array("\r", "\n", "<", ">", "&"),
array('\r', '\n', '\x3c', '\x3e', '\x26'),
addslashes($var)) .'"';
}
Now as a workaround i created such a function with a different name for a module, but it will be better to have it implemented as a common function for easy reuse.
Comments
Comment #1
hass commentedlogic is already build in
drupal_to_js()function... so i close this case.