File tree 1 file changed +7
-8
lines changed
1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change 9
9
* @typedef {HastChild|HastRoot } HastNode
10
10
*
11
11
* @callback AfterTransform
12
- * Function called when a DOM node is transformed into a hast node
12
+ * Called when a DOM node was transformed into a hast node.
13
13
* @param {Node } domNode
14
- * The DOM node that was handled
15
- * @param {HastNode|undefined } hastNode
16
- * The corresponding hast node
14
+ * DOM node that was transformed.
15
+ * @param {HastNode } hastNode
16
+ * hast node the transform yielded.
17
17
* @returns {void }
18
+ * Nothing.
18
19
*
19
20
* @typedef Options
20
21
* @property {AfterTransform } [afterTransform]
21
- * Function called after a DOM node is transformed into a hast node.
22
- * Given the DOM node that was handled as the first parameter and the
23
- * corresponding hast node as the second parameter.
22
+ * Called when a DOM node was transformed into a hast node.
24
23
*/
25
24
26
25
import { webNamespaces } from 'web-namespaces'
@@ -56,7 +55,7 @@ export function fromDom(node, options = {}) {
56
55
*/
57
56
function transform ( node , ctx ) {
58
57
const transformed = one ( node , ctx )
59
- if ( ctx . afterTransform ) ctx . afterTransform ( node , transformed )
58
+ if ( ctx . afterTransform && transformed ) ctx . afterTransform ( node , transformed )
60
59
return transformed
61
60
}
62
61
You can’t perform that action at this time.
0 commit comments