Skip to content

Commit 76fe394

Browse files
committed
guides.WorkingWithVDom: code formatting #6875
1 parent cb63c4d commit 76fe394

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

learn/guides/WorkingWithVDom.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ While 99% of Neo.mjs development happens at the Component Tree layer, creating c
1515
Neo.mjs VDom nodes are plain JavaScript objects that represent DOM elements.
1616
**Important**: VDom only contains structure, styling, content, and attributes - **never event listeners**.
1717

18-
```javascript
18+
```javascript readonly
1919
// Basic VDom node structure
2020
{
2121
tag : 'div', // HTML tag (default: 'div')
@@ -41,7 +41,7 @@ Neo.mjs VDom nodes are plain JavaScript objects that represent DOM elements.
4141

4242
Components define their internal DOM structure via the `vdom` config:
4343

44-
```javascript
44+
```javascript readonly
4545
import Component from './src/component/Base.mjs';
4646

4747
class CustomButton extends Component {
@@ -81,7 +81,7 @@ For a comprehensive deep dive into all aspects of DOM event handling in Neo.mjs
8181

8282
Here's a simple example of how an event handler defined via `domListeners` would interact with a component's VDom:
8383

84-
```javascript
84+
```javascript readonly
8585
import Component from './src/component/Base.mjs';
8686
import VdomUtil from './src/util/Vdom.mjs'; // For accessing VDom nodes by flag
8787

@@ -144,7 +144,7 @@ class InteractiveComponent extends Component {
144144

145145
The typical way to sync VDom changes to the DOM is through the component's `update()` method:
146146

147-
```javascript
147+
```javascript readonly
148148
import Component from './src/component/Base.mjs'; // Required import
149149

150150
class StandardComponent extends Component {
@@ -180,7 +180,7 @@ class StandardComponent extends Component {
180180
For performance-critical scenarios, you can bypass the VDom worker's diffing engine and send manually crafted deltas
181181
directly from the App Worker to the Main Thread. This offers precise control but requires careful manual delta construction.
182182

183-
```javascript
183+
```javascript readonly
184184
import Component from './src/component/Base.mjs'; // Required import
185185

186186
class AdvancedComponent extends Component {
@@ -240,7 +240,7 @@ class AdvancedComponent extends Component {
240240

241241
Flags provide efficient, direct access to specific VDom nodes within a component's `vdom` structure, avoiding the need for DOM queries.
242242

243-
```javascript
243+
```javascript readonly
244244
import Component from './src/component/Base.mjs';
245245
import VdomUtil from './src/util/Vdom.mjs'; // Required import for VdomUtil
246246
import NeoArray from './src/util/Array.mjs'; // Required import for NeoArray
@@ -304,7 +304,7 @@ class IconButton extends Component {
304304

305305
Build VDom structures programmatically, often in response to data changes. This is common for lists or complex, data-driven UI fragments.
306306

307-
```javascript
307+
```javascript readonly
308308
import Component from './src/component/Base.mjs'; // Required import
309309

310310
class DataList extends Component {
@@ -380,7 +380,7 @@ class DataList extends Component {
380380
381381
For sophisticated UI patterns like 3D visualizations or complex dynamic layouts, you might imperatively calculate and apply VDom properties or even use `Neo.applyDeltas()` for maximum performance.
382382
383-
```javascript
383+
```javascript readonly
384384
import Component from './src/component/Base.mjs'; // Base component class
385385

386386
class Helix extends Component {
@@ -452,7 +452,7 @@ class Helix extends Component {
452452
453453
### XSS Prevention
454454
455-
```javascript
455+
```javascript readonly
456456
import Component from './src/component/Base.mjs'; // Required import
457457
// import DOMPurify from 'dompurify'; // Example for external sanitization library
458458

@@ -499,7 +499,7 @@ this.update();
499499
500500
### 1. Batch VDom Updates
501501
502-
```javascript
502+
```javascript readonly
503503
import Component from './src/component/Base.mjs'; // Required import
504504
import Neo from './src/Neo.mjs'; // Required import for Neo.applyDeltas
505505

@@ -547,7 +547,7 @@ class PerformantComponent extends Component {
547547
548548
### 2. Efficient Event Delegation
549549
550-
```javascript
550+
```javascript readonly
551551
import Component from './src/component/Base.mjs'; // Required import
552552

553553
class EfficientEventComponent extends Component {
@@ -595,7 +595,7 @@ super.construct(config);
595595
596596
### 3. Memory Management
597597
598-
```javascript
598+
```javascript readonly
599599
import Component from './src/component/Base.mjs'; // Required import
600600

601601
class MemoryEfficientComponent extends Component {
@@ -632,7 +632,7 @@ class MemoryEfficientComponent extends Component {
632632
633633
Dynamically show or hide VDom nodes by setting their `removeDom` property. This is efficient as the VDom node remains in the tree, but its corresponding DOM element is removed/added from the document flow by the framework.
634634
635-
```javascript
635+
```javascript readonly
636636
import Component from './src/component/Base.mjs'; // Required import
637637
import VdomUtil from './src/util/Vdom.mjs'; // Required import
638638

@@ -673,7 +673,7 @@ class ConditionalComponent extends Component {
673673
674674
Programmatically create and update lists of VDom nodes, typically from data. This approach is highly efficient as the VDom diffing engine optimizes the DOM updates.
675675
676-
```javascript
676+
```javascript readonly
677677
import Component from './src/component/Base.mjs'; // Required import
678678

679679
class ListComponent extends Component {

0 commit comments

Comments
 (0)