Skip to content

Commit f03255b

Browse files
Syntax highlighting for keywords
1 parent 8431603 commit f03255b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Then create an instance of diffDOM within the javascript code:
3131
dd = new diffDOM();
3232
```
3333
34-
Now you can create a diff to get from dom elementA to dom elementB like this:
34+
Now you can create a diff to get from dom `elementA` to dom `elementB` like this:
3535
```js
3636
diff = dd.diff(elementA, elementB);
3737
```
@@ -40,7 +40,7 @@ You can now apply this diff like this:
4040
```js
4141
dd.apply(elementA, diff);
4242
```
43-
Now elementA will have been changed to be structurally equal to elementB.
43+
Now `elementA` will have been changed to be structurally equal to `elementB`.
4444
4545
### Advanced uses
4646
@@ -54,7 +54,7 @@ Now elementA will be what it was like before applying the diff.
5454
5555
#### Remote changes
5656
57-
If you need to move diffs from one machine to another one, you will likely want to send the diffs through a websocket connection or as part of a form submit. In both cases you need to convert the diff to a json string.
57+
If you need to move diffs from one machine to another one, you will likely want to send the diffs through a websocket connection or as part of a form submit. In both cases you need to convert the diff to a json `string`.
5858
5959
To convert a diff to a json string which you can send over the network, do:
6060
```js
@@ -68,7 +68,7 @@ diff = JSON.parse(diffJson);
6868
6969
#### Error handling when patching/applying
7070
71-
Sometimes one may try to patch an elment without knowing whether the patch actually will apply cleanly. This should not be a problem. If diffDOM determines that a patch cannot be executed, it will simple return false. Else it will return true:
71+
Sometimes one may try to patch an elment without knowing whether the patch actually will apply cleanly. This should not be a problem. If diffDOM determines that a patch cannot be executed, it will simple return `false`. Else it will return `true`:
7272
```js
7373
result = dd.apply(element, diff);
7474
@@ -80,7 +80,7 @@ if (result) {
8080
```
8181
#### Advanced merging of text node changes
8282
83-
diffDOM does not include merging for changes to text nodes. However, it includes hooks so that you can add more advanced handling. Simple overwrite the textDiff function of the diffDOM instance. The functions TEXTDIFF and TEXTPATCH need to be defined in the code:
83+
diffDOM does not include merging for changes to text nodes. However, it includes hooks so that you can add more advanced handling. Simple overwrite the `textDiff` function of the `diffDOM` instance. The functions TEXTDIFF and TEXTPATCH need to be defined in the code:
8484
```js
8585
dd = new diffDOM({
8686
textDiff: function (node, currentValue, expectedValue, newValue) {
@@ -118,7 +118,7 @@ dd = new diffDOM({
118118
});
119119
```
120120
121-
Additionally, the _pre_ hooks allow you to shortcircuit the standard behaviour of the diff by returning 'true' from this callback. This will cause the diffApply functions to return prematurely, skipping their standard behaviour.
121+
Additionally, the _pre_ hooks allow you to shortcircuit the standard behaviour of the diff by returning `true` from this callback. This will cause the `diffApply` functions to return prematurely, skipping their standard behaviour.
122122
123123
```js
124124
dd = new diffDOM({

0 commit comments

Comments
 (0)