Closed miraclebg closed 8 years ago
I only see some incomplete JS and an image. Please provide a source file, and the calls to bin/uglifyjs
with which your issue can be reproduced.
Please ignore the attached javascript file. I am attaching the one that you should be looking at now (the previous one was an experiment). jquery.fancybox.js.zip
Once you remove from the file the HTML templates (line 138) - it can compile properly:
// HTML templates
tpl: {
wrap : '<div class="fancybox-wrap" tabIndex="-1"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>',
image : '<img class="fancybox-image" src="{href}" alt="" />',
iframe : '<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" frameborder="0" vspace="0" hspace="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen' + (IE ? ' allowtransparency="true"' : '') + '></iframe>',
error : '<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>',
closeBtn : '<a title="Close" class="fancybox-item fancybox-close" href="javascript:;"></a>',
next : '<a title="Next" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
prev : '<a title="Previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'
},
@rvanvelzen I am not using uglifyjs directly - i am packing up a requirejs project with r.js - which is in turn probably calling your bin?
@rvanvelzen Also attached now the final compiled file (which is broken):
@rvanvelzen And i've just found out what's the cause (in the correct file now):
Line 144-146:
Was:
closeBtn : '<a title="Close" class="fancybox-item fancybox-close" href="javascript:;"></a>',
next : '<a title="Next" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
prev : '<a title="Previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'
Changed it to:
closeBtn : '<a title="Close" class="fancybox-item fancybox-close"></a>',
next : '<a title="Next" class="fancybox-nav fancybox-next"><span></span></a>',
prev : '<a title="Previous" class="fancybox-nav fancybox-prev"><span></span></a>'
Just removed href="javascript:;" and it compiles properly.
I'm sorry, I do not believe UglifyJS to be doing anything wrong here - payin7.js
is valid JS.
href="javascript:;"
is not something we alter, or even read. If it only happens after minification, I suggest that you look into other parts of your build pipeline.
@rvanvelzen Hm, well something is definitely messing this up - i'll have to get to the r.js people.
Thanks anyway!
For some reason fancybox2 is being messed up after uglification by r.js.
After quite some debugging this is what causes it (probably the html template) - after this is removed all is ok:
I've attached the fancybox file.