From a349c1ee1b78343bdeb0214a5453021a795da87c Mon Sep 17 00:00:00 2001 From: lichunqiang Date: Thu, 5 Nov 2015 12:16:21 +0800 Subject: [PATCH] Changed yii.confirm context bind --- framework/CHANGELOG.md | 1 + framework/UPGRADE.md | 3 ++- framework/assets/yii.js | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index a1a2fbc11a..780fd3f5e1 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -63,6 +63,7 @@ Yii Framework 2 Change Log - Chg #9411: `DetailView` now automatically sets container tag ID in case it's not specified (samdark) - Chg #9953: `TimestampBehavior::getValue()` changed to make value processing consistent with `AttributeBehavior::getValue()` (silverfire) - New #10083: Added wrapper for PHP webserver (samdark) +- Enh #10098: Changed `yii.confirm` context bind to triggered dom element. (lichunqiang) 2.0.6 August 05, 2015 --------------------- diff --git a/framework/UPGRADE.md b/framework/UPGRADE.md index ccad8a6fc5..9f789f3b81 100644 --- a/framework/UPGRADE.md +++ b/framework/UPGRADE.md @@ -25,7 +25,8 @@ initialization to support wider range of allowed characters. Because of this cha See the [Cache Flushing Guide](http://www.yiiframework.com/doc-2.0/guide-caching-data.html#cache-flushing) - If you implement `parseRequest()` or `createUrl()` and rely on parameter names, call `substitutePlaceholderNames()` in order to replace temporary IDs with parameter names after doing matching. - +* The context of `yii.confirm` function in `yii.js` was changed to the triggered dom element. + - If you rewrited the `yii.confirm` function, you can get the triggered dom element as: `this` or `$(this)` to get jquery object. Upgrade from Yii 2.0.5 ---------------------- diff --git a/framework/assets/yii.js b/framework/assets/yii.js index ccf1c96181..da43dd8865 100644 --- a/framework/assets/yii.js +++ b/framework/assets/yii.js @@ -329,7 +329,7 @@ yii = (function ($) { } if (message !== undefined) { - pub.confirm(message, function () { + $.proxy(pub.confirm, this)(message, function () { pub.handleAction($this, event); }); } else {