Skip to content

Commit

Permalink
Example for eles.umerge() is malformed in the docs #1996
Browse files Browse the repository at this point in the history
- Fixes formatting.
- Clarifies on what collections these functions should be used.
  • Loading branch information
maxkfranz committed Oct 25, 2017
1 parent 630459c commit 441052f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
11 changes: 8 additions & 3 deletions documentation/md/collection/merge.md
Expand Up @@ -2,17 +2,22 @@

<span class="important-indicator"></span> This function modifies the calling collection instead of returning a new one. Use of this function should be considered for performance in some cases, but otherwise should be avoided. Consider using `eles.union()` instead.

<span class="important-indicator"></span> Use this function only on new collections that you create yourself, using `cy.collection()`. This ensures that you do not unintentionally modify another collection.

## Examples

With a collection:
```js
var col = cy.collection(); // new, empty collection
var j = cy.$('#j');
var e = cy.$('#e');

j.merge(e);
col.merge( j ).merge( e );
```

With a selector:
```js
cy.$('#j').merge('#e');
```
var col = cy.collection(); // new, empty collection

col.merge('#j').merge('#e');
```
17 changes: 14 additions & 3 deletions documentation/md/collection/unmerge.md
Expand Up @@ -2,16 +2,27 @@

<span class="important-indicator"></span> This function modifies the calling collection instead of returning a new one. Use of this function should be considered for performance in some cases, but otherwise should be avoided. Consider using `eles.filter()` or `eles.remove()` instead.

<span class="important-indicator"></span> Use this function only on new collections that you create yourself, using `cy.collection()`. This ensures that you do not unintentionally modify another collection.

## Examples

With a collection:

```js
var j = cy.nodes();
var col = cy.collection(); // new, empty collection
var e = cy.$('#e');

j.unmerge(e);
col.merge( cy.nodes() );

col.unmerge( e );
```

With a selector:

```js
cy.nodes().unmerge('#e');
var col = cy.collection(); // new, empty collection

col.merge( cy.nodes() );

col.unmerge('#e');
```

0 comments on commit 441052f

Please sign in to comment.