Skip to content

Commit 1d46f06

Browse files
Anandhu936sachinchoolur
authored andcommitted
add description to all jquery alternatives
1 parent f6ecb66 commit 1d46f06

File tree

1 file changed

+46
-39
lines changed

1 file changed

+46
-39
lines changed

README.MD

Lines changed: 46 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@ Similarly, all the examples you see below, will add it's dependencies when you g
154154
## List of jQuery alternative methods in alphabetical order
155155

156156
##### addClass
157+
Adds the specified class(es) to each element in the set of matched elements.
158+
159+
157160

158161
```js
159162
addClass(classNames = '') {
@@ -172,7 +175,7 @@ $utils('ul li').addClass('myClass yourClass');
172175
```
173176

174177
##### append
175-
178+
Insert content, specified by the parameter, to the end of each element in the set of matched elements.
176179
```js
177180
append(html) {
178181
this.each((el) => {
@@ -187,6 +190,7 @@ append(html) {
187190
```
188191

189192
##### attr
193+
Get the value of an attribute for the first element in the set of matched elements or set one or more attributes for every matched element.
190194

191195
```js
192196
attr(name, value) {
@@ -204,15 +208,15 @@ attr(name, value) {
204208
```
205209

206210
##### children
207-
211+
Get the children of each element in the set of matched elements, optionally filtered by a selector.
208212
```js
209213
children() {
210214
return new Utils(this.element.children);
211215
}
212216
```
213217

214218
##### closest
215-
219+
For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
216220
```js
217221
closest(selector) {
218222
if (!this.element) {
@@ -235,7 +239,7 @@ closest(selector) {
235239
```
236240

237241
##### css
238-
242+
Get the computed style properties for the first element in the set of matched elements.
239243
```js
240244
css(css, value) {
241245
if (value !== undefined) {
@@ -261,15 +265,15 @@ css(css, value) {
261265
```
262266

263267
##### data
264-
268+
Store arbitrary data associated with the matched elements.
265269
```js
266270
data(name, value) {
267271
return this.attr(`data-${name}`, value);
268272
}
269273
```
270274

271275
##### each
272-
276+
Iterate over a jQuery object, executing a function for each matched element.
273277
```js
274278
each(func) {
275279
if (!this.elements) {
@@ -287,7 +291,7 @@ each(func) {
287291
```
288292

289293
##### empty
290-
294+
Remove all child nodes of the set of matched elements from the DOM.
291295
```js
292296
empty() {
293297
this.each((el) => {
@@ -298,23 +302,23 @@ empty() {
298302
```
299303

300304
##### eq
301-
305+
Reduce the set of matched elements to the one at the specified index.
302306
```js
303307
eq(index) {
304308
return new Utils(this.elements[index]);
305309
}
306310
```
307311

308312
##### find
309-
313+
Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element.
310314
```js
311315
find(selector) {
312316
return new Utils(Utils.getSelector(selector, this.element));
313317
}
314318
```
315319

316320
##### first
317-
321+
Reduce the set of matched elements to the first in the set.
318322
```js
319323
first() {
320324
if (this.elements && this.elements.length !== undefined) {
@@ -325,15 +329,15 @@ first() {
325329
```
326330

327331
##### get
328-
332+
Load data from the server using a HTTP GET request.
329333
```js
330334
get() {
331335
return this.elements;
332336
}
333337
```
334338

335339
##### hasClass
336-
340+
Determine whether any of the matched elements are assigned the given class.
337341
```js
338342
hasClass(className) {
339343
if (!this.element) {
@@ -344,7 +348,7 @@ hasClass(className) {
344348
```
345349

346350
##### height
347-
351+
Get the current computed height for the first element in the set of matched elements.
348352
```js
349353
height() {
350354
if (!this.element) {
@@ -356,7 +360,7 @@ height() {
356360
```
357361

358362
##### html
359-
363+
Get the HTML contents of the first element in the set of matched elements.
360364
```js
361365
html(html) {
362366
if (html === undefined) {
@@ -374,6 +378,7 @@ html(html) {
374378

375379
##### index
376380

381+
Search for a given element from among the matched elements.
377382
```js
378383
index() {
379384
if (!this.element) return -1;
@@ -386,7 +391,7 @@ index() {
386391
```
387392

388393
##### is
389-
394+
Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments.
390395
```js
391396
is(el) {
392397
if (typeof el === 'string') {
@@ -404,7 +409,7 @@ is(el) {
404409
```
405410

406411
##### next
407-
412+
Get the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector.
408413
```js
409414
next() {
410415
if (!this.element) {
@@ -415,7 +420,7 @@ next() {
415420
```
416421

417422
##### nextAll
418-
423+
Get all following siblings of each element in the set of matched elements, optionally filtered by a selector.
419424
```js
420425
nextAll(filter) {
421426
if (!this.element) {
@@ -438,7 +443,7 @@ nextAll(filter) {
438443
```
439444

440445
##### off
441-
446+
Remove an event handler.
442447
```js
443448
off(event) {
444449
if (!this.elements) {
@@ -462,7 +467,7 @@ off(event) {
462467
```
463468

464469
##### offset
465-
470+
Get the current coordinates of the first element in the set of matched elements, relative to the document.
466471
```js
467472
offset() {
468473
if (!this.element) {
@@ -486,7 +491,7 @@ offset() {
486491
```
487492

488493
##### offsetParent
489-
494+
Get the closest ancestor element that is positioned.
490495
```js
491496
offsetParent() {
492497
if (!this.element) {
@@ -497,7 +502,7 @@ offsetParent() {
497502
```
498503

499504
##### on
500-
505+
Attach an event handler function for one or more events to the selected elements.
501506
```js
502507
on(events, listener) {
503508
if (!this.elements) {
@@ -518,7 +523,7 @@ on(events, listener) {
518523
```
519524

520525
##### one
521-
526+
Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
522527
```js
523528
one(event, listener) {
524529
this.each((el) => {
@@ -532,7 +537,7 @@ one(event, listener) {
532537
```
533538

534539
##### outerHeight
535-
540+
Get the current computed outer height (including padding, border, and optionally margin) for the first element in the set of matched elements.
536541
```js
537542
outerHeight(margin) {
538543
if (!this.element) {
@@ -552,7 +557,7 @@ outerHeight(margin) {
552557
```
553558

554559
##### outerWidth
555-
560+
Get the current computed outer width (including padding, border, and optionally margin) for the first element in the set of matched elements.
556561
```js
557562
outerWidth(margin) {
558563
if (!this.element) {
@@ -573,14 +578,15 @@ outerWidth(margin) {
573578

574579
##### parent
575580

581+
Get the parent of each element in the current set of matched elements, optionally filtered by a selector.
576582
```js
577583
parent() {
578584
return new Utils(this.element.parentElement);
579585
}
580586
```
581587

582588
##### parentsUntil
583-
589+
Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object.
584590
```js
585591
parentsUntil(selector, filter) {
586592
if (!this.element) {
@@ -608,7 +614,7 @@ parentsUntil(selector, filter) {
608614
```
609615

610616
##### position
611-
617+
Get the current coordinates of the first element in the set of matched elements, relative to the offset parent.
612618
```js
613619
position() {
614620
return {
@@ -619,7 +625,7 @@ position() {
619625
```
620626

621627
##### prepend
622-
628+
Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.
623629
```js
624630
prepend(html) {
625631
this.each((el) => {
@@ -634,7 +640,7 @@ prepend(html) {
634640
```
635641

636642
##### prev
637-
643+
Get the immediately preceding sibling of each element in the set of matched elements. If a selector is provided, it retrieves the previous sibling only if it matches that selector.
638644
```js
639645
prev() {
640646
if (!this.element) {
@@ -645,7 +651,7 @@ prev() {
645651
```
646652

647653
##### prevAll
648-
654+
Get all preceding siblings of each element in the set of matched elements, optionally filtered by a selector, in the reverse document order.
649655
```js
650656
prevAll(filter) {
651657
if (!this.element) {
@@ -663,7 +669,7 @@ prevAll(filter) {
663669
```
664670

665671
##### remove
666-
672+
Remove the set of matched elements from the DOM.
667673
```js
668674
remove() {
669675
this.each((el) => {
@@ -675,6 +681,7 @@ remove() {
675681

676682
##### removeAttr
677683

684+
Remove an attribute from each element in the set of matched elements.
678685
```js
679686
removeAttr(attributes) {
680687
const attrs = attributes.split(' ');
@@ -686,7 +693,7 @@ removeAttr(attributes) {
686693
```
687694

688695
##### removeClass
689-
696+
Remove a single class or multiple classes from each element in the set of matched elements.
690697
```js
691698
removeClass(classNames) {
692699
this.each((el) => {
@@ -700,7 +707,7 @@ removeClass(classNames) {
700707
```
701708

702709
##### siblings
703-
710+
Get the siblings of each element in the set of matched elements, optionally filtered by a selector.
704711
```js
705712
siblings() {
706713
if (!this.element) {
@@ -715,7 +722,7 @@ siblings() {
715722
```
716723

717724
##### text
718-
725+
Get the combined text contents of each element in the set of matched elements, including their descendants.
719726
```js
720727
text(text) {
721728
if (text === undefined) {
@@ -732,7 +739,7 @@ text(text) {
732739
```
733740

734741
##### toggleClass
735-
742+
Add or remove one or more classes from each element in the set of matched elements, depending on either the class’s presence or the value of the state argument.
736743
```js
737744
toggleClass(className) {
738745
if (!this.element) {
@@ -743,7 +750,7 @@ toggleClass(className) {
743750
```
744751

745752
##### trigger
746-
753+
Execute all handlers and behaviors attached to the matched elements for the given event type.
747754
```js
748755
trigger(event, detail) {
749756
if (!this.element) {
@@ -769,7 +776,7 @@ trigger(event, detail) {
769776
```
770777

771778
##### unwrap
772-
779+
Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place.
773780
```js
774781
unwrap() {
775782
this.each((el) => {
@@ -785,7 +792,7 @@ unwrap() {
785792
```
786793

787794
##### val
788-
795+
Get the current value of the first element in the set of matched elements.
789796
```js
790797
val(value) {
791798
if (!this.element) {
@@ -799,7 +806,7 @@ val(value) {
799806
```
800807

801808
##### width
802-
809+
Get the current computed width for the first element in the set of matched elements.
803810
```js
804811
width() {
805812
if (!this.element) {
@@ -811,7 +818,7 @@ width() {
811818
```
812819

813820
##### wrap
814-
821+
Wrap an HTML structure around each element in the set of matched elements.
815822
```js
816823
wrap(className) {
817824
this.each((el) => {

0 commit comments

Comments
 (0)