Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

# before popup HTML fragment using jQuery #2

Open
blackpuppy opened this issue Jul 25, 2014 · 0 comments
Open

# before popup HTML fragment using jQuery #2

blackpuppy opened this issue Jul 25, 2014 · 0 comments

Comments

@blackpuppy
Copy link

When using jQuery library, there is an extra "#" before the popup fragment. The generated JavaScript is like this:
$(document).ready(function(){
$("#<div id="popup_0" style="display:none;">...</div>\n\n").appendTo("#popups");
});

My call to Popup->link() is:
echo $this->Popup->link('', array(
'class'=>'my-class',
'element' => '/my_element',
'library' => 'jQuery',
'escape' => true,
'draggable' => true
));

And a JavaScript error will be reported in Firebug:
Error: Syntax error, unrecognized expression: #

If I remove the "#" in PopupHelper's __buildJsDomReady() like the following, and the problem will disappear.
function __buildJsDomReady($popup){
if ($this->library == 'Jquery') {
return $this->Html->scriptBlock('
$(document).ready(function(){
$("'.$popup.'").appendTo("#popups");
});
');
// previous: $("#'.$popup.'").appendTo("#popups");
} else {
// ...
}
}

I am not sure if there is a problem in my usage or it's a bug. Maybe there are other cases to consider.

Thanks for the great plugin!

@blackpuppy blackpuppy changed the title # before popup fragment using jQuery # before popup HTML fragment using jQuery Jul 26, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant