在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):jquery/jquery开源软件地址(OpenSource Url):https://github.com/jquery/jquery开源编程语言(OpenSource Language):JavaScript 93.6%开源软件介绍(OpenSource Introduction):jQuery — New Wave JavaScriptContribution GuidesIn the spirit of open source software development, jQuery always encourages community code contribution. To help you get started and before you jump into writing code, be sure to read these important contribution guidelines thoroughly: References to issues/PRsGitHub issues/PRs are usually referenced via jQuery has used a different bug tracker - based on Trac - in the past, available under bugs.jquery.com. It is being kept in read only mode so that referring to past discussions is possible. When jQuery source references one of those issues, it uses the pattern Environments in which to use jQuery
What you need to build your own jQueryTo build jQuery, you need to have the latest Node.js/npm and git 1.7 or later. Earlier versions might work, but are not supported. For Windows, you have to download and install git and Node.js. macOS users should install Homebrew. Once Homebrew is installed, run Linux/BSD users should use their appropriate package managers to install git and Node.js, or build from source if you swing that way. Easy-peasy. How to build your own jQueryFirst, clone the jQuery git repo. Then, enter the jquery directory and run the build script: cd jquery && npm run build The built version of jQuery will be put in the If you want to create custom build or help with jQuery development, it would be better to install grunt command line interface as a global package:
Make sure you have
Now by running the
There are many other tasks available for jQuery Core:
ModulesSpecial builds can be created that exclude subsets of jQuery functionality.
This allows for smaller custom builds when the builder is certain that those parts of jQuery are not being used.
For example, an app that only used JSONP for Any module may be excluded except for Some example modules that can be excluded are:
The build process shows a message for each dependent module it excludes or includes. AMD nameAs an option, you can set the module name for jQuery's AMD definition. By default, it is set to "jquery", which plays nicely with plugins and third-party libraries, but there may be cases where you'd like to change this. Simply set the grunt custom --amd="custom-name" Or, to define anonymously, set the name to an empty string. grunt custom --amd="" Custom Build ExamplesTo create a custom build, first check out the version: git pull; git checkout VERSION Where VERSION is the version you want to customize. Then, make sure all Node dependencies are installed: npm install Create the custom build using the Exclude all ajax functionality: grunt custom:-ajax Excluding css removes modules depending on CSS: effects, offset, dimensions. grunt custom:-css Exclude a bunch of modules: grunt custom:-ajax/jsonp,-css,-deprecated,-dimensions,-effects,-offset,-wrap There is also a special alias to generate a build with the same configuration as the official jQuery Slim build is generated: grunt custom:slim For questions or requests regarding custom builds, please start a thread on the Developing jQuery Core section of the forum. Due to the combinatorics and custom nature of these builds, they are not regularly tested in jQuery's unit test process. Running the Unit TestsMake sure you have the necessary dependencies: npm install Start grunt watch Run the unit tests with a local server that supports PHP. Ensure that you run the site from the root directory, not the "test" directory. No database is required. Pre-configured php local servers are available for Windows and Mac. Here are some options:
Building to a different directoryTo copy the built jQuery files from grunt && grunt dist:/path/to/special/location/ With this example, the output files would be: /path/to/special/location/jquery.js
/path/to/special/location/jquery.min.js To add a permanent copy destination, create a file in {
"/Absolute/path/to/other/destination": true
} Additionally, both methods can be combined. Essential GitAs the source code is handled by the Git version control system, it's useful to know some features used. CleaningIf you want to purge your working directory back to the status of upstream, the following commands can be used (remember everything you've worked on is gone after these): git reset --hard upstream/main
git clean -fdx RebasingFor feature/topic branches, you should always use the git config branch.autosetuprebase local (see Handling merge conflictsIf you're getting merge conflicts when merging, instead of editing the conflicted files manually, you can use the feature
The following are some commands that can be used there:
QUnit ReferenceTest methodsexpect( numAssertions );
stop();
start(); Note: QUnit's eventual addition of an argument to stop/start is ignored in this test suite so that start and stop can be passed as callbacks without worrying about their parameters. Test assertionsok( value, [message] );
equal( actual, expected, [message] );
notEqual( actual, expected, [message] );
deepEqual( actual, expected, [message] );
notDeepEqual( actual, expected, [message] );
strictEqual( actual, expected, [message] );
notStrictEqual( actual, expected, [message] );
throws( block, [expected], [message] ); test/data/testinit.js)Test Suite Convenience Methods Reference (SeeReturns an array of elements with the given IDsq( ... ); Example: q("main", "foo", "bar");
=> [ div#main, span#foo, input#bar ] Asserts that a selection matches the given IDst( testName, selector, [ "array", "of", "ids" ] ); Example: t("Check for something", "//[a]", ["foo", "bar"]); Fires a native DOM event without going through jQueryfireNative( node, eventType ) Example: fireNative( jQuery("#elem")[0], "click" ); Add random number to url to stop cachingurl( "some/url" ); Example: url("index.html");
=> "data/index.html?10538358428943"
url("mock.php?foo=bar");
=> "data/mock.php?foo=bar&10538358345554" Run tests in an iframeSome tests may require a document other than the standard test fixture, and these can be run in a separate iframe. The actual test code and assertions remain in jQuery's main test files; only the minimal test fixture markup and setup code should be placed in the iframe file. testIframe( testName, fileName,
function testCallback(
assert, jQuery, window, document,
[ additional args ] ) {
...
} ); This loads a page, constructing a url with fileName The Questions?If you have any questions, please feel free to ask on the Developing jQuery Core forum or in #jquery on libera. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论