Skip to content

Commit a65f71a

Browse files
minor #516 Fixed snippet to update a field via custom JS (glaubinix)
This PR was merged into the 2.x branch. Discussion ---------- Fixed snippet to update a field via custom JS | Q | A | ------------- | --- | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Tickets | no | License | MIT Commits ------- 7352f37 Fixed snippet to update a field via custom JS
2 parents 23f8bf0 + 12cd66a commit a65f71a

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import {
2+
htmlToElement,
3+
} from '../src/dom_utils';
4+
import { DiffDOM } from "diff-dom"
5+
6+
describe('diff-dom', () => {
7+
it('Just playing', () => {
8+
9+
10+
const dd = new DiffDOM();
11+
12+
const from = htmlToElement(`
13+
<div>
14+
Text at the top
15+
<div class="child-element">Child1 text</div>
16+
<div>between</div>
17+
<div class="child-element">Child2 text<span class="foo">icon</span></div>
18+
</div>
19+
`)
20+
21+
const to = htmlToElement(`
22+
<div>
23+
Text at the top
24+
<div class="child-element">Child1 text</div>
25+
<div>between</div>
26+
<div class="child-element">Child2 text</div>
27+
</div>
28+
`)
29+
30+
const diff = dd.diff(from, to)
31+
console.log(diff);
32+
});
33+
});

src/LiveComponent/src/Resources/doc/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ of the change:
439439
const rootElement = document.getElementById('favorite-food');
440440
input.value = 'sushi';
441441
442-
element.dispatchEvent(new Event('change', { bubbles: true }));
442+
input.dispatchEvent(new Event('change', { bubbles: true }));
443443
444444
JavaScript Component Hooks
445445
~~~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)