YD8877
YD8877

Reputation: 10790

... (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

Upvotes: 5

Views: 3670

Answers (5)

S.M. Pat
S.M. Pat

Reputation: 311

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)

Upvotes: 2

Barry Chapman
Barry Chapman

Reputation: 6780

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.

Upvotes: 11

Klaus Byskov Pedersen
Klaus Byskov Pedersen

Reputation: 120937

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.

Upvotes: 4

Jani Hartikainen
Jani Hartikainen

Reputation: 43243

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.

Upvotes: 6

Ahmet Kakıcı
Ahmet Kakıcı

Reputation: 6404

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

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

Upvotes: 4

Related Questions