Git Product home page Git Product logo

api.jquery.com's Introduction

jQuery — New Wave JavaScript

Meetings are currently held on the matrix.org platform.

Meeting minutes can be found at meetings.jquery.org.

Contribution Guides

In 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:

  1. Getting Involved
  2. Core Style Guide
  3. Writing Code for jQuery Projects

References to issues/PRs

GitHub issues/PRs are usually referenced via gh-NUMBER, where NUMBER is the numerical ID of the issue/PR. You can find such an issue/PR under https://github.com/jquery/jquery/issues/NUMBER.

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 trac-NUMBER, where NUMBER is the numerical ID of the issue. You can find such an issue under https://bugs.jquery.com/ticket/NUMBER.

Environments in which to use jQuery

  • Browser support
  • jQuery also supports Node, browser extensions, and other non-browser environments.

What you need to build your own jQuery

To 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 brew install git to install git, and brew install node to install Node.js.

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 jQuery

First, clone the jQuery git repo.

Then, enter the jquery directory, install dependencies, and run the build script:

cd jquery
npm install
npm run build

The built version of jQuery will be placed in the dist/ directory, along with a minified copy and associated map file.

Build all jQuery release files

To build all variants of jQuery, run the following command:

npm run build:all

This will create all of the variants that jQuery includes in a release, including jquery.js, jquery.slim.js, jquery.module.js, and jquery.slim.module.js along their associated minified files and sourcemaps.

jquery.module.js and jquery.slim.module.js are ECMAScript modules that export jQuery and $ as named exports are placed in the dist-module/ directory rather than the dist/ directory.

Building a Custom jQuery

The build script can be used to create a custom version of jQuery that includes only the modules you need.

Any module may be excluded except for core. When excluding selector, it is not removed but replaced with a small wrapper around native querySelectorAll (see below for more information).

Build Script Help

To see the full list of available options for the build script, run the following:

npm run build -- --help

Modules

To exclude a module, pass its path relative to the src folder (without the .js extension) to the --exclude option. When using the --include option, the default includes are dropped and a build is created with only those modules.

Some example modules that can be excluded or included are:

  • ajax: All AJAX functionality: $.ajax(), $.get(), $.post(), $.ajaxSetup(), .load(), transports, and ajax event shorthands such as .ajaxStart().

  • ajax/xhr: The XMLHTTPRequest AJAX transport only.

  • ajax/script: The <script> AJAX transport only; used to retrieve scripts.

  • ajax/jsonp: The JSONP AJAX transport only; depends on the ajax/script transport.

  • css: The .css() method. Also removes all modules depending on css (including effects, dimensions, and offset).

  • css/showHide: Non-animated .show(), .hide() and .toggle(); can be excluded if you use classes or explicit .css() calls to set the display property. Also removes the effects module.

  • deprecated: Methods documented as deprecated but not yet removed.

  • dimensions: The .width() and .height() methods, including inner- and outer- variations.

  • effects: The .animate() method and its shorthands such as .slideUp() or .hide("slow").

  • event: The .on() and .off() methods and all event functionality.

  • event/trigger: The .trigger() and .triggerHandler() methods.

  • offset: The .offset(), .position(), .offsetParent(), .scrollLeft(), and .scrollTop() methods.

  • wrap: The .wrap(), .wrapAll(), .wrapInner(), and .unwrap() methods.

  • core/ready: Exclude the ready module if you place your scripts at the end of the body. Any ready callbacks bound with jQuery() will simply be called immediately. However, jQuery(document).ready() will not be a function and .on("ready", ...) or similar will not be triggered.

  • deferred: Exclude jQuery.Deferred. This also excludes all modules that rely on Deferred, including ajax, effects, and queue, but replaces core/ready with core/ready-no-deferred.

  • exports/global: Exclude the attachment of global jQuery variables ($ and jQuery) to the window.

  • exports/amd: Exclude the AMD definition.

  • selector: The full jQuery selector engine. When this module is excluded, it is replaced with a rudimentary selector engine based on the browser's querySelectorAll method that does not support jQuery selector extensions or enhanced semantics. See the selector-native.js file for details.

Note: Excluding the full selector module will also exclude all jQuery selector extensions (such as effects/animatedSelector and css/hiddenVisibleSelectors).

AMD name

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. Pass it to the --amd parameter:

npm run build -- --amd="custom-name"

Or, to define anonymously, leave the name blank.

npm run build -- --amd
File name and directory

The default name for the built jQuery file is jquery.js; it is placed under the dist/ directory. It's possible to change the file name using --filename and the directory using --dir. --dir is relative to the project root.

npm run build -- --slim --filename="jquery.slim.js" --dir="/tmp"

This would create a slim version of jQuery and place it under tmp/jquery.slim.js.

ECMAScript Module (ESM) mode

By default, jQuery generates a regular script JavaScript file. You can also generate an ECMAScript module exporting jQuery as the default export using the --esm parameter:

npm run build -- --filename=jquery.module.js --esm
Factory mode

By default, jQuery depends on a global window. For environments that don't have one, you can generate a factory build that exposes a function accepting window as a parameter that you can provide externally (see README of the published package for usage instructions). You can generate such a factory using the --factory parameter:

npm run build -- --filename=jquery.factory.js --factory

This option can be mixed with others like --esm or --slim:

npm run build -- --filename=jquery.factory.slim.module.js --factory --esm --slim --dir="/dist-module"

Custom Build Examples

Create a custom build using npm run build, listing the modules to be excluded. Excluding a top-level module also excludes its corresponding directory of modules.

Exclude all ajax functionality:

npm run build -- --exclude=ajax

Excluding css removes modules depending on CSS: effects, offset, dimensions.

npm run build -- --exclude=css

Exclude a bunch of modules (-e is an alias for --exclude):

npm run build -- -e ajax/jsonp -e css -e deprecated -e dimensions -e effects -e offset -e wrap

There is a special alias to generate a build with the same configuration as the official jQuery Slim build:

npm run build -- --filename=jquery.slim.js --slim

Or, to create the slim build as an esm module:

npm run build -- --filename=jquery.slim.module.js --slim --esm

Non-official custom builds are not regularly tested. Use them at your own risk.

Running the Unit Tests

Make sure you have the necessary dependencies:

npm install

Start npm start to auto-build jQuery as you work:

npm start

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:

Essential Git

As the source code is handled by the Git version control system, it's useful to know some features used.

Cleaning

If 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

Rebasing

For feature/topic branches, you should always use the --rebase flag to git pull, or if you are usually handling many temporary "to be in a github pull request" branches, run the following to automate this:

git config branch.autosetuprebase local

(see man git-config for more information)

Handling merge conflicts

If you're getting merge conflicts when merging, instead of editing the conflicted files manually, you can use the feature git mergetool. Even though the default tool xxdiff looks awful/old, it's rather useful.

The following are some commands that can be used there:

  • Ctrl + Alt + M - automerge as much as possible
  • b - jump to next merge conflict
  • s - change the order of the conflicted lines
  • u - undo a merge
  • left mouse button - mark a block to be the winner
  • middle mouse button - mark a line to be the winner
  • Ctrl + S - save
  • Ctrl + Q - quit

QUnit Reference

Test methods

expect( 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 assertions

ok( 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 Suite Convenience Methods Reference (See test/data/testinit.js)

Returns an array of elements with the given IDs

q( ... );

Example:

q("main", "foo", "bar");

=> [ div#main, span#foo, input#bar ]

Asserts that a selection matches the given IDs

t( testName, selector, [ "array", "of", "ids" ] );

Example:

t("Check for something", "//[a]", ["foo", "bar"]);

Fires a native DOM event without going through jQuery

fireNative( node, eventType )

Example:

fireNative( jQuery("#elem")[0], "click" );

Add random number to url to stop caching

url( "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 iframe

Some 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 "./data/" + fileName. The iframed page determines when the callback occurs in the test by including the "/test/data/iframeTest.js" script and calling startIframeTest( [ additional args ] ) when appropriate. Often this will be after either document ready or window.onload fires.

The testCallback receives the QUnit assert object created by testIframe for this test, followed by the global jQuery, window, and document from the iframe. If the iframe code passes any arguments to startIframeTest, they follow the document argument.

Questions?

If you have any questions, please feel free to ask on the Developing jQuery Core forum or in #jquery on libera.

api.jquery.com's People

Contributors

addyosmani avatar agcolom avatar andyli avatar antishok avatar arthurvr avatar aurelioderosa avatar boldewyn avatar brandwaffle avatar chealer avatar dependabot[bot] avatar dmethvin avatar eddiemonge avatar ericcarraway avatar gibson042 avatar gnarf avatar jmm avatar jugglinmike avatar jzaefferer avatar kborchers avatar krinkle avatar kswedberg avatar laughinghan avatar mattlunn avatar mgol avatar mikesherov avatar pobocks avatar rdworth avatar scottgonzalez avatar timmywil avatar usmonster avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

api.jquery.com's Issues

Doc issue: map() does not mention jQuery.map(function) (and is misleading)

The current state of the docs implies that

var arr = $(selector).map(callback)

will not work, since no version is documented as having the callback in the first parameter. But it does seem to.

But it also implies that

$.map($(selector), callback) 

will work, whereas it always seems to return an empty array, from my brief trials.

.queue() docs don't mention that the queued function runs per-element

The documentation for .queue([queueName], callback) does not mention that the queued function is executed once for every individual element within a jQuery set (as opposed to running once for the whole set). There also don't appear to be any examples for that method signature that show it being used on jQuery sets of multiple elements.

Either an explicit mention, or an example that shows $(...).queue(callback) being used on a set of multiple elements, should be enough to clarify the ambiguity imo.

Arguments accessible by .always(), .done() and .fail() from jQuery.ajax()?

Now that .always(), .done() and .fail() are the preferred methods for implementing callbacks from a jQuery.ajax() invocation, and the old methods have been deprecated, it might be a good time to explain the arguments accessible by each of the new methods, and additionally the .then() and .pipe() when applied to jQuery.ajax() invocations?

When browsing the jQuery documentation on api.jquery.com, the available arguments are not listed anywhere, nor are they immediately obvious from elsewhere on the site.

Please would you consider improving the jQuery documentation - for the benefit of other developers who, like myself, cannot see how things work without delving into a debug session? Perhaps you could include the methods clearly within the listing of jQuery.ajax(), noting that the methods are implementations of Deferred and included here for clarity only?

Perhaps you could add a brief section immediately beneath the main properties/functions listing of jQuery.ajax(), showing definitively what arguments are available to each method's callbacks. I am guessing that the arguments are thus, and perhaps this is how they could be shown (once you have confirmed that my guesses are correct!)?:-


_Methods_ (part of jqXHR and Deferred implementations, shown here for clarity only)

.ajax().always(function(a, textStatus, b){});
Replaces method .complete() which was deprecated in jQuery 1.8.
In response to successful transaction, arguments are same as .done() (ie. a = data, b = jqXHR) and for failed transactions the arguments are same as .fail() (ie. a = jqXHR, b = errorThrown).
This is an alternative construct for the complete callback function above. Refer to deferred.always() for implementation details.

.ajax().done(function(data, textStatus, jqXHR){});
Replaces method .success() which was deprecated in jQuery 1.8.
This is an alternative construct for the success callback function above. Refer to deferred.done() for implementation details.

.ajax().fail(function(jqXHR, textStatus, errorThrown){});
Replaces method .error() which was deprecated in jQuery 1.8.
This is an alternative construct for the complete callback function above. Refer to deferred.fail() for implementation details.

.ajax().then(function(data, textStatus, jqXHR){}, function(jqXHR, textStatus, errorThrown){});
Incorporates the functionality of .done() and .fail() methods.
Refer to deferred.then() for implementation details.

.ajax().pipe(function(data, textStatus, jqXHR){}, function(jqXHR, textStatus, errorThrown){});
Incorporates the functionality of .done() and .fail() methods, allowing the underlying Promise to be manipulated.
Refer to deferred.pipe() for implementation details.


My guesswork may be incorrect? This perhaps illustrates the need to improve the documentation within jQuery.ajax().

Hope you can do something to improve documentation.

Kind regards,
Alan
(edited to note that .complete(), .error() and .success() have already been deprecated, and to explain the use of .then() and .pipe() with .ajax())

Link points to wrong url in UI documentation

Where I came across it was at http://jqueryui.com/demos/accordion/#option-animated

Take for instance the second property in the Options tab, "actve". It says you can use "Selector, Element, jQuery, Boolean, Number" and each one of those is a link. If you click "Selector" you get a popup that contains a link to the Selectors API page but instead of that page (http://api.jquery.com/category/selectors/) it points to http://jqueryui.com/Selectors which is a 404.

That is all.

.animate() with queue set to string

It appears that if you set a queue name (string) the animation does not run immediately. I found you had to call dequeue. Since this wasn't in the docs it took a bit to figure it out.

It would help if the documentation either specified the need to dequeue or perhaps this is a bug?

Setting "queue" to true triggers the animation immediately if there is currently nothing in the q.

Example:
Nada: $('html,body').animate({scrollTop:200},{queue:'scr',duration:1000});
Woohoo: $('html,body').animate({scrollTop:200},{queue:'scr',duration:1000}).dequeue('scr');

$.ajax cache: false edge cases

check with @jaubourg before updating

  • mention that cache: false works only with HEAD and GET requests,
  • mention that it does so by adding/replacing a "_={timestamp}" to the get parameters
  • the param is NOT needed for other requests except in IE8 when you POST to a URL that you already requested with a GET

clarify that there's parent() and parents()

http://api.jquery.com/parent-selector/

Please add ElMoonLite's comment into the doc:

if you are looking for the direct parent(s) of the item(s) in current selection:
use $("someselection").parent().dostuff

if you are looking for all ancestors of the item(s) in current selection:
use $("someselection").parents().dostuff"

The documentation currently does not mention the existence of parents() at all.
noobs who don't read the comments might miss it. :)

.html() Signatures

According to the documentation, the $.fn.html() function only takes a string or a function. However, after examining the source, it internally calls .empty().append(value) and therefore does support (and should state that it supports) all of the same signatures that append() supports.

Are there plans to change how this works?

Please Explain Internal Looping Under .each Docs

The internet groans and creaks under the weight of all the unnecessary .each methods out there. Something like this at the top of the .each docs

NOTE: Most built-in JQuery methods are applied to every element in a selector match. If you don't need to deal with elements on a case by case by case basis and just want to perform the same action on each one, you don't need to use the .each method.

Demo code for .jquery property has bug...

The docs at this location: http://api.jquery.com/jquery-2/

Has this demo code:
var a = { what: "A regular JS object" },
b = $('body');

if ( a.jquery ) { // falsy, since it's undefined
alert(' a is a jQuery object! ');
}

if ( b.jquery ) { // truthy, since it's a string
alert(' b is a jQuery object! ');
}

Shouldn't the first alert be "a is NOT a jQuery object"?

jQuery docs not respect content-type with respect to converters

It seems not to be possible to hit this converter:

$.ajaxSetup({
    converters: {
        "mycustomtype json": function (result) {
            //do stuff
            return newresult;
        }
    }
});

This should be called if the response has Content-Type 'mycustomtype' and the caller expects json.

Ticket: http://bugs.jquery.com/ticket/11376

Team notes

I've already written up the docs for this here: https://github.com/addyosmani/api.jquery.com/blob/11376/entries/jQuery.ajax.xml. Will make a pull request soon.

:parent selector description is unclear/misleading

The description of the :parent selector reads: Select all elements that are the parent of another element, including text nodes.

http://api.jquery.com/parent-selector/

Suppose you have: <div> <p id="secret">jQuery is evil!</p> </div>

It is not clear what jQuery("p:parent") matches. Does it match the div, i.e. the paragraph's parent? Or does it match the paragraph?

The answer is that :parent matches the paragraph. This can be deducted from observation of other selector constructs and the realization that a selector doing the former would be :parent(p), but this is far from obvious. It is not clear that :parent means "is a parent", but not "the parent of". Some have even suggested to rename the selector in the documentation comments. I don't know if this is desirable, but kk and Jakub Konecki suggested :hasChild" and :isParent. I did find it very surprising to read that :parent's opposite was :empty.

Furthermore, the current description implies that text nodes are elements, which is misleading.

A description which would fix both issues would be: Select all elements that have a child node (either an element or text).

Ticket: http://bugs.jquery.com/ticket/11253

noConflict documentation update

The noConflict documentation says...

If we need to use another JavaScript library alongside jQuery, we can return control of $ back to the other library with a call to $.noConflict():

it would be helpful for the inquisitive developer to understand a little more of what happens under the hood, so that they can be assured it will work as expected.

Maybe something like this...
If we need to use another JavaScript library alongside jQuery, we can return control of $ back to the other library with a call to $.noConflict(). Old references of $ are saved during jQuery initialization; noConflict() simply restores them.

http://api.jquery.com/css/#css2: Shorthand properties

We state that shorthand properties such as border and background are not supported in the getter. While setting these properties works fine with most values, resetting does not. When setting shorthand properties to empty string in IE, they are nullified and previous styles are lost.

e.g.

$elem.css({
  "background": "",
  "border": ""
});

documentation improvement http://api.jquery.com/id-selector/

Hello,
i'd like to add to the documentation page about ID selector
an information that despite there should be only one such id in the page source,
selector will return you an array with one element.
Overall, documentation about id selector makes strong impression
that it will return a single element and that is not correct.

Best greeitings,
Paweł Wielgus.

$.ajax: authentication not possible with JSONP

Maybe add note at username and password saying that authentication is not possible with JSONP. Currently it's not said at all on the page, even though there is lots of JSONP related stuff scattered around.

http://api.jquery.com/jQuery.ajax/

Maybe this is a bug in jQuery too, as trying to do authentication with JSONP silently fails (and does not set any request parameters, since it's not possible). Warning message would be nice!

Greetings from Kumpula,
Sampumon

entries2html.xsl: excerpt needs to be escaped for json output

I did a quick and dirty transform so we would have something for the excerpt field:
https://github.com/jquery/api.jquery.com/blob/master/entries2html.xsl#L107-115

However, it doesn't get everything from the <desc> node as it should. Instead, it stops when it encounters a tag inside of it.

My xsl-fu is not strong enough to figure out how to do this, but basically we need to import the xml2json template and then apply it to the contents of that <desc> node (which is the value of the excerpt prop.

.parents() orders each tier of results back-to-front

Not sure if this counts as a bug, but when finding parents of a collection of more than one element the resulting collection has the parents in a back-to-front order at each tier. e.g

<div class="div1"><span></span></div><div class="div2"><span></span></div>

$("span").parents() // [div2, div1, body, html]
                    // expected [div1, div2, body, html]

Test case: http://jsfiddle.net/vkGEQ/
Original ticket: http://bugs.jquery.com/ticket/11385

Team notes

This is by design , but the docs should mention it.

Missing </strong> tag

There appears to be a missing </strong> tag in entries/jQuery.ajax.xml, brought to my attention by the xmllint task failing when running grunt.

Link to source in repo

The site does a great job getting picked up by google, but it's not always easy to go from the side to finding the code in the repo... which I find myself doing frequently. So, it would be nice to have links from the doc to the code.

.slideDown()

  • Categories: Effects > Sliding
  • Defined in: effects.js

Bonus

How do you plan to support localized content?

I'm wondering what the plans are to support localized versions of the jQuery api documentation, if any. An initial effort could be made to automatically create localized versions in various languages through the use of a service like Google or Bing translate, and then add them to the repo in separate folders, maintained individually. Manual changes could then be accepted from real people. New APIs would need to be added to each locale's content as they are documented. Of course this could be somewhat automated over time.

jQuery.ajax(...) contentType param is wrongly documented causing confussion

Version: jQuery 1.7.2

Reading the documentation about the contentType it says the default value is "application/x-www-form-urlencoded" but the real default value is "application/x-www-form-urlencoded; charset=UTF-8".

I'm raising this because the documentation is confusing when it states that "data will always be transmitted to the server using UTF-8 charset".

If you change the value to "application/json" it won't be transmitted in UTF-8, will be ISO-8859-1 instead (the HTTP standard default).
You have to set it to "application/json; charset=UTF-8" for it to work properly.

It all comes down to not explaining those things in the documentation and stating that the default value is "application/x-www-form-urlencoded" when is not!!.

Thanks
Juan

Custom selectors pass check when returning undefined

When writing a custom selector and giving it a function as the rule, returning truthy from the function passes the check, and returning falsy fails. That is the case unless the function returns undefined. Although undefined is falsy, the check is considered to have passed.

While I think any such function should return a strict BOOL, there is no official documentation (that I can find, anyway) on how a custom selector should be written and what these functions should be returning.

This stems from a trouble ticket opened to TinyMCE ( http://www.tinymce.com/develop/bugtracker_view.php?id=4975 ). I believe they need to correct their function to return BOOL, but I felt this should be brought to the attention of the jQuery core team as it could be happening in many other places.

See this fiddle: http://jsfiddle.net/Pw43h/
Ticket: http://bugs.jquery.com/ticket/11246

Notes

We should update the documentation to make it clear that a boolean is necessary.

:checked documentation

According to the rules of English, 'is' is used with a single object, and 'are' with multiple objects or no objects (zero). Hence, the code in the first example of the :checked selector documentation should read $("div").text(n + (n == 1 ? " is" : " are") + " checked!"); and not $("div").text(n + (n != 1 ? " is" : " are") + " checked!");

.height() should be floored for consistent behavior

In Chrome, IE7/8, and Opera the height value is floored to the nearest integer. In Firefox it is rounded. This leads to constant 1px discrepencies between Firefox and the rest of the world.

This only applies to elements after they are added to the DOM. Elements that exist as fragments will accept and set their height to a decimal until it is necessary to calculate their box size.

I'm not particularly certain that this should necessarily be changed in jQuery, since it is a bug/oddity within Firefox, but it would be convenient, at least, to report this discrepancy. I couldn't dig up any standard that details the correct behavior for this.

Test case from OP: http://jsfiddle.net/vju9B/3/
Simplified test case: http://jsfiddle.net/fbRUh/
Original ticket: http://bugs.jquery.com/ticket/11401

Team Notes:

Some of the differences in browsers concerning decimal point values should be respected for the sake of animations, if nothing else. We should not hide these.

http://jsfiddle.net/timmywil/fbRUh/3/

However, we could make a note in the docs for dimensions.

http://api.jquery.com/parent-selector/: tagline text possibly misleading

Ported from: http://bugs.jquery.com/ticket/11253

The description of the :parent selector reads: Select all elements that are the parent of another element, including text nodes.

http://api.jquery.com/parent-selector/

Suppose you have: <div> <p id="secret">jQuery is evil!</p> </div>

It is not clear what jQuery("p:parent") matches. Does it match the div, i.e. the paragraph's parent? Or does it match the paragraph?

The answer is that :parent matches the paragraph. This can be deducted from observation of other selector constructs and the realization that a selector doing the former would be :parent(p), but this is far from obvious. It is not clear that :parent means "is a parent", but not "the parent of". Some have even suggested to rename the selector in the documentation comments. I don't know if this is desirable, but kk and Jakub Konecki suggested ":hasChild" and ":isParent". I did find it very surprising to read that ":parent"'s opposite was ":empty".

Furthermore, the current description implies that text nodes are elements, which is misleading.

A description which would fix both issues would be: Select all elements that have a child node (either an element or text).

Serialize fieldset in Chrome and IE9

Original issue:

.serialize() does not serialize form elements inside a fieldset in Chrome or IE9.

To reproduce the issue, open the test case in the following browsers: Firefox, Chrome, and IE 9.

fails: Chrome and IE 9 on Windows 7 64-bit. works: Firefox on Windows 7 64-bit

OP test case: http://jsfiddle.net/HQZts/
Ticket: http://bugs.jquery.com/ticket/11594

Notes:

  • It doesn't seem like this is a documented use of the method. The .serialize() method can act on a jQuery object that has selected individual form elements, such as , <textarea>, and . However, it is typically easier to select the tag itself for serialization ... http://api.jquery.com/serialize/. So other than a form, there is no current use of .serialize() that requires the code to search inside an element for more elements to process. (from adam) This could perhaps be phased in terms of explaining that "a collection that contains an element that contains form elements is not the same as a collection that contains form elements." Using the word "represent" is probably misleading here.

Problem with .animate() for opacity in IE8

If I use .animate({ opacity: 0.32 }), nothing happens in IE8, but there is no such problem in other browsers (Chrome, Safari, Firefox, Opera, IE7, IE9).

OP test case: http://jsfiddle.net/ZVdaq/13/
Simplified test case: http://jsfiddle.net/mofle/ZVdaq/17/
Ticket: http://bugs.jquery.com/ticket/11188

Notes:

  • Looks like the problem occurs without jQuery too, so it's definitely not a jQuery bug. IE8 opacity filter does not want to apply to child elements with position set. I you add "filter: inherit" on the child CSS, the filter applies.A fix would be to set "filter: inherit" on all descendants that has position set, but that would probably be an massive performance bottleneck. If there are no other solutions for this, I think we should just document it somewhere.
  • We could normalize the behaviour so that it behaves as expected in the test case above, but I'm tempted to second the notion that filter:inherit could be a perf issue.

Better Index Page

The index page should provide an overview of the docs, mention which version the docs apply to, where to find older versions, link to intro tutorials on the learn site, etc.

Are $.ajax success and error being deprecated in 1.8 as originally planned?

We've documented (for a while) that we would be deprecating success and error as per:

The jqXHR.success(), jqXHR.error(), and jqXHR.complete() callbacks will be deprecated in jQuery 1.8. To prepare your code for their eventual removal, use jqXHR.done(), jqXHR.fail(), and jqXHR.always() instead.

I didn't notice these in the initial release notes for 1.8b so just thought I'd bring it to someones attention. I believe Dave is going to file a ticket on the tracker so we can discuss it further / update the docs if needed.

The doc for $.isEmptyObject() is not correct

The documentation - http://api.jquery.com/jQuery.isEmptyObject/ - states:

Description: Check to see if an object is empty (contains no properties).

This description is not correct. The function in question returns true if the given object doesn't contain any enumerable properties. However, the object may contain non-enumerable properties, and the function in question will in that case still return true.

This fact contradicts with the description in the docs, which states that the function returns true only if the given object doesn't contain any properties.

The description should at least state "(contains no enumerable properties)".

Fix $.proxy() to work like and use Function.prototype.bind

As it stands currently, $.proxy is in a weird place. It's likely too advanced of a tool for the average user, and crippled for advanced users. It lacks the ability to partially apply arguments and doesn't take advantage of native implementations where available. As well, $.proxy is being used internally to set matching guids (in $.fn.bind and $.fn.toggle), which is an unnecessary performance hit as well as reliance on an indirect side-effect of $.proxy.

The proposal is to:

  • Make $.proxy spec-compatible.
  • Use native implementations where available.
  • Remove the non-standard object/key syntax (breaking).

Original ticket: http://bugs.jquery.com/ticket/7783

Notes:

@gf3 originally made a PR against this. The remaining work docs work should cover the latest behaviour after the removal of Function.prototype.bind jquery/jquery@15da298

Index page suggestion

Display function signatures / params on the index page.

Title of each method could display the signatures in a foldout box, etc. - for example, automatically display foldout box containing the first 3 signatures, or hover to display popout, etc.

If there are more than three signatures, indicate with an ellipsis; display remaining signatures on click of the foldout box.

Provide a bookmark for links to method signatures, for quick reference links (ie, for use in stackoverflow.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.