Skip to content

Commit

Permalink
Add test for matthiasmullie#227
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasmullie committed Jan 8, 2018
1 parent cb14504 commit aee56fe
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/js/JSTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,12 @@ function someOtherFunction() {
'new RegExp(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/)',
);

// https://github.com/matthiasmullie/minify/issues/227
$tests[] = array(
__DIR__.'/sample/bugs/227/original.js',
file_get_contents(__DIR__.'/sample/bugs/227/minified.js'),
);

// https://github.com/matthiasmullie/minify/issues/229
$tests[] = array(
'// Source: wp-includes/js/twemoji.min.js
Expand Down
3 changes: 3 additions & 0 deletions tests/js/sample/bugs/227/minified.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 59 additions & 0 deletions tests/js/sample/bugs/227/original.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Internal use only
var escapeSelector = $.ui.escapeSelector = ( function() {
var selectorEscape = /([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g;
return function( selector ) {
return selector.replace( selectorEscape, "\\$1" );
};
} )();


/*!
* jQuery UI Labels 1.12.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/

//>>label: labels
//>>group: Core
//>>description: Find all the labels associated with a given input
//>>docs: http://api.jqueryui.com/labels/



var labels = $.fn.labels = function() {
var ancestor, selector, id, labels, ancestors;

// Check control.labels first
if ( this[ 0 ].labels && this[ 0 ].labels.length ) {
return this.pushStack( this[ 0 ].labels );
}

// Support: IE <= 11, FF <= 37, Android <= 2.3 only
// Above browsers do not support control.labels. Everything below is to support them
// as well as document fragments. control.labels does not work on document fragments
labels = this.eq( 0 ).parents( "label" );

// Look for the label based on the id
id = this.attr( "id" );
if ( id ) {

// We don't search against the document in case the element
// is disconnected from the DOM
ancestor = this.eq( 0 ).parents().last();

// Get a full set of top level ancestors
ancestors = ancestor.add( ancestor.length ? ancestor.siblings() : this.siblings() );

// Create a selector for the label based on the id
selector = "label[for='" + $.ui.escapeSelector( id ) + "']";

labels = labels.add( ancestors.find( selector ).addBack( selector ) );

}

// Return whatever we have found for labels
return this.pushStack( labels );
};

0 comments on commit aee56fe

Please sign in to comment.