Skip to content

Commit aafce5b

Browse files
authored
Add mention of processNode to the docs (#627)
* Add mention of `processNode` to the docs * Fix new code examples highlighting
1 parent 03edc29 commit aafce5b

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

www/docs.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,23 @@ Hyperscript has an open, pluggable grammar & some advanced features do not ship
160160
To use a feature like workers you can install the extension directly by including `/dist/workers.js` after you
161161
include hyperscript.
162162

163+
If your HTML is received via AJAX or generated by scripts after initial page load, you need to call
164+
`_hyperscript.processNode()` to process the scripts on the new elements.
165+
166+
~~~ js
167+
element.appendChild(newContent);
168+
_hyperscript.processNode(newContent);
169+
~~~
170+
171+
You can also call it from hyperscript itself
172+
173+
~~~ hyperscript
174+
call _hyperscript.processNode(#new_element_id)
175+
```
176+
177+
Elements added by the [`put`](/commands/put) command are processed automatically; no need to call this function.
178+
[`Htmx`](https://htmx.org) does the same for all processed fragments.
179+
163180
## Language Basics {#basics}
164181
165182
A hyperscript script consists of a series of ["features"](/reference#features), the most common of which is an

0 commit comments

Comments
 (0)