Ticket #13379 (confirmed Bug)

Opened 3 years ago

Last modified 3 years ago

Products.ResourceRegistries: JavascriptPacker 'safe' compression concatenating next line to end of //

Reported by: AlexStevens Owned by:
Priority: major Milestone: 4.x
Component: Backend (Python) Version: 4.2
Keywords: packer, JavascriptPacker, JavaScript, compression, safe, comment, winesprint Cc:

Description

When 'safe' compression used, some double forward-slash style comments will concatenate the next line of JavaScript to the end of the comment, effectively commenting out that next line.

Original JavaScript:

$(document).on('click.modal.data-api', '[data-toggle="modal"]', function (e) {
  var $this = $(this)
    , href = $this.attr('href')
    , $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
    , option = $target.data('modal') ? 'toggle' : $.extend({ remote:!/#/.test(href) && href }, $target.data(), $this.data())

Compressed with 'safe':

$(document).on('click.modal.data-api','[data-toggle="modal"]', function(e){var $this=$(this),href=$this.attr('href'),$target=$($this.attr('data-target')||(href&&href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7,option=$target.data('modal')?'toggle':$.extend({remote:!/#/.test(href)&&href},$target.data(),$this.data())

I'm going to go on a whim here and assume that either double forward-slash style comments should be removed on 'safe' compression, or the newline at the end of the comment preserved?

Change History

comment:1 Changed 3 years ago by AlexStevens

  • Component changed from Unknown to JavaScript

comment:2 Changed 3 years ago by kleist

  • Status changed from new to confirmed
  • Priority changed from minor to major
  • Component changed from JavaScript to Backend (Python)

comment:4 Changed 3 years ago by AlexStevens

  • Keywords packer, JavascriptPacker, added; portal_javascripts, removed
  • Summary changed from collective.js.jqueryui: portal_javascripts 'safe' compression concatenating next line to end of // to Products.ResourceRegistries: JavascriptPacker 'safe' compression concatenating next line to end of //

comment:5 Changed 3 years ago by AlexStevens

  • Keywords comment added; comment, collective.js.jqueryui removed

comment:6 Changed 3 years ago by esteele

  • Keywords comment, winesprint added; comment removed
Note: See TracTickets for help on using tickets.