Skip to content

All: Mark event aliases as deprecated #1223

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 33 commits into from
Apr 24, 2023
Merged
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
1b00d2b
All: Mark event aliases as deprecated
mgol Apr 16, 2023
bff1493
All: Remove the detach-shorthand note
mgol Apr 17, 2023
bf1f218
ajaxStart: Mark the shorthand method as deprecated
mgol Apr 17, 2023
54f5c8e
All: Fix Additional Notes for all AJAX events
mgol Apr 17, 2023
df4a1c6
focus: Deprecate .focus(), tweak the blur page
mgol Apr 18, 2023
9c7639f
All: Separate blur & focus shorthand pages
mgol Apr 18, 2023
c696ca7
All: Tweak focus/blur, migrate focusin/focusout
mgol Apr 18, 2023
3b02e6b
All: Fix indentation of examples
mgol Apr 18, 2023
35b481f
hover: Deprecate the API
mgol Apr 20, 2023
a23ab44
All: Add individual descriptions back
mgol Apr 20, 2023
4f08883
resize: Deprecate the API
mgol Apr 20, 2023
8905219
All: Deprecate scroll, click & dblclick; fix resize
mgol Apr 21, 2023
a270b7a
All: De-indent entries on event pages for better Git history
mgol Apr 21, 2023
f4b077b
ajaxStart: separate the deprecated page
mgol Apr 21, 2023
611f3c7
All: Move descriptions in Ajax event pages up
mgol Apr 21, 2023
47c6e85
All: JavaScript event -> event
mgol Apr 21, 2023
e70bfa5
All: Deprecate mouse* shorthands
mgol Apr 21, 2023
e6d774d
All: Deprecate change & select
mgol Apr 21, 2023
2537bc7
All: Remove a few .click() uses
mgol Apr 21, 2023
db29f90
All: Deprecate other event shorthands
mgol Apr 23, 2023
027012f
All: Add separate shorthand pages for load/unload
mgol Apr 23, 2023
4f41f67
All: Link to shorthands from event pages
mgol Apr 23, 2023
ada6134
All: Add other AJAX shorthand pages
mgol Apr 23, 2023
6f41267
All: Migrare AJAX event pages
mgol Apr 23, 2023
6f9101b
All: Remove obsolete shortcut notes
mgol Apr 23, 2023
f6ac37a
error: Separate the event page, like for load & unload
mgol Apr 23, 2023
d0ef87b
All: Remove internal usage of deprecated event shorthands
mgol Apr 23, 2023
16ea4ad
All: Tweak wording on event pages on on/bind
mgol Apr 23, 2023
4205fd6
All: Remove internal ajax event shorthand usage
mgol Apr 23, 2023
fecc648
All: Add descriptions to ajax event shorthand pages
mgol Apr 23, 2023
65d3204
All: Tweak the warning on load/unload, add one for error
mgol Apr 24, 2023
a7fa37f
All: Add shorthand notes on AJAX event pages as well
mgol Apr 24, 2023
b4bc05e
All: Fix links to AJAX events on shorthand pages
mgol Apr 24, 2023
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
Next Next commit
All: Mark event aliases as deprecated
Fixes gh-1205
  • Loading branch information
mgol committed Apr 23, 2023
commit 1b00d2bbabfc0fa0d00e1582c34cc5e63bec12a1
173 changes: 109 additions & 64 deletions entries/blur.xml
Original file line number Diff line number Diff line change
@@ -1,66 +1,111 @@
<?xml version="1.0"?>
<entry type="method" name="blur" return="jQuery">
<title>.blur()</title>
<entries>
<desc>Bind an event handler to the "blur" JavaScript event, or trigger that event on an element.</desc>
<signature>
<added>1.0</added>
<argument name="handler" type="Function">
<desc>A function to execute each time the event is triggered.</desc>
<argument name="eventObject" type="Event" />
</argument>
</signature>
<signature>
<added>1.4.3</added>
<argument name="eventData" type="Anything" optional="true">
<desc>An object containing data that will be passed to the event handler.</desc>
</argument>
<argument name="handler" type="Function">
<desc>A function to execute each time the event is triggered.</desc>
<argument name="eventObject" type="Event" />
</argument>
</signature>
<signature>
<added>1.0</added>
</signature>
<longdesc>
<p>This method is a shortcut for <code>.on( "blur", handler )</code> in the first two variations, and <code>.trigger( "blur" )</code> in the third.</p>
<p>The <code>blur</code> event is sent to an element when it loses focus. Originally, this event was only applicable to form elements, such as <code>&lt;input&gt;</code>. In recent browsers, the domain of the event has been extended to include all element types. An element can lose focus via keyboard commands, such as the Tab key, or by mouse clicks elsewhere on the page.</p>
<p>For example, consider the HTML:</p>
<pre><code>
&lt;form&gt;
&lt;input id="target" type="text" value="Field 1"&gt;
&lt;input type="text" value="Field 2"&gt;
&lt;/form&gt;
&lt;div id="other"&gt;
Trigger the handler
&lt;/div&gt;
The event handler can be bound to the first input field:
$( "#target" ).blur(function() {
alert( "Handler for .blur() called." );
});
</code></pre>
<p>Now if the first field has the focus, clicking elsewhere or tabbing away from it displays the alert:</p>
<p>
<samp>Handler for .blur() called.</samp>
</p>
<p>To trigger the event programmatically, apply <code>.blur()</code> without an argument:</p>
<pre><code>
$( "#other" ).click(function() {
$( "#target" ).blur();
});
</code></pre>
<p>After this code executes, clicks on <samp>Trigger the handler</samp> will also alert the message.</p>
<p>The <code>blur</code> event does not bubble in Internet Explorer. Therefore, scripts that rely on event delegation with the <code>blur</code> event will not work consistently across browsers. As of version 1.4.2, however, jQuery works around this limitation by mapping <code>blur</code> to the <code>focusout</code> event in its event delegation methods, <a href="/live/"><code>.live()</code></a> and <a href="/delegate/"><code>.delegate()</code></a>.</p>
</longdesc>
<note id="detach-shorthand" type="additional" data-event="blur"/>
<example>
<desc>To trigger the blur event on all paragraphs:</desc>
<code><![CDATA[
$( "p" ).blur();
]]></code>
</example>
<category slug="events/form-events"/>
<category slug="forms"/>
<category slug="version/1.0"/>
<category slug="version/1.4.3"/>
</entry>
<entry type="method" name="on" return="jQuery">
<title>blur event</title>
<signature>
<added>1.7</added>
<argument name="&quot;blur&quot;" type="string">
<desc>The string <code>"blur"</code>.</desc>
</argument>
<argument name="eventData" type="Anything" optional="true">
<desc>An object containing data that will be passed to the event handler.</desc>
</argument>
<argument name="handler" type="Function">
<desc>A function to execute each time the event is triggered.</desc>
<argument name="eventObject" type="Event" />
</argument>
</signature>
<longdesc>
<p>The <code>blur</code> event is sent to an element when it loses focus. Originally, this event was only applicable to form elements, such as <code>&lt;input&gt;</code>. In recent browsers, the domain of the event has been extended to include all element types. An element can lose focus via keyboard commands, such as the Tab key, or by mouse clicks elsewhere on the page.</p>
<p>For example, consider the HTML:</p>
<pre><code>
&lt;form&gt;
&lt;input id="target" type="text" value="Field 1"&gt;
&lt;input type="text" value="Field 2"&gt;
&lt;/form&gt;
&lt;div id="other"&gt;
Trigger the handler
&lt;/div&gt;
The event handler can be bound to the first input field:
$( "#target" ).on( "blur", function() {
alert( "Handler for `blur` called." );
} );
</code></pre>
<p>Now if the first field has the focus, clicking elsewhere or tabbing away from it displays the alert:</p>
<p>
<samp>Handler for `blur` called.</samp>
</p>
<p>To trigger the event programmatically, call <code>.trigger( "blur" )</code>:</p>
<pre><code>
$( "#other" ).on( "click", function() {
$( "#target" ).trigger( "blur" );
} );
</code></pre>
<p>After this code executes, clicks on <samp>Trigger the handler</samp> will also alert the message.</p>
<p>The <code>blur</code> event does not bubble in Internet Explorer. Therefore, scripts that rely on event delegation with the <code>blur</code> event will not work consistently across browsers. As of version 1.4.2, however, jQuery works around this limitation by mapping <code>blur</code> to the <code>focusout</code> event in its event delegation methods, <a href="/live/"><code>.live()</code></a> and <a href="/delegate/"><code>.delegate()</code></a>.</p>
</longdesc>
<note id="detach-shorthand" type="additional" data-event="blur"/>
<example>
<desc>To trigger the blur event on all paragraphs:</desc>
<code><![CDATA[
$( "p" ).trigger( "blur" );
]]></code>
</example>
<category slug="events/form-events"/>
<category slug="forms"/>
<category slug="version/1.7"/>
</entry>

<entry type="method" name="trigger" return="jQuery">
<title>.trigger( "blur" )</title>
<signature>
<added>1.7</added>
<argument name="&quot;blur&quot;" type="string">
<desc>The string <code>"blur"</code>.</desc>
</argument>
</signature>
<longdesc>
<p>See the description for <a href="#on1"><code>.on( "blur", ... )</code></a>.</p>
</longdesc>
<category slug="events/form-events"/>
<category slug="forms"/>
<category slug="version/1.7"/>
</entry>

<entry type="method" name="blur" return="jQuery" deprecated="3.3">
<title>.blur()</title>
<signature>
<added>1.0</added>
<argument name="handler" type="Function">
<desc>A function to execute each time the event is triggered.</desc>
<argument name="eventObject" type="Event" />
</argument>
</signature>
<signature>
<added>1.4.3</added>
<argument name="eventData" type="Anything" optional="true">
<desc>An object containing data that will be passed to the event handler.</desc>
</argument>
<argument name="handler" type="Function">
<desc>A function to execute each time the event is triggered.</desc>
<argument name="eventObject" type="Event" />
</argument>
</signature>
<signature>
<added>1.0</added>
</signature>
<longdesc>
<div class="warning">
<p>This API is deprecated.</p>
<p>Instead of <code>.blur( handler )</code> or <code>.blur( eventData, handler )</code>, use <a href="#on1"><code>.on( "blur", handler )</code></a> or <a href="#on1"><code>.on( "blur", eventData, handler )</code></a>, respectively.</p>
<p>Instead of <code>.blur()</code>, use <a href="#trigger2"><code>.trigger( "blur" )</code></a>.</p>
</div>
</longdesc>
<category slug="events/form-events"/>
<category slug="forms"/>
<category slug="version/1.0"/>
<category slug="version/1.4.3"/>
<category slug="deprecated/deprecated-3.3"/>
</entry>
</entries>