🌐 AI搜索 & 代理 主页
Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
6315322
Build: Configure eslint
JuanMaRuiz Jan 20, 2019
54be4f2
Build: Configure eslint
JuanMaRuiz Jan 20, 2019
ed18cae
Build: Configure eslint
JuanMaRuiz Jan 20, 2019
4efc809
Build: Fixing eslint errors
JuanMaRuiz Jan 20, 2019
97f2bfe
Build: Fixing eslint line length errors
JuanMaRuiz Jan 21, 2019
49d0a94
Build: Fixing eslint non nesting ternary
JuanMaRuiz Jan 22, 2019
624e7ce
Build: Removed old jshint grunt task
JuanMaRuiz Jan 22, 2019
12ee0c5
Build: Configure eslint
JuanMaRuiz Mar 7, 2019
13a8efa
Build: Configure eslint
JuanMaRuiz Mar 7, 2019
57c01b7
Build: Configure eslint
JuanMaRuiz Mar 7, 2019
a80d39b
Build: Configure eslint
JuanMaRuiz Mar 7, 2019
c888650
Merge branch 'fix-438-use-eslint' of https://github.com/JuanMaRuiz/si…
JuanMaRuiz Mar 7, 2019
5c763ff
Build: Configure eslint - PR requested changes
JuanMaRuiz Mar 10, 2019
4cc4ae1
Build: Configure eslint
JuanMaRuiz Mar 10, 2019
7b96d79
Build: Configure eslint for test folder
JuanMaRuiz May 7, 2019
e1e793e
Merge branch 'master' into fix-438-use-eslint
JuanMaRuiz May 7, 2019
57efcda
Build: Configure eslint for test folder
JuanMaRuiz May 7, 2019
03f498c
Build: Configure eslint for test folder
JuanMaRuiz May 7, 2019
8fae5dd
Build: Configure eslint - PR request
JuanMaRuiz May 24, 2019
24d0a94
Build: Configure eslint - PR improvements
JuanMaRuiz May 26, 2019
684520f
Build: Configure eslint - PR improvements
JuanMaRuiz May 26, 2019
f258209
Build: Configure eslint - PR improvements
JuanMaRuiz May 26, 2019
acc8a1c
Build: Configure eslint - PR improvements
JuanMaRuiz May 26, 2019
1d2d470
Build: Configure eslint - PR improvements
JuanMaRuiz May 26, 2019
fb6b2f2
Build: Removed strict configuration in eslint
JuanMaRuiz May 26, 2019
ea5dca1
Build: Improve eslint configuration, fix configuration errors
JuanMaRuiz May 27, 2019
9f12b3b
Build: Improve eslint configuration, fix configuration errors
JuanMaRuiz May 27, 2019
09d6a26
Build: Some PR improvements and re-indents
JuanMaRuiz May 27, 2019
7c3f27e
Build: Improve eslint configuration, changed location and setTimeout
JuanMaRuiz May 28, 2019
bfe54cd
Merge remote-tracking branch 'origin/fix-438-use-eslint' into fix-438…
JuanMaRuiz May 28, 2019
e8a2553
Build: Reverted dot notation to bracket notation in sizzle
JuanMaRuiz May 28, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Build: Configure eslint for test folder
- Fixed all style issues detected by eslint using jquery configuration
  • Loading branch information
JuanMaRuiz committed May 7, 2019
commit 57efcdab169af5b323b633147c6fcc18553669fd
3 changes: 3 additions & 0 deletions src/sizzle.js
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,7 @@
rbuggyQSA = [];

if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) {

// Build QSA regex
// Regex strategy adopted from Diego Perini
assert( function( el ) {
Expand Down Expand Up @@ -859,6 +860,7 @@
docElem.msMatchesSelector ) ) ) ) {

assert( function( el ) {

// Check to see if it's possible to do matchesSelector
// on a disconnected node (IE 9)
support.disconnectedMatch = matches.call( el, "*" );
Expand Down Expand Up @@ -1208,6 +1210,7 @@
match[ 1 ] = match[ 1 ].toLowerCase();

if ( match[ 1 ].slice( 0, 3 ) === "nth" ) {

// nth-* requires argument
if ( !match[ 3 ] ) {
Sizzle.error( match[ 0 ] );
Expand Down
3 changes: 1 addition & 2 deletions tasks/commit.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
"use strict";

var exec = require( "child_process" ).exec;

module.exports = function( grunt ) {
"use strict";
grunt.registerTask( "commit", "Add and commit changes", function( message ) {

// Always add dist directory
Expand Down
2 changes: 1 addition & 1 deletion tasks/compile.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

module.exports = function( grunt ) {
"use strict";
grunt.registerMultiTask(
"compile",
"Compile sizzle.js to the dist directory. Embed date/version.",
Expand Down
2 changes: 1 addition & 1 deletion tasks/dist.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use strict";

var fs = require( "fs" );

module.exports = function( grunt ) {
"use strict";
grunt.registerTask( "dist", "Process files for distribution", function() {
var files = grunt.file.expand( { filter: "isFile" }, "dist/*" );

Expand Down
2 changes: 1 addition & 1 deletion tasks/ensure_ascii.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use strict";

var fs = require( "fs" );

module.exports = function( grunt ) {
"use strict";
grunt.registerMultiTask(
"ensure_ascii",
"Verify that files contain no non-ASCII characters.",
Expand Down
3 changes: 1 addition & 2 deletions tasks/release.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
"use strict";

var exec = require( "child_process" ).exec;

module.exports = function( grunt ) {
"use strict";
var rpreversion = /(\d\.\d+\.\d+)-pre/;

grunt.registerTask( "release",
Expand Down
3 changes: 1 addition & 2 deletions tasks/tag.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
"use strict";

var exec = require( "child_process" ).exec;

module.exports = function( grunt ) {
"use strict";
grunt.registerTask( "tag", "Tag the specified version", function( version ) {
exec( "git tag " + version, this.async() );
} );
Expand Down
3 changes: 1 addition & 2 deletions tasks/test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"use strict";

module.exports = function( grunt ) {
"use strict";
grunt.registerTask( "test", "Run lint and tests for the specific browsers", function() {
var browsers = grunt.option( "browsers" ),
options = grunt.config.data.karma.all;
Expand Down
3 changes: 1 addition & 2 deletions tasks/version.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
"use strict";

var exec = require( "child_process" ).exec;

module.exports = function( grunt ) {
"use strict";
grunt.registerTask( "version", "Commit a new version", function( version ) {
if ( !/\d\.\d+\.\d+(?:-pre)?/.test( version ) ) {
grunt.fatal( "Version must follow semver release format: " + version );
Expand Down
6 changes: 4 additions & 2 deletions test/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

// In source the browser env is not enabled but unit tests rely on them
// too much and we don't run them in non-browser environments anyway.
"browser": true
"browser": true,
"node": true
},

"globals": {
Expand All @@ -17,7 +18,8 @@
"q": true,
"t": true,
"setup": true,
"testIframeWithCallback": true
"testIframeWithCallback": true,
"createWithFriesXML": true
},

"rules": {
Expand Down
6 changes: 3 additions & 3 deletions test/karma/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ module.exports = function( config ) {
process.env.BROWSER_STACK_ACCESS_KEY ),
hostName = isBrowserStack ? "bs-local.com" : "localhost";

config.set({
config.set( {
browserStack: {
project: "sizzle",
build: "local run" + (dateString ? ", " + dateString : ""),
build: "local run" + ( dateString ? ", " + dateString : "" ),
timeout: 600, // 10 min
// BrowserStack has a limit of 120 requests per minute. The default
// "request per second" strategy doesn't scale to so many browsers.
Expand Down Expand Up @@ -91,7 +91,7 @@ module.exports = function( config ) {
browserNoActivityTimeout: 3e5,
browserDisconnectTimeout: 3e5,
browserDisconnectTolerance: 3
});
} );

// Deal with Travis environment
if ( isTravis ) {
Expand Down
78 changes: 39 additions & 39 deletions test/unit/extending.js
Original file line number Diff line number Diff line change
@@ -1,68 +1,68 @@
QUnit.module( "extending", { beforeEach: setup } );

QUnit.test("custom pseudos", function( assert ) {
QUnit.test( "custom pseudos", function( assert ) {
assert.expect( 6 );

Sizzle.selectors.filters.foundation = Sizzle.selectors.filters.root;
assert.deepEqual( Sizzle(":foundation"), [ document.documentElement ], "Copy element filter with new name" );
assert.deepEqual( Sizzle( ":foundation" ), [ document.documentElement ], "Copy element filter with new name" );
delete Sizzle.selectors.filters.foundation;

Sizzle.selectors.setFilters.primary = Sizzle.selectors.setFilters.first;
t( "Copy set filter with new name", "div#qunit-fixture :primary", [ "firstp" ] );
delete Sizzle.selectors.setFilters.primary;

Sizzle.selectors.filters.aristotlean = Sizzle.selectors.createPseudo(function() {
Sizzle.selectors.filters.aristotlean = Sizzle.selectors.createPseudo( function() {
return function( elem ) {
return !!elem.id;
};
});
} );
t( "Custom element filter", "#foo :aristotlean", [ "sndp", "en", "yahoo", "sap", "anchor2", "simon" ] );
delete Sizzle.selectors.filters.aristotlean;

Sizzle.selectors.filters.endswith = Sizzle.selectors.createPseudo(function( text ) {
Sizzle.selectors.filters.endswith = Sizzle.selectors.createPseudo( function( text ) {
return function( elem ) {
return Sizzle.getText( elem ).slice( -text.length ) === text;
};
});
t( "Custom element filter with argument", "a:endswith(ogle)", ["google"] );
} );
t( "Custom element filter with argument", "a:endswith(ogle)", [ "google" ] );
delete Sizzle.selectors.filters.endswith;

Sizzle.selectors.setFilters.second = Sizzle.selectors.createPseudo(function() {
return Sizzle.selectors.createPseudo(function( seed, matches ) {
if ( seed[1] ) {
matches[1] = seed[1];
seed[1] = false;
Sizzle.selectors.setFilters.second = Sizzle.selectors.createPseudo( function() {
return Sizzle.selectors.createPseudo( function( seed, matches ) {
if ( seed[ 1 ] ) {
matches[ 1 ] = seed[ 1 ];
seed[ 1 ] = false;
}
});
});
t( "Custom set filter", "#qunit-fixture p:second", ["ap"] );
} );
} );
t( "Custom set filter", "#qunit-fixture p:second", [ "ap" ] );
delete Sizzle.selectors.filters.second;

Sizzle.selectors.setFilters.slice = Sizzle.selectors.createPseudo(function( argument ) {
var bounds = argument.split(":");
return Sizzle.selectors.createPseudo(function( seed, matches ) {
var i = bounds[1];
Sizzle.selectors.setFilters.slice = Sizzle.selectors.createPseudo( function( argument ) {
var bounds = argument.split( ":" );
return Sizzle.selectors.createPseudo( function( seed, matches ) {
var i = bounds[ 1 ];

// Match elements found at the specified indexes
while ( --i >= bounds[0] ) {
if ( seed[i] ) {
matches[i] = seed[i];
seed[i] = false;
while ( --i >= bounds[ 0 ] ) {
if ( seed[ i ] ) {
matches[ i ] = seed[ i ];
seed[ i ] = false;
}
}
});
});
} );
} );
t( "Custom set filter with argument", "#qunit-fixture p:slice(1:3)", [ "ap", "sndp" ] );
delete Sizzle.selectors.filters.slice;
});
} );

QUnit.test("backwards-compatible custom pseudos", function( assert ) {
QUnit.test( "backwards-compatible custom pseudos", function( assert ) {
assert.expect( 3 );

Sizzle.selectors.filters.icontains = function( elem, i, match ) {
return Sizzle.getText( elem ).toLowerCase().indexOf( (match[3] || "").toLowerCase() ) > -1;
return Sizzle.getText( elem ).toLowerCase().indexOf( ( match[ 3 ] || "" ).toLowerCase() ) > -1;
};
t( "Custom element filter with argument", "a:icontains(THIS BLOG ENTRY)", ["simon1"] );
t( "Custom element filter with argument", "a:icontains(THIS BLOG ENTRY)", [ "simon1" ] );
delete Sizzle.selectors.filters.icontains;

Sizzle.selectors.setFilters.podium = function( elements, argument ) {
Expand All @@ -71,32 +71,32 @@ QUnit.test("backwards-compatible custom pseudos", function( assert ) {
};
// Using TAG as the first token here forces this setMatcher into a fail state
// Where the descendent combinator was lost
t( "Custom setFilter", "form#form :PODIUM", ["label-for", "text1", "text2"] );
t( "Custom setFilter with argument", "#form input:Podium(1)", ["text1"] );
t( "Custom setFilter", "form#form :PODIUM", [ "label-for", "text1", "text2" ] );
t( "Custom setFilter with argument", "#form input:Podium(1)", [ "text1" ] );
delete Sizzle.selectors.setFilters.podium;
});
} );

QUnit.test("custom attribute getters", function( assert ) {
QUnit.test( "custom attribute getters", function( assert ) {
assert.expect( 2 );

var original = Sizzle.selectors.attrHandle.hreflang,
selector = "a:contains('mark')[hreflang='http://diveintomark.org/en']";

Sizzle.selectors.attrHandle.hreflang = function( elem, name ) {
var href = elem.getAttribute("href"),
var href = elem.getAttribute( "href" ),
lang = elem.getAttribute( name );
return lang && ( href + lang );
};

assert.deepEqual( Sizzle(selector, createWithFriesXML()), [], "Custom attrHandle (preferred document)" );
t( "Custom attrHandle (preferred document)", selector, ["mark"] );
assert.deepEqual( Sizzle( selector, createWithFriesXML() ), [], "Custom attrHandle (preferred document)" );
t( "Custom attrHandle (preferred document)", selector, [ "mark" ] );

Sizzle.selectors.attrHandle.hreflang = original;
});
} );

QUnit.test("Ensure no 'undefined' handler is added", function( assert ) {
QUnit.test( "Ensure no 'undefined' handler is added", function( assert ) {
assert.expect( 1 );

assert.ok( !Sizzle.selectors.attrHandle.hasOwnProperty( "undefined" ),
"Extra attr handlers are not added to Expr.attrHandle (gh-353)" );
});
} );
Loading