Skip to content

Commit aee56fe

Browse files
Add test for #227
1 parent cb14504 commit aee56fe

3 files changed

Lines changed: 68 additions & 0 deletions

File tree

tests/js/JSTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,6 +1239,12 @@ function someOtherFunction() {
12391239
'new RegExp(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/)',
12401240
);
12411241

1242+
// https://github.com/matthiasmullie/minify/issues/227
1243+
$tests[] = array(
1244+
__DIR__.'/sample/bugs/227/original.js',
1245+
file_get_contents(__DIR__.'/sample/bugs/227/minified.js'),
1246+
);
1247+
12421248
// https://github.com/matthiasmullie/minify/issues/229
12431249
$tests[] = array(
12441250
'// Source: wp-includes/js/twemoji.min.js

tests/js/sample/bugs/227/minified.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// Internal use only
2+
var escapeSelector = $.ui.escapeSelector = ( function() {
3+
var selectorEscape = /([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g;
4+
return function( selector ) {
5+
return selector.replace( selectorEscape, "\\$1" );
6+
};
7+
} )();
8+
9+
10+
/*!
11+
* jQuery UI Labels 1.12.1
12+
* http://jqueryui.com
13+
*
14+
* Copyright jQuery Foundation and other contributors
15+
* Released under the MIT license.
16+
* http://jquery.org/license
17+
*/
18+
19+
//>>label: labels
20+
//>>group: Core
21+
//>>description: Find all the labels associated with a given input
22+
//>>docs: http://api.jqueryui.com/labels/
23+
24+
25+
26+
var labels = $.fn.labels = function() {
27+
var ancestor, selector, id, labels, ancestors;
28+
29+
// Check control.labels first
30+
if ( this[ 0 ].labels && this[ 0 ].labels.length ) {
31+
return this.pushStack( this[ 0 ].labels );
32+
}
33+
34+
// Support: IE <= 11, FF <= 37, Android <= 2.3 only
35+
// Above browsers do not support control.labels. Everything below is to support them
36+
// as well as document fragments. control.labels does not work on document fragments
37+
labels = this.eq( 0 ).parents( "label" );
38+
39+
// Look for the label based on the id
40+
id = this.attr( "id" );
41+
if ( id ) {
42+
43+
// We don't search against the document in case the element
44+
// is disconnected from the DOM
45+
ancestor = this.eq( 0 ).parents().last();
46+
47+
// Get a full set of top level ancestors
48+
ancestors = ancestor.add( ancestor.length ? ancestor.siblings() : this.siblings() );
49+
50+
// Create a selector for the label based on the id
51+
selector = "label[for='" + $.ui.escapeSelector( id ) + "']";
52+
53+
labels = labels.add( ancestors.find( selector ).addBack( selector ) );
54+
55+
}
56+
57+
// Return whatever we have found for labels
58+
return this.pushStack( labels );
59+
};

0 commit comments

Comments
 (0)