У меня есть объект jQuery, и я использую метод .bind()
, чтобы назначить событие этому объекту.Однако я также передаю ссылку на сам объект методу связывания, например так:
$( document ).ready(function ()
{
// Grab the jQuery version of the DOM element.
var $formField1 = $( "#form-field-1" );
// I should probably store this stuff in $formField1.data(),
// but not until I find out if this can cause a circular reference.
var formFields = {
"jQ": $formField1,
"$comment": $( "#form-field-1-comment" ),
"commentAnswers": [ 2, 4 ]
};
// Set up the comment to show when a certain answer is given.
this.jQ.bind( "change", formFields, toggleComment );
});
function toggleComment( p_event )
{
// Show/hide comments based on the answer in the commentAnswers array.
if ( $.inArray($(this).val(), question.commentAnswers) > -1 )
{
question.$comment.parent().slideDown();
}
else
{
question.$comment.parent().slideUp();
}
}
Я хочу знать, будет ли это "фактически" вызывать циклическую ссылку?