Skip to content

can.view() stops working when execute three times with can.jquery #33

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

Closed
verto opened this issue Apr 17, 2012 · 5 comments
Closed

can.view() stops working when execute three times with can.jquery #33

verto opened this issue Apr 17, 2012 · 5 comments

Comments

@verto
Copy link

verto commented Apr 17, 2012

Scenario:

<script type="text/ejs" id="content"><form><button class="cancel">cancel</button></form></script>

<div id="form"></div>

<script type="text/javascript">
  function call() { 
   $('#form').html(can.view('content'));
}
</script>
<a href="javascript:call()">execute</a>

click three times on execute link.

@justinbmeyer
Copy link
Contributor

which version of jQuery are you using?

@verto
Copy link
Author

verto commented Apr 18, 2012

v1.7. 2

Sent from my Nexus S
On Apr 17, 2012 11:10 PM, "Justin Meyer" <
[email protected]>
wrote:

which version of jQuery are you using?


Reply to this email directly or view it on GitHub:
#33 (comment)

@justinbmeyer
Copy link
Contributor

I have verified this is an error. It seems jQuery's buildFragment returns a cacheable flag and it's up to jQuery to clone it when appropriate. For example:

ret = jQuery.buildFragment( [ match[1] ], [ doc ] )
( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment )

This means that jQuery's buildFragment is not something we should follow exactly. We need our own which always returns a fresh copy.

Here's a JSFiddle that shows the problem: http://jsfiddle.net/7ACEL/2/

@justinbmeyer
Copy link
Contributor

I'll have a fix for this sometime today.

@verto
Copy link
Author

verto commented Apr 18, 2012

Cool! Thanks.

Sent from my Nexus S
On Apr 17, 2012 11:25 PM, "Justin Meyer" <
[email protected]>
wrote:

I'll have a fix for this sometime today.


Reply to this email directly or view it on GitHub:
#33 (comment)

thecountofzero pushed a commit to thecountofzero/canjs that referenced this issue Jun 14, 2012
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

2 participants