From 7853189328b16cdf0ce646799aa1364407744f05 Mon Sep 17 00:00:00 2001 From: mark_story Date: Mon, 7 Mar 2011 21:58:11 -0500 Subject: [PATCH] Adding 'style' as a known html attribute. Fixes #1573 --- cake/libs/view/helpers/js.php | 5 ++++- cake/tests/cases/libs/view/helpers/js.test.php | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cake/libs/view/helpers/js.php b/cake/libs/view/helpers/js.php index 5c3571bef..8ecb5c5bc 100644 --- a/cake/libs/view/helpers/js.php +++ b/cake/libs/view/helpers/js.php @@ -428,7 +428,10 @@ class JsHelper extends AppHelper { * @access protected */ function _getHtmlOptions($options, $additional = array()) { - $htmlKeys = array_merge(array('class', 'id', 'escape', 'onblur', 'onfocus', 'rel', 'title'), $additional); + $htmlKeys = array_merge( + array('class', 'id', 'escape', 'onblur', 'onfocus', 'rel', 'title', 'style'), + $additional + ); $htmlOptions = array(); foreach ($htmlKeys as $key) { if (isset($options[$key])) { diff --git a/cake/tests/cases/libs/view/helpers/js.test.php b/cake/tests/cases/libs/view/helpers/js.test.php index b4dfecb60..dd8b279e5 100644 --- a/cake/tests/cases/libs/view/helpers/js.test.php +++ b/cake/tests/cases/libs/view/helpers/js.test.php @@ -402,7 +402,7 @@ CODE; function testSubmitWithMock() { $this->_useMock(); - $options = array('update' => '#content', 'id' => 'test-submit'); + $options = array('update' => '#content', 'id' => 'test-submit', 'style' => 'margin: 0'); $this->Js->TestJsEngine->setReturnValue('dispatchMethod', 'serialize-code', array('serializeform', '*')); $this->Js->TestJsEngine->setReturnValue('dispatchMethod', 'serialize-code', array('serializeForm', '*')); $this->Js->TestJsEngine->setReturnValue('dispatchMethod', 'ajax-code', array('request', '*')); @@ -422,7 +422,7 @@ CODE; $result = $this->Js->submit('Save', $options); $expected = array( 'div' => array('class' => 'submit'), - 'input' => array('type' => 'submit', 'id' => $options['id'], 'value' => 'Save'), + 'input' => array('type' => 'submit', 'id' => $options['id'], 'value' => 'Save', 'style' => 'margin: 0'), '/div' ); $this->assertTags($result, $expected);