Skip to content
Browse files

Fixed 1492: jQuery.noConflict() issue

  • Loading branch information...
1 parent e2fa220 commit 1b165448af1716c228acb5b89474890acf0a3ead @mslabko mslabko committed Sep 30, 2012
View
2 framework/validators/CBooleanValidator.php
@@ -84,7 +84,7 @@ public function clientValidateAttribute($object,$attribute)
'{false}'=>$this->falseValue,
));
return "
-if(".($this->allowEmpty ? "$.trim(value)!='' && " : '')."value!=".CJSON::encode($this->trueValue)." && value!=".CJSON::encode($this->falseValue).") {
+if(".($this->allowEmpty ? "jQuery.trim(value)!='' && " : '')."value!=".CJSON::encode($this->trueValue)." && value!=".CJSON::encode($this->falseValue).") {
messages.push(".CJSON::encode($message).");
}
";
View
4 framework/validators/CCaptchaValidator.php
@@ -96,7 +96,7 @@ public function clientValidateAttribute($object,$attribute)
$code=$captcha->getVerifyCode(false);
$hash=$captcha->generateValidationHash($this->caseSensitive ? $code : strtolower($code));
$js="
-var hash = $('body').data('{$this->captchaAction}.hash');
+var hash = jQuery('body').data('{$this->captchaAction}.hash');
if (hash == null)
hash = $hash;
else
@@ -110,7 +110,7 @@ public function clientValidateAttribute($object,$attribute)
if($this->allowEmpty)
{
$js="
-if($.trim(value)!='') {
+if(jQuery.trim(value)!='') {
$js
}
";
View
4 framework/validators/CCompareValidator.php
@@ -159,7 +159,7 @@ public function clientValidateAttribute($object,$attribute)
else
{
$compareAttribute=$this->compareAttribute === null ? $attribute . '_repeat' : $this->compareAttribute;
- $compareValue="\$('#" . (CHtml::activeId($object, $compareAttribute)) . "').val()";
+ $compareValue="jQuery('#" . (CHtml::activeId($object, $compareAttribute)) . "').val()";
$compareTo=$object->getAttributeLabel($compareAttribute);
}
@@ -207,7 +207,7 @@ public function clientValidateAttribute($object,$attribute)
));
return "
-if(".($this->allowEmpty ? "$.trim(value)!='' && " : '').$condition.") {
+if(".($this->allowEmpty ? "jQuery.trim(value)!='' && " : '').$condition.") {
messages.push(".CJSON::encode($message).");
}
";
View
2 framework/validators/CEmailValidator.php
@@ -132,7 +132,7 @@ public function clientValidateAttribute($object,$attribute)
return "
$validateIDN
-if(".($this->allowEmpty ? "$.trim(value)!='' && " : '').$condition.") {
+if(".($this->allowEmpty ? "jQuery.trim(value)!='' && " : '').$condition.") {
messages.push(".CJSON::encode($message).");
}
";
View
2 framework/validators/CNumberValidator.php
@@ -164,7 +164,7 @@ public function clientValidateAttribute($object,$attribute)
if($this->allowEmpty)
{
$js="
-if($.trim(value)!='') {
+if(jQuery.trim(value)!='') {
$js
}
";
View
2 framework/validators/CRangeValidator.php
@@ -88,7 +88,7 @@ public function clientValidateAttribute($object,$attribute)
$range=CJSON::encode($range);
return "
-if(".($this->allowEmpty ? "$.trim(value)!='' && " : '').($this->not ? "$.inArray(value, $range)>=0" : "$.inArray(value, $range)<0").") {
+if(".($this->allowEmpty ? "jQuery.trim(value)!='' && " : '').($this->not ? "jQuery.inArray(value, $range)>=0" : "jQuery.inArray(value, $range)<0").") {
messages.push(".CJSON::encode($message).");
}
";
View
2 framework/validators/CRegularExpressionValidator.php
@@ -85,7 +85,7 @@ public function clientValidateAttribute($object,$attribute)
$pattern .= preg_replace('/[^igm]/', '', $flag);
return "
-if(".($this->allowEmpty ? "$.trim(value)!='' && " : '').($this->not ? '' : '!')."value.match($pattern)) {
+if(".($this->allowEmpty ? "jQuery.trim(value)!='' && " : '').($this->not ? '' : '!')."value.match($pattern)) {
messages.push(".CJSON::encode($message).");
}
";
View
2 framework/validators/CRequiredValidator.php
@@ -98,7 +98,7 @@ public function clientValidateAttribute($object,$attribute)
'{attribute}'=>$object->getAttributeLabel($attribute),
));
return "
-if($.trim(value)=='') {
+if(jQuery.trim(value)=='') {
messages.push(".CJSON::encode($message).");
}
";
View
2 framework/validators/CStringValidator.php
@@ -164,7 +164,7 @@ public function clientValidateAttribute($object,$attribute)
if($this->allowEmpty)
{
$js="
-if($.trim(value)!='') {
+if(jQuery.trim(value)!='') {
$js
}
";
View
2 framework/validators/CUrlValidator.php
@@ -149,7 +149,7 @@ public function clientValidateAttribute($object,$attribute)
if($this->allowEmpty)
{
$js="
-if($.trim(value)!='') {
+if(jQuery.trim(value)!='') {
$js
}
";
View
14 framework/web/helpers/CHtml.php
@@ -905,13 +905,13 @@ public static function checkBoxList($name,$select,$data,$htmlOptions=array())
array_unshift($items,$item);
$name=strtr($name,array('['=>'\\[',']'=>'\\]'));
$js=<<<EOD
-$('#$id').click(function() {
- $("input[name='$name']").prop('checked', this.checked);
+jQuery('#$id').click(function() {
+ jQuery("input[name='$name']").prop('checked', this.checked);
});
-$("input[name='$name']").click(function() {
- $('#$id').prop('checked', !$("input[name='$name']:not(:checked)").length);
+jQuery("input[name='$name']").click(function() {
+ jQuery('#$id').prop('checked', !jQuery("input[name='$name']:not(:checked)").length);
});
-$('#$id').prop('checked', !$("input[name='$name']:not(:checked)").length);
+jQuery('#$id').prop('checked', !jQuery("input[name='$name']:not(:checked)").length);
EOD;
$cs=Yii::app()->getClientScript();
$cs->registerCoreScript('jquery');
@@ -2110,9 +2110,9 @@ protected static function clientChange($event,&$htmlOptions)
}
if($live)
- $cs->registerScript('Yii.CHtml.#' . $id, "$('body').on('$event','#$id',function(){{$handler}});");
+ $cs->registerScript('Yii.CHtml.#' . $id, "jQuery('body').on('$event','#$id',function(){{$handler}});");
else
- $cs->registerScript('Yii.CHtml.#' . $id, "$('#$id').on('$event', function(){{$handler}});");
+ $cs->registerScript('Yii.CHtml.#' . $id, "jQuery('#$id').on('$event', function(){{$handler}});");
unset($htmlOptions['params'],$htmlOptions['submit'],$htmlOptions['ajax'],$htmlOptions['confirm'],$htmlOptions['return'],$htmlOptions['csrf']);
}
View
4 framework/web/widgets/CActiveForm.php
@@ -345,7 +345,7 @@ public function run()
$cs->registerCoreScript('jquery');
$cs->registerScript('CActiveForm#focus',"
if(!window.location.hash)
- $('".$this->focus."').focus();
+ jQuery('".$this->focus."').focus();
");
}
return;
@@ -366,7 +366,7 @@ public function run()
$options=CJavaScript::encode($options);
$cs->registerCoreScript('yiiactiveform');
$id=$this->id;
- $cs->registerScript(__CLASS__.'#'.$id,"\$('#$id').yiiactiveform($options);");
+ $cs->registerScript(__CLASS__.'#'.$id,"jQuery('#$id').yiiactiveform($options);");
}
/**
View
8 framework/web/widgets/captcha/CCaptcha.php
@@ -136,14 +136,14 @@ public function registerClientScript()
return;
$js.="
-$(document).on('click', '$selector', function(){
- $.ajax({
+jQuery(document).on('click', '$selector', function(){
+ jQuery.ajax({
url: ".CJSON::encode($url).",
dataType: 'json',
cache: false,
success: function(data) {
- $('#$id').attr('src', data['url']);
- $('body').data('{$this->captchaAction}.hash', [data['hash1'], data['hash2']]);
+ jQuery('#$id').attr('src', data['url']);
+ jQuery('body').data('{$this->captchaAction}.hash', [data['hash1'], data['hash2']]);
}
});
return false;
View
8 framework/zii/widgets/grid/CButtonColumn.php
@@ -243,11 +243,11 @@ function() {
$confirmation
var th=this;
var afterDelete=$this->afterDelete;
- $.fn.yiiGridView.update('{$this->grid->id}', {
+ jQuery.fn.yiiGridView.update('{$this->grid->id}', {
type:'POST',
- url:$(this).attr('href'),$csrf
+ url:jQuery(this).attr('href'),$csrf
success:function(data) {
- $.fn.yiiGridView.update('{$this->grid->id}');
+ jQuery.fn.yiiGridView.update('{$this->grid->id}');
afterDelete(th,true,data);
},
error:function(XHR) {
@@ -272,7 +272,7 @@ protected function registerClientScript()
{
$function=CJavaScript::encode($button['click']);
$class=preg_replace('/\s+/','.',$button['options']['class']);
- $js[]="$(document).on('click','#{$this->grid->id} a.{$class}',$function);";
+ $js[]="jQuery(document).on('click','#{$this->grid->id} a.{$class}',$function);";
}
}
View
10 framework/zii/widgets/grid/CCheckBoxColumn.php
@@ -137,26 +137,26 @@ public function init()
elseif($this->selectableRows==1)
{
//.. only one can be checked, uncheck all other
- $cbcode="$(\"input:not(#\"+this.id+\")[name='$name']\").prop('checked',false);";
+ $cbcode="jQuery(\"input:not(#\"+this.id+\")[name='$name']\").prop('checked',false);";
}
elseif(strpos($this->headerTemplate,'{item}')!==false)
{
//.. process check/uncheck all
$cball=<<<CBALL
-$(document).on('click','#{$this->id}_all',function() {
+jQuery(document).on('click','#{$this->id}_all',function() {
var checked=this.checked;
- $("input[name='$name']:enabled").each(function() {this.checked=checked;});
+ jQuery("input[name='$name']:enabled").each(function() {this.checked=checked;});
});
CBALL;
- $cbcode="$('#{$this->id}_all').prop('checked', $(\"input[name='$name']\").length==$(\"input[name='$name']:checked\").length);";
+ $cbcode="jQuery('#{$this->id}_all').prop('checked', jQuery(\"input[name='$name']\").length==jQuery(\"input[name='$name']:checked\").length);";
}
if($cbcode!=='')
{
$js=$cball;
$js.=<<<EOD
-$(document).on('click', "input[name='$name']", function() {
+jQuery(document).on('click', "input[name='$name']", function() {
$cbcode
});
EOD;

0 comments on commit 1b16544

Please sign in to comment.
Something went wrong with that request. Please try again.