-
Notifications
You must be signed in to change notification settings - Fork 260
delegate: Document the method was deprecated in jQuery 3 #948
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| <?xml version="1.0"?> | ||
| <entry type="method" name="undelegate" return="jQuery"> | ||
| <entry type="method" name="undelegate" return="jQuery" deprecated="3.0"> | ||
| <title>.undelegate()</title> | ||
| <desc>Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements.</desc> | ||
| <signature> | ||
|
|
@@ -43,7 +43,7 @@ | |
| </argument> | ||
| </signature> | ||
| <longdesc> | ||
| <p>The <code>.undelegate()</code> method is a way of removing event handlers that have been bound using <a href="/delegate/"><code>.delegate()</code></a>. <strong>As of jQuery 1.7</strong>, the <a href="/on/"><code>.on()</code></a> and <a href="/off/"><code>.off()</code></a> methods are preferred for attaching and removing event handlers.</p> | ||
| <p>The <code>.undelegate()</code> method is a way of removing event handlers that have been bound using <a href="/delegate/"><code>.delegate()</code></a>. As of jQuery 3.0, <code>.undelegate()</code> has been deprecated. It was superseded by the <a href="/off/"><code>.off()</code></a> method since jQuery 1.7, so its use was already discouraged.</p> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The deprecation message should appear first, before any description of the API. See e.g. https://api.jquery.com/live/. This applies to the
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
| </longdesc> | ||
| <example> | ||
| <desc>Can bind and unbind events to the colored button.</desc> | ||
|
|
@@ -124,4 +124,5 @@ $( "form" ).undelegate( ".whatever" ); | |
| <category slug="version/1.4.2"/> | ||
| <category slug="version/1.4.3"/> | ||
| <category slug="version/1.6"/> | ||
| <category slug="deprecated/deprecated-3.0"/> | ||
| </entry> | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't direct people to docs for deprecated APIs so I'd remove the reference to https://api.jquery.com/delegate/.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method is available anyway, so removing the link only add frustration in having to open a new tab, searching for the method, and then read the doc. We've already stated the correct method to use is
.on().There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But why would anyone search for docs for this method? Most likely because they use
.delegate()which can't be said about all the readers of the.bind()docs.I think we shouldn't link to pages about deprecated APIs, they should serve first as a warning to not use the API and second as docs for the API for people that already use it in their code. If there is useful info about event delegation there that's not available on the
.on()page it should just be moved to the.on()page so that it's not required to look at pages for deprecated APIs to learn something generally useful.(to clarify, I wanted to have the
.delegate()mention removed completely, not just the link to the page)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AurelioDeRosa Hey, do you have any remarks to my comment? For me this is the only thing left before this can be landed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AurelioDeRosa Ping? We need this PR to land to unbreak the build.
@jquery/core @jquery/content any opinion on my comments? I need someone to agree with either of us so that we can land it.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main reason someone might search specifically for
.delegate()would be to figure out how to convert a call to.on(). That wouldn't apply for this reference. Any explanation of delegated events in.delegate()should be duplicated in.on(), I think it already should be there but if not we can open a new ticket to fix it.If #971 can be addressed adequately (e.g. via a watermark) there wouldn't be any doubt about the method being deprecated and/or removed. As I mentioned in #972 I think there might be good reasons to keep, for example, the
click-specific information in the.click()method docs, but that doesn't apply here either.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dmethvin As I understand you, you agree with me it's best not to link to
.delegate()here? I'll go ahead & remove the link and land it then so that we have an unbroken build.