Skip to content

All: Fix event selectors #1229

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 1 commit into from
May 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions entries/ajaxComplete.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<argument name="&quot;ajaxComplete&quot;" type="string">
<desc>The string <code>"ajaxComplete"</code>.</desc>
</argument>
<argument name="handler" type="Function">
<argument name="handler" type="Function">
<argument name="event" type="Event" />
<argument name="jqXHR" type="jqXHR" />
<argument name="ajaxOptions" type="PlainObject" />
Expand All @@ -33,7 +33,7 @@ $( document ).on( "ajaxComplete", function() {
</code></pre>
<p>Now, make an Ajax request using any jQuery method:</p>
<pre><code>
$( ".trigger)" ).on( "click", function() {
$( ".trigger" ).on( "click", function() {
$( ".result" ).load( "ajax/test.html" );
} );
</code></pre>
Expand Down
2 changes: 1 addition & 1 deletion entries/ajaxSend.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ $( document ).on( "ajaxSend", function() {
</code></pre>
<p>Now, make an Ajax request using any jQuery method:</p>
<pre><code>
$( ".trigger)" ).on( "click", function() {
$( ".trigger" ).on( "click", function() {
$( ".result" ).load( "ajax/test.html" );
} );
</code></pre>
Expand Down
22 changes: 11 additions & 11 deletions entries/animate.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
</code></pre>
<p>To animate the opacity, left offset, and height of the image simultaneously:</p>
<pre><code>
$( "#clickme)" ).on( "click", function() {
$( "#clickme" ).on( "click", function() {
$( "#book" ).animate({
opacity: 0.25,
left: "+=50",
Expand Down Expand Up @@ -101,7 +101,7 @@ $( "li" ).animate({
<p>As of jQuery version 1.4, you can set per-property easing functions within a single <code>.animate()</code> call. In the first version of <code>.animate()</code>, each property can take an array as its value: The first member of the array is the CSS property and the second member is an easing function. If a per-property easing function is not defined for a particular property, it uses the value of the <code>.animate()</code> method's optional easing argument. If the easing argument is not defined, the default <code>swing</code> function is used.</p>
<p>For example, to simultaneously animate the width and height with the <code>swing</code> easing function and the opacity with the <code>linear</code> easing function:</p>
<pre><code>
$( "#clickme)" ).on( "click", function() {
$( "#clickme" ).on( "click", function() {
$( "#book" ).animate({
width: [ "toggle", "swing" ],
height: [ "toggle", "swing" ],
Expand All @@ -113,7 +113,7 @@ $( "#clickme)" ).on( "click", function() {
</code></pre>
<p>In the second version of <code>.animate()</code>, the options object can include the <code>specialEasing</code> property, which is itself an object of CSS properties and their corresponding easing functions. For example, to simultaneously animate the width using the <code>linear</code> easing function and the height using the <code>easeOutBounce</code> easing function:</p>
<pre><code>
$( "#clickme)" ).on( "click", function() {
$( "#clickme" ).on( "click", function() {
$( "#book" ).animate({
width: "toggle",
height: "toggle"
Expand All @@ -137,7 +137,7 @@ $( "#clickme)" ).on( "click", function() {
<code><![CDATA[
// Using multiple unit types within one animation.

$( "#go)" ).on( "click", function() {
$( "#go" ).on( "click", function() {
$( "#block" ).animate({
width: "70%",
opacity: 0.4,
Expand All @@ -162,11 +162,11 @@ $( "#go)" ).on( "click", function() {
<example>
<desc>Animates a div's left property with a relative value. Click several times on the buttons to see the relative animations queued up.</desc>
<code><![CDATA[
$( "#right)" ).on( "click", function() {
$( "#right" ).on( "click", function() {
$( ".block" ).animate({ "left": "+=50px" }, "slow" );
});

$( "#left)" ).on( "click", function(){
$( "#left" ).on( "click", function(){
$( ".block" ).animate({ "left": "-=50px" }, "slow" );
});
]]></code>
Expand All @@ -191,7 +191,7 @@ $( "#left)" ).on( "click", function(){

The second button starts a traditional chained animation, where each animation will start once the previous animation on the element has completed.</desc>
<code><![CDATA[
$( "#go1)" ).on( "click", function() {
$( "#go1" ).on( "click", function() {
$( "#block1" )
.animate({
width: "90%"
Expand All @@ -203,18 +203,18 @@ $( "#go1)" ).on( "click", function() {
.animate({ borderRightWidth: "15px" }, 1500 );
});

$( "#go2)" ).on( "click", function() {
$( "#go2" ).on( "click", function() {
$( "#block2" )
.animate({ width: "90%" }, 1000 )
.animate({ fontSize: "24px" }, 1000 )
.animate({ borderLeftWidth: "15px" }, 1000 );
});

$( "#go3)" ).on( "click", function() {
$( "#go3" ).on( "click", function() {
$( "#go1" ).add( "#go2" ).trigger( "click" );
});

$( "#go4)" ).on( "click", function() {
$( "#go4" ).on( "click", function() {
$( "div" ).css({
width: "",
fontSize: "",
Expand Down Expand Up @@ -248,7 +248,7 @@ $( "#go4)" ).on( "click", function() {
<example>
<desc>Animates the first div's left property and synchronizes the remaining divs, using the step function to set their left properties at each stage of the animation. </desc>
<code><![CDATA[
$( "#go)" ).on( "click", function() {
$( "#go" ).on( "click", function() {
$( ".block" ).first().animate({
left: 100
}, {
Expand Down
2 changes: 1 addition & 1 deletion entries/animated-selector.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<example>
<desc>Change the color of any div that is animated.</desc>
<code><![CDATA[
$( "#run)" ).on( "click", function() {
$( "#run" ).on( "click", function() {
$( "div:animated" ).toggleClass( "colored" );
});

Expand Down
4 changes: 2 additions & 2 deletions entries/clearQueue.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<example>
<desc>Empty the queue.</desc>
<code><![CDATA[
$( "#start)" ).on( "click", function() {
$( "#start" ).on( "click", function() {
var myDiv = $( "div" );
myDiv.show( "slow" );
myDiv.animate({
Expand All @@ -38,7 +38,7 @@ $( "#start)" ).on( "click", function() {
myDiv.slideUp();
});

$( "#stop)" ).on( "click", function() {
$( "#stop" ).on( "click", function() {
var myDiv = $( "div" );
myDiv.clearQueue();
myDiv.stop();
Expand Down
4 changes: 2 additions & 2 deletions entries/css.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<example>
<desc>Get the background color of a clicked div.</desc>
<code><![CDATA[
$( "div)" ).on( "click", function() {
$( "div" ).on( "click", function() {
var color = $( this ).css( "background-color" );
$( "#result" ).html( "That div is <span style='color:" +
color + ";'>" + color + "</span>." );
Expand All @@ -54,7 +54,7 @@ $( "div)" ).on( "click", function() {
<example>
<desc>Get the width, height, text color, and background color of a clicked div.</desc>
<code><![CDATA[
$( "div)" ).on( "click", function() {
$( "div" ).on( "click", function() {
var html = [ "The clicked div has the following styles:" ];

var styleProps = $( this ).css([
Expand Down
2 changes: 1 addition & 1 deletion entries/detach.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<example>
<desc>Detach all paragraphs from the DOM</desc>
<code><![CDATA[
$( "p)" ).on( "click", function() {
$( "p" ).on( "click", function() {
$( this ).toggleClass( "off" );
});
var p;
Expand Down
2 changes: 1 addition & 1 deletion entries/each.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ $( document.body ).on( "click", function() {
<example>
<desc>To access a jQuery object instead of the regular DOM element, use <code>$( this )</code>. For example:</desc>
<code><![CDATA[
$( "span)" ).on( "click", function() {
$( "span" ).on( "click", function() {
$( "li" ).each(function() {
$( this ).toggleClass( "example" );
});
Expand Down
4 changes: 2 additions & 2 deletions entries/fadeIn.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
&lt;img id="book" src="book.png" alt="" width="100" height="123"&gt;

// With the element initially hidden, we can show it slowly:
$( "#clickme)" ).on( "click", function() {
$( "#clickme" ).on( "click", function() {
$( "#book" ).fadeIn( "slow", function() {
// Animation complete
});
Expand Down Expand Up @@ -88,7 +88,7 @@ $( document.body ).on( "click", function() {
<example>
<desc>Fades a red block in over the text. Once the animation is done, it quickly fades in more text on top.</desc>
<code><![CDATA[
$( "a)" ).on( "click", function() {
$( "a" ).on( "click", function() {
$( "div" ).fadeIn( 3000, function() {
$( "span" ).fadeIn( 100 );
});
Expand Down
10 changes: 5 additions & 5 deletions entries/fadeOut.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</code></pre>
<p>With the element initially shown, we can hide it slowly:</p>
<pre><code>
$( "#clickme)" ).on( "click", function() {
$( "#clickme" ).on( "click", function() {
$( "#book" ).fadeOut( "slow", function() {
// Animation complete.
});
Expand All @@ -56,7 +56,7 @@ $( "#clickme)" ).on( "click", function() {
<example>
<desc>Animates all paragraphs to fade out, completing the animation within 600 milliseconds.</desc>
<code><![CDATA[
$( "p)" ).on( "click", function() {
$( "p" ).on( "click", function() {
$( "p" ).fadeOut( "slow" );
});
]]></code>
Expand All @@ -76,7 +76,7 @@ $( "p)" ).on( "click", function() {
<example>
<desc>Fades out spans in one section that you click on.</desc>
<code><![CDATA[
$( "span)" ).on( "click", function() {
$( "span" ).on( "click", function() {
$( this ).fadeOut( 1000, function() {
$( "div" ).text( "'" + $( this ).text() + "' has faded!" );
$( this ).remove();
Expand Down Expand Up @@ -113,15 +113,15 @@ $( "span" ).hover(function() {
<example>
<desc>Fades out two divs, one with a "linear" easing and one with the default, "swing," easing.</desc>
<code><![CDATA[
$( "#btn1)" ).on( "click", function() {
$( "#btn1" ).on( "click", function() {
function complete() {
$( "<div>" ).text( this.id ).appendTo( "#log" );
}
$( "#box1" ).fadeOut( 1600, "linear", complete );
$( "#box2" ).fadeOut( 1600, complete );
});

$( "#btn2)" ).on( "click", function() {
$( "#btn2" ).on( "click", function() {
$( "div" ).show();
$( "#log" ).empty();
});
Expand Down
4 changes: 2 additions & 2 deletions entries/fadeTo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
&lt;/div&gt;
&lt;img id="book" src="book.png" alt="" width="100" height="123"&gt;
// With the element initially shown, we can dim it slowly:
$( "#clickme)" ).on( "click", function() {
$( "#clickme" ).on( "click", function() {
$( "#book" ).fadeTo( "slow" , 0.5, function() {
// Animation complete.
});
Expand Down Expand Up @@ -80,7 +80,7 @@ Compare to this one that won't fade.
<example>
<desc>Fade div to a random opacity on each click, completing the animation within 200 milliseconds.</desc>
<code><![CDATA[
$( "div)" ).on( "click", function() {
$( "div" ).on( "click", function() {
$( this ).fadeTo( "fast", Math.random() );
});
]]></code>
Expand Down
6 changes: 3 additions & 3 deletions entries/height.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ $( document ).height();
function showHeight( element, height ) {
$( "div" ).text( "The height for the " + element + " is " + height + "px." );
}
$( "#getp)" ).on( "click", function() {
$( "#getp" ).on( "click", function() {
showHeight( "paragraph", $( "p" ).height() );
});
$( "#getd)" ).on( "click", function() {
$( "#getd" ).on( "click", function() {
showHeight( "document", $( document ).height() );
});
$( "#getw)" ).on( "click", function() {
$( "#getw" ).on( "click", function() {
showHeight( "window", $( window ).height() );
});
]]></code>
Expand Down
8 changes: 4 additions & 4 deletions entries/hide.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ $( ".target" ).hide();
</code></pre>
<pre><code>
// With the element initially shown, we can hide it slowly:
$( "#clickme)" ).on( "click", function() {
$( "#clickme" ).on( "click", function() {
$( "#book" ).hide( "slow", function() {
alert( "Animation complete." );
});
Expand Down Expand Up @@ -101,13 +101,13 @@ $( "button" ).on( "click", function() {
<example>
<desc>Animates all spans (words in this case) to hide fastly, completing each animation within 200 milliseconds. Once each animation is done, it starts the next one.</desc>
<code><![CDATA[
$( "#hider)" ).on( "click", function() {
$( "#hider" ).on( "click", function() {
$( "span:last-child" ).hide( "fast", function() {
// Use arguments.callee so we don't need a named function
$( this ).prev().hide( "fast", arguments.callee );
});
});
$( "#shower)" ).on( "click", function() {
$( "#shower" ).on( "click", function() {
$( "span" ).show( 2000 );
});
]]></code>
Expand All @@ -134,7 +134,7 @@ $( "#shower)" ).on( "click", function() {
for ( var i = 0; i < 5; i++ ) {
$( "<div>" ).appendTo( document.body );
}
$( "div)" ).on( "click", function() {
$( "div" ).on( "click", function() {
$( this ).hide( 2000, function() {
$( this ).remove();
});
Expand Down
2 changes: 1 addition & 1 deletion entries/html.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ $( "div.demo-container" ).html();
<example>
<desc>Click a paragraph to convert it from html to text.</desc>
<code><![CDATA[
$( "p)" ).on( "click", function() {
$( "p" ).on( "click", function() {
var htmlString = $( this ).html();
$( this ).text( htmlString );
});
Expand Down
2 changes: 1 addition & 1 deletion entries/index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ alert( "Index: " + $( "#bar" ).index() );
<example>
<desc>On click, returns the index (zero-based) of that div in the page.</desc>
<code><![CDATA[
$( "div)" ).on( "click", function() {
$( "div" ).on( "click", function() {
// `this` is the DOM element that was clicked
var index = $( "div" ).index( this );
$( "span" ).text( "That was div index #" + index );
Expand Down
8 changes: 4 additions & 4 deletions entries/is.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<desc>A function used as a test for every element in the set. It accepts two arguments, <code>index</code>, which is the element's index in the jQuery collection, and <code>element</code>, which is the DOM element. Within the function, <code>this</code> refers to the current DOM element.</desc>
<argument name="index" type="Integer" />
<argument name="element" type="Element" />
<return type="Boolean" />
<return type="Boolean" />
</argument>
</signature>
<signature>
Expand Down Expand Up @@ -63,7 +63,7 @@ $( "ul" ).on( "click", function( event ) {
</code></pre>
<p>You can attach a click handler to every <code>&lt;li&gt;</code> that evaluates the number of <code>&lt;strong&gt;</code> elements within the clicked <code>&lt;li&gt;</code> at that time like so:</p>
<pre><code>
$( "li)" ).on( "click", function() {
$( "li" ).on( "click", function() {
var li = $( this ),
isWithTwo = li.is(function() {
return $( "strong", this ).length === 2;
Expand Down Expand Up @@ -177,7 +177,7 @@ $( "div" ).text( "isFormParent = " + isFormParent );
<desc>Checks against an existing collection of alternating list elements. Blue, alternating list elements slide up while others turn red.</desc>
<code><![CDATA[
var alt = $( "#browsers li:nth-child(2n)" ).css( "background", "#0ff" );
$( "li)" ).on( "click", function() {
$( "li" ).on( "click", function() {
var li = $( this );
if ( li.is( alt ) ) {
li.slideUp();
Expand All @@ -204,7 +204,7 @@ $( "li)" ).on( "click", function() {
<desc>An alternate way to achieve the above example using an element rather than a jQuery object. Checks against an existing collection of alternating list elements. Blue, alternating list elements slide up while others turn red.</desc>
<code><![CDATA[
var alt = $( "#browsers li:nth-child(2n)" ).css( "background", "#0ff" );
$( "li)" ).on( "click", function() {
$( "li" ).on( "click", function() {
if ( alt.is( this ) ) {
$( this ).slideUp();
} else {
Expand Down
2 changes: 1 addition & 1 deletion entries/jQuery.fx.interval.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<desc>Cause all animations to run with less frames.</desc>
<code><![CDATA[
jQuery.fx.interval = 100;
$( "input)" ).on( "click", function() {
$( "input" ).on( "click", function() {
$( "div" ).toggle( 3000 );
});
]]></code>
Expand Down
2 changes: 1 addition & 1 deletion entries/jQuery.fx.off.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var toggleFx = function() {
};
toggleFx();
$( "button" ).on( "click", toggleFx );
$( "input)" ).on( "click", function() {
$( "input" ).on( "click", function() {
$( "div" ).toggle( "slow" );
} );
]]></code>
Expand Down
2 changes: 1 addition & 1 deletion entries/jQuery.getScript.xml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ $.cachedScript( "ajax/test.js" ).done(function( script, textStatus ) {
<code><![CDATA[
var url = "https://code.jquery.com/color/jquery.color-2.1.2.js";
$.getScript( url, function() {
$( "#go)" ).on( "click", function() {
$( "#go" ).on( "click", function() {
$( ".block" )
.animate({
backgroundColor: "rgb(255, 180, 180)"
Expand Down
Loading