--- library/Zend/View/Helper/HtmlElement.php (revision 24165) +++ library/Zend/View/Helper/HtmlElement.php (working copy) @@ -103,13 +103,17 @@ $key = $this->view->escape($key); if (('on' == substr($key, 0, 2)) || ('constraints' == $key)) { - // Don't escape event attributes; _do_ substitute double quotes with singles if (!is_scalar($val)) { // non-scalar data should be cast to JSON first require_once 'Zend/Json.php'; $val = Zend_Json::encode($val); } - $val = preg_replace('/"([^"]*)":/', '$1:', $val); + + // Escape single quotes inside event attribute values. + // This will create html, where the attribute value has + // single quotes around it, and escaped single quotes or + // non-escaped double quotes inside of it + $val = str_replace('\'', ''', $val); } else { if (is_array($val)) { $val = implode(' ', $val);