Skip to content

Indicate where data will be passed in $.one doc#855

Merged
mgol merged 1 commit into
jquery:masterfrom
cmisenas:data-param-doc
Mar 22, 2017
Merged

Indicate where data will be passed in $.one doc#855
mgol merged 1 commit into
jquery:masterfrom
cmisenas:data-param-doc

Conversation

@cmisenas
Copy link
Copy Markdown
Contributor

I only found the data after inspecting event further. This change will make it clearer where to get data (and consistent with the docs for .one( events [, selector ] [, data ], handler ) and .one( events [, selector ] [, data ] )).

If people think it would be great to make this change for other jquery fns too, the following fns still use the old desc:

entries/bind.xml
entries/blur.xml
entries/change.xml
entries/click.xml
entries/contextmenu.xml
entries/dblclick.xml
entries/delegate.xml
entries/error.xml
entries/focus.xml
entries/focusin.xml
entries/focusout.xml
entries/keydown.xml
entries/keypress.xml
entries/keyup.xml
entries/live.xml
entries/load-event.xml
entries/mousedown.xml
entries/mouseenter.xml
entries/mouseleave.xml
entries/mousemove.xml
entries/mouseout.xml
entries/mouseover.xml
entries/mouseup.xml
entries/resize.xml
entries/scroll.xml
entries/select.xml
entries/submit.xml

I'd be happy to make changes as part of this PR

@jquerybot
Copy link
Copy Markdown

Thank you for your pull request. It looks like this may be your first contribution to a jQuery Foundation project, if so we need you to sign our Contributor License Agreement (CLA).

📝 Please visit http://contribute.jquery.org/CLA/ to sign.

After you signed, the PR is checked again automatically after a minute. If there's still an issue, please reply here to let us know.


If you've already signed our CLA, it's possible your git author information doesn't match your CLA signature (both your name and email have to match), for more information, check the status of your CLA check.

@dmethvin
Copy link
Copy Markdown
Member

The link definitely helps clarify things!

As for all the now-discouraged "shortcut" methods, I would still prefer they just be defined in terms of the non-deprecated .on method rather than duplicating all the details about event handlers across more than a dozen pages.

Right now the text for the shortcut methods is all copy/pasta/edit, but I think it could be done with a notes.xml entry added to all the shortcut pages to the effect of:

This method is simply a shortcut for the use of the .on() method. Specifically, .METHOD(handler) is the same as .on( "METHOD", handler ); .METHOD( data, handler ) is the same as .on( "METHOD", data, handler ); and .METHOD() is the same as .trigger( "METHOD" ). For more information about events, see the entry for the .on() method.

Where METHOD is the title of that particular page, like <xsl:value-of select="@data-title" />. By doing it this way we can make the edit in that page once and tweak it without touching so many pages in the future.

@AurelioDeRosa
Copy link
Copy Markdown
Member

Hi @cmisenas and thank you for your contribution. The PR looks good to me.

Some notes:

  • @cmisenas would you like to submit another PR to address @dmethvin point?
  • @dmethvin I think it's still worth, at least for now, to update the documentation in all of those pages. Doing so, we keep the documentation more consistent and accurate.

@dmethvin
Copy link
Copy Markdown
Member

Sure @AurelioDeRosa, whatever works. It definitely affects them all but for whatever reason it seems like the selector in .prev and .next confuses people the most.

@mgol mgol merged commit 06e4ce4 into jquery:master Mar 22, 2017
@mgol
Copy link
Copy Markdown
Member

mgol commented Mar 22, 2017

Landed, thanks @cmisenas!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

7 participants