Closed (won't fix)
Project:
Drupal core
Version:
5.x-dev
Component:
base system
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
22 Dec 2006 at 11:54 UTC
Updated:
21 Jan 2007 at 11:50 UTC
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.