CloneYa handles an event called clone.cloneya on the triggering element. jQuery fails to correctly handle the bubbling of namespaced events (see unresolved bug report https://bugs.jquery.com/ticket/6913 and see a simple illustration here http://jsfiddle.net/kZCBw/3/).
CloneYa subscribes to its own custom namespaced event here and due to the jQuery issue, if a third party triggers a clone event on the element, CloneYa will pick it up. You could trigger clone, clone.foo or anything else. CloneYa goes on to run _cloneAndAppend(toClone) which obviously, it shouldn't.
The workaround is to check that event.namespace === name, where name is a "cloneya" as defined on line 12.
CloneYa handles an event called
clone.cloneya
on the triggering element. jQuery fails to correctly handle the bubbling of namespaced events (see unresolved bug report https://bugs.jquery.com/ticket/6913 and see a simple illustration here http://jsfiddle.net/kZCBw/3/).CloneYa subscribes to its own custom namespaced event here and due to the jQuery issue, if a third party triggers a
clone
event on the element, CloneYa will pick it up. You could triggerclone
,clone.foo
or anything else. CloneYa goes on to run_cloneAndAppend(toClone)
which obviously, it shouldn't.The workaround is to check that
event.namespace === name
, wherename
is a"cloneya"
as defined on line 12.