简体   繁体   中英

… (three dots) in jQuery?

I was looking at the documentation page for jScroll plugin for jQuery ( http://demos.flesler.com/jquery/scrollTo ) and I noticed this :

$(...).scrollTo( $('ul').get(2).childNodes[20], 800 );

So, what does the three dots in jQuery mean ? I have never seen this selector before

EDIT :

DOM Element

This is from the source HTML. Viewing the source for the following links :

Relative 
selectorjQuery 
objectDOM 
ElementAbsolute 
numberAbsolute

all give the same implementation.

EDIT : I didnt look at the attribute clearly, its for the title attribute. I assumed its the href attribute. Feel silly asking this question now :) Thanks for the answers

I am fairly certain that he was using that as an example.

$( ... ) would be akin to $( your-selector-here ) .

In other words, I have never seen any implementation of that.

Typically ... is used in various docs to shorten the example, and it means that you put something in place of the dots, or that what you would put there was omitted (to shorten the example)

It's not actually valid JS syntax.

It has no meaning. They meant just write your own selector. Check out the souce code

$('div.pane').scrollTo( 0 );

They are not syntactically correct. They are just way the author uses to say scroll to some element, the name of which I don't bother to write here so I just write dots. Check the source code of the page if in doubt.

Three dots in javascript is Spread Syntax see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax

allows an iterable such as an array expression or string to be expanded in places where zero or more arguments (for function calls) or elements (for array literals)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM