aboutsummaryrefslogtreecommitdiffstats
path: root/src/event.js
Commit message (Collapse)AuthorAgeFilesLines
* Docs: Replace `#NUMBER` Trac issue references with `trac-NUMBER`Michał Gołębiowski-Owczarek2022-01-041-3/+3
| | | | | | | | | | | | | The GitHub UI treats `#NUMBER` as referring to its own issues which is confusing when in jQuery source it's usually referring to the old deprecated Trac instance at https://bugs.jquery.com. This change replaces all such Trac references with `trac-NUMBER`. A few of the references came with the Sizzle integration and referred to the Sizzle GitHub bug tracker. Those have been replaced with full links instead. A new entry describing issue reference conventions has been added to README. Closes gh-4993
* Event: Don't break focus triggering after `.on(focus).off(focus)`Michał Gołębiowski-Owczarek2021-05-101-4/+4
| | | | | | | | | | | | | | | | | | | The `_default` function in the special event settings for focus/blur has always returned `true` since gh-4813 as the event was already being fired from `leverageNative`. However, that only works if there's an active handler on that element; this made a quick consecutive call: ```js elem.on( "focus", function() {} ).off( "focus" ); ``` make subsequent `.trigger( "focus" )` calls to not do any triggering. The solution, already used in a similar `_default` method for the `click` event, is to check for the `dataPriv` entry on the element for the focus event (similarly for blur). Fixes gh-4867 Closes gh-4885
* Event: Make focus re-triggering not focus the original element backMichał Gołębiowski-Owczarek2020-12-071-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | If during a focus handler another focus event is triggered: ```js elem1.on( "focus", function() { elem2.trigger( "focus" ); } ); ``` due to their synchronous nature everywhere outside of IE the hack added in gh-4279 to leverage native events causes the native `.focus()` method to be called last for the initial element, making it steal the focus back. Since the native method is already being called in `leverageNative`, we can skip that final call. This aligns with changes to the `_default` method for the `click` event that were added when `leverageNative` was introduced there. A side effect of this change is that now `focusin` will only propagate to the document for the last focused element. This is a change in behavior but it also aligns us better with how this works with native methods. Fixes gh-4382 Closes gh-4813 Ref gh-4279
* Event: Don't crash if an element is removed on blurMichał Gołębiowski-Owczarek2020-10-191-1/+7
| | | | | | | | | | In Chrome, if an element having a `focusout` handler is blurred by clicking outside of it, it invokes the handler synchronously. If that handler calls `.remove()` on the element, the data is cleared, leaving private data undefined. We're reading a property from that data so we need to guard against this. Fixes gh-4417 Closes gh-4799
* Event: Remove the event.which shimMichał Gołębiowski-Owczarek2020-08-261-32/+2
| | | | | | | | All supported browsers implement this property by themselves. The shim was only needed for IE <9. Fixes gh-3235 Closes gh-4765 Ref gh-4755
* Build: Correct code indentations based on jQuery Style GuideWonseop Kim2020-05-051-4/+4
| | | | | | | | 1. Correct code indentations based on jQuery Style Guide (contribute.jquery.org/style-guide/js/#spacing). 2. Add rules to "src/.eslintrc.json" to enable "enforcing consistent indentation", with minimal changes to the current code. Closes gh-4672
* Data:Event:Manipulation: Prevent collisions with Object.prototypeMichał Gołębiowski-Owczarek2020-03-021-2/+4
| | | | | | | Make sure events & data keys matching Object.prototype properties work. A separate fix for such events on cloned elements was added as well. Fixes gh-3256 Closes gh-4603
* Build: Enable ESLint one-var rule for var declarations in browser codeMichał Gołębiowski-Owczarek2020-03-021-3/+4
| | | | | | | Node.js code is written more & more commonly in ES6+ so it doesn't make sense to enable it there. There are many violations in test code so it's disabled there as well. Closes gh-4615
* Event: remove jQuery.event.globalMichał Gołębiowski-Owczarek2020-02-101-5/+0
| | | | | | | jQuery.event.global has been write-only in the jQuery source for the past few years; reading from it was removed in c2d6847de09a52496f78baebc04f317e11ece6d2 when fixing the trac-12989 bug. Closes gh-4602
* Event: Only attach events to objects that accept data - for realMichał Gołębiowski-Owczarek2019-12-091-2/+3
| | | | | | | | | | There was a check in jQuery.event.add that was supposed to make it a noop for objects that don't accept data like text or comment nodes. The problem was the check was incorrect: it assumed `dataPriv.get( elem )` returns a falsy value for an `elem` that doesn't accept data but that's not the case - we get an empty object then. The check was changed to use `acceptData` directly. Fixes gh-4397 Closes gh-4558
* Core: Migrate from AMD to ES modules 🎉Michał Gołębiowski-Owczarek2019-11-181-18/+12
| | | | | | | | | | | | | | | | | | | | | | Migrate all source AMD modules to ECMAScript modules. The final bundle is compiled by a custom build process that uses Rollup under the hood. Test files themselves are still loaded via RequireJS as that has to work in IE 11. Tests can now be run in "Load as modules" mode which replaces the previous "Load with AMD" option. That option of running tests doesn't work in IE and Edge as it requires support for dynamic imports. Some of the changes required by the migration: * check `typeof` of `noGlobal` instead of using the variable directly as it's not available when modules are used * change the nonce module to be an object as ECMASscript module exports are immutable * remove some unused exports * import `./core/parseHTML.js` directly in `jquery.js` so that it's not being cut out when the `ajax` module is excluded in a custom compilation Closes gh-4541
* Core: Drop support for IE <11, iOS <11, Firefox <65, Android Browser & PhantomJSMichał Gołębiowski-Owczarek2019-04-291-37/+10
| | | | | | | | | | | Also, update support comments format to match format described in: https://github.com/jquery/contribute.jquery.org/issues/95#issuecomment-69379197 with the change from: https://github.com/jquery/contribute.jquery.org/issues/95#issuecomment-448998379 (open-ended ranges end with `+`). Fixes gh-3950 Fixes gh-4299 Closes gh-4347
* Event: Prevent leverageNative from registering duplicate dummy handlersRichard Gibson2019-04-291-5/+5
| | | | | | (cherry-picked from 6c1e7dbf7311ae7c0c31ba335fe216185047ae5f) Closes gh-4353
* Event: Fix handling of multiple async focus eventsRichard Gibson2019-04-291-12/+18
| | | | | | | (cherry-picked from 24d71ac70406f522fc1b09bf7c4025251ec3aee6) Fixes gh-4350 Closes gh-4354
* Event: Prevent leverageNative from double-firing focusinRichard Gibson2019-03-251-88/+84
| | | | | | Also, reduce size. Closes gh-4329 Ref gh-4279
* Event: Leverage native events for focus/blur/click; propagate additional dataRichard Gibson2019-03-201-20/+157
| | | | | | | | | | | | | | | | | | | | | Summary of the changes/fixes: 1. Trigger checkbox and radio click events identically (cherry-picked from b442abacbb8464f0165059e8da734e3143d0721f that was reverted before). 2. Manually trigger a native event before checkbox/radio handlers. 3. Add test coverage for triggering namespaced native-backed events. 4. Propagate extra parameters passed when triggering the click event to the handlers. 5. Intercept and preserve namespaced native-backed events. 6. Leverage native events for focus and blur. 7. Accept that focusin handlers may fire more than once for now. Fixes gh-1741 Fixes gh-3423 Fixes gh-3751 Fixes gh-4139 Closes gh-4279 Ref gh-1367 Ref gh-3494
* Event: Add "code" property to Event objecttmybr112018-04-171-0/+1
| | | | | Fixes gh-3978 Closes gh-3998
* Tests: fix tests in AMD modeTimmy Willison2018-01-161-1/+1
|
* Core: deprecate jQuery.isFunctionJason Bedard2018-01-151-2/+4
| | | | Fixes gh-3609
* Core: deprecate jQuery.nowTimmy Willison2018-01-081-1/+1
| | | | | Fixes gh-2959 Close gh-3884
* Revert "Event: Trigger checkbox and radio click events identically"Timmy Willison2017-03-201-7/+3
| | | | This reverts commit b442abacbb8464f0165059e8da734e3143d0721f.
* Build: fix tests in AMD modeTimmy Willison2017-03-061-3/+4
| | | | - nodeName was included at the wrong spot in dependency lists
* Core: Deprecate jQuery.nodeNamekaran-962017-03-011-3/+5
| | | | | Fixes gh-3475 Closes gh-3505
* Event: Trigger checkbox and radio click events identicallyAlex Padilla2017-01-191-4/+6
| | | | | Fixes gh-3423 Closes gh-3494
* Core: rnotwhite -> rhtmlnotwhite and jQuery.trim -> stripAndCollapseTimmy Willison2016-09-151-4/+4
| | | | | | | | | | | | - Renames and changes rnotwhite to focus on HTML whitespace chars - Change internal use of jQuery.trim to more accurate strip and collapse - Adds tests to ensure HTML space characters are retained where valid - Doesn't add tests where the difference is inconsequential and existing tests are adequate. Fixes gh-3003 Fixes gh-3072 Close gh-3316
* Event: Optimize delegated event processingRichard Gibson2016-08-041-17/+24
| | | | Closes gh-3255
* Build: Update eslint config and fix associated errorsOleg Gaidarenko2016-07-151-1/+13
|
* Event: Add the most commonly used pointer event propertiesScott González2016-06-091-0/+2
| | | | | Ref gh-3104 Close gh-3152
* Event: Allow constructing a jQuery.Event without a targetDave Methvin2016-06-021-1/+1
| | | | | Fixes gh-3139 Closes gh-3140
* Events: don't execute native stop(Immediate)Propagation from simulationOleg Gaidarenko2016-05-191-3/+4
| | | | | | In Firefox, called `stop(Immediate)Propagation` methods, in capturing phase prevents receiving focus Fixes gh-3111
* Event: Add touch event properties, eliminates need for a pluginDave Methvin2016-05-091-0/+3
| | | | | | | | | | | Fixes gh-3104 Closes gh-3108 See https://github.com/aarongloege/jquery.touchHooks Other properties are already present thanks to mouse events. squash! Add targetTouches
* Event: Cover invalid delegation selector edge casesRichard Gibson2016-05-061-3/+5
| | | | Ref 7fd36ea145a11d5896de6d064b546b1c57a83f34
* Event: Evaluate delegate selectors at add timeFelipe Sateler2016-05-061-0/+5
| | | | | | | This ensures that invalid selectors throw right away. Fixes gh-3071 Closes gh-3097
* Event: Remove pageX/pageY fill for event objectDave Methvin2016-05-061-34/+2
| | | | | | | Fixes gh-3092 CLoses gh-3106 IE8 was the last major browser missing these.
* Event: Remove fixHooks, propHooks; switch to ES5 getter with addPropJason Bedard2016-05-041-81/+115
| | | | | | | | | | | Fixes gh-3103 Fixes gh-1746 Closes gh-2860 - Removes the copy loop in jQuery.event.fix - Avoids accessing properties such as client/offset/page/screen X/Y which may cause style recalc or layouts - Simplifies adding property hooks to event object
* Event: Make event dispatch optimizable by JavaScript enginesDamian Senn2016-04-271-5/+9
| | | | | | | Closes gh-2834 - Do not assign to function parameters - Do not pass arguments object to other functions
* Build: Put all AMD modules in "src/" in strict modeMichał Gołębiowski2016-04-251-0/+2
| | | | Fixes gh-3073
* Docs: Update support comments to follow the new syntaxMichał Gołębiowski2016-03-301-5/+5
| | | | | The changes follow the spec proposed in: https://github.com/jquery/contribute.jquery.org/issues/95#issuecomment-69379197
* Docs:Tests: Remove obsolete code from tests, update support commentsMichał Gołębiowski2016-03-081-2/+2
| | | | | | | | | | Support comments that were lacking the final IE/Edge version that exhibits the bug were checked & updated. Links to the Chromium bug tracker were updated. Code in tests related to unsupported browsers (like Android 2.3 in non-basic tests) has been removed. Fixes gh-2868 Closes gh-2949
* Docs: use https where possibleBernhard M. Wiedemann2016-01-271-1/+1
| | | | Close gh-2875
* Event: Fix chaining .on() with null handlersDevin Wilson2016-01-191-0/+2
| | | | Fixes gh-2846
* Event: Separate trigger/simulate into its own moduleDave Methvin2015-11-061-225/+1
| | | | | | | | Fixes gh-1864 Closes gh-2692 This also pulls the focusin/out special event into its own module, since that depends on simulate(). NB: The ajax module triggers events pretty heavily.
* Event: Fix delegated radio events when arrow keys are usedDave Methvin2015-10-181-3/+4
| | | | | Fixes gh-2343, gh-2410 Close gh-2617
* Tests:Docs: Fix various typosGary Ye2015-10-121-1/+1
| | | | | | | | | | | | * Changes "baar" to "bar" when used with "foo" in readme and comments of js files * mousenter -> mouseenter Thanks @garysye, @KimTaehee Closes gh-2613 Closes gh-2601
* Data: Don't expose jQuery.acceptDataJason Bedard2015-09-081-5/+5
| | | | | | jQuery.acceptData is an undocumented internal API that shouldn't be exposed. Fixes gh-2555
* Build: Update jscs and lint filesOleg Gaidarenko2015-09-071-50/+70
| | | | Fixes gh-2056
* Event: Only check elements for delegation matchesRichard Gibson2015-08-101-1/+2
| | | | | | Closes gh-2529 Ref trac-13208 (cherry picked from commit fc2ba2e1361126c39f955437ee025cfca3bffa65)
* Event: Update support comments for mouseenter/mouseleave implementationMichał Gołębiowski2015-07-271-7/+4
| | | | | | | | | Custom mouseenter/mouseleave implementation was needed because of: 1. Safari 6 not implementing mouseenter/mouseleave at all. 2. Chrome sending mouseenter too often. The second issue has been fixed in Chrome but exists now in Safari 7 (it's fixed in Safari 8) so we have to keep it for now, unfortunately.
* Core: Adjust comments & tests after dropping Safari 6 supportMichał Gołębiowski2015-07-271-1/+1
| | | | | | | | Support comments that mentioned only Safari < 7 were checked & updated to account for bugs existing in newer versions as well; Safari 6 support test results were removed. Refs gh-2482
* Event: Remove an internal argument to the on methodMichał Gołębiowski2015-06-141-51/+55
| | | | Refs gh-2301