Skip to main content
Create new
Introduction
Reactivity
Props
Logic
Events
Bindings
Lifecycle
Stores
Motion
Transitions
Animations
Easing
SVG
Actions
Classes
Component composition
Context API
Special elements
Module context
Debugging
7GUIs
Miscellaneous
App.svelte
<script>
let object = {
func: function(node) {
console.log(node.textContent)
}
}
</script>

<div use:object.func>
Text
</div>

Error compiling component

WebAssembly.instantiateStreaming(): value type opcode @+13
/* App.svelte generated by Svelte v3.27.0 */
import {
SvelteComponent,
action_destroyer,
detach,
element,
init,
insert,
noop,
safe_not_equal
} from "svelte/internal";

function create_fragment(ctx) {
let div;
let object_func_action;
let mounted;
let dispose;

return {
c() {
div = element("div");
div.textContent = "Text";
},
m(target, anchor) {
insert(target, div, anchor);

if (!mounted) {
dispose = action_destroyer(object_func_action = /*object*/ ctx[0].func(div));
mounted = true;
}
},
p: noop,
i: noop,
o: noop,
d(detaching) {
if (detaching) detach(div);
result = svelte.compile(source, {
generate: ,
});
/* Add a <style> tag to see the CSS output */
		
			
				
  • {
    • html: Fragment {...}
      • start: 110
      • end: 145
      • type: "Fragment"
      • children: [...] (2)
        • Text {...}
          • start: 108
          • end: 110
          • type: "Text"
          • raw: "\n\n"
          • data: "\n\n"
          }
        • Element {...}
          • start: 110
          • end: 145
          • type: "Element"
          • name: "div"
          • attributes: [...] (1)
            • Action {...}
              • start: 115
              • end: 130
              • type: "Action"
              • name: "object.func"
              • modifiers: []
              • expression: null
              }
            ]
          • children: [...] (1)
            • Text {...}
              • start: 131
              • end: 139
              • type: "Text"
              • raw: "\n Text\n"
              • data: "\n Text\n"
              }
            ]
          }
        ]
      }
    • css: undefined
    • instance: Script {...}
      • type: "Script"
      • start: 0
      • end: 108
      • context: "default"
      • content: Program {...}
        • type: "Program"
        • start: 8
        • end: 99
        • loc: {...}
          • start: {...}
            • line: 1
            • column: 0
            }
          • end: {...}
            • line: 7
            • column: 0
            }
          }
        • body: [...] (1)
          • VariableDeclaration {...}
            • type: "VariableDeclaration"
            • start: 11
            • end: 98
            • loc: {...}
              • start: {...}
                • line: 2
                • column: 2
                }
              • end: {...}
                • line: 6
                • column: 3
                }
              }
            • declarations: [...] (1)
              • VariableDeclarator {...}
                • type: "VariableDeclarator"
                • start: 15
                • end: 98
                • loc: {...}
                  • start: {...}
                    • line: 2
                    • column: 6
                    }
                  • end: {...}
                    • line: 6
                    • column: 3
                    }
                  }
                • id: Identifier {...}
                  • type: "Identifier"
                  • start: 15
                  • end: 21
                  • loc: {...}
                    • start: {...}
                      • line: 2
                      • column: 6
                      }
                    • end: {...}
                      • line: 2
                      • column: 12
                      }
                    }
                  • name: "object"
                  }
                • init: ObjectExpression {...}
                  • type: "ObjectExpression"
                  • start: 24
                  • end: 98
                  • loc: {...}
                    • start: {...}
                      • line: 2
                      • column: 15
                      }
                    • end: {...}
                      • line: 6
                      • column: 3
                      }
                    }
                  • properties: [...] (1)
                    • Property {...}
                      • type: "Property"
                      • start: 30
                      • end: 94
                      • loc: {...}
                        • start: {...}
                          • line: 3
                          • column: 4
                          }
                        • end: {...}
                          • line: 5
                          • column: 5
                          }
                        }
                      • method: false
                      • shorthand: false
                      • computed: false
                      • key: Identifier {...}
                        • type: "Identifier"
                        • start: 30
                        • end: 34
                        • loc: {...}
                          • start: {...}
                            • line: 3
                            • column: 4
                            }
                          • end: {...}
                            • line: 3
                            • column: 8
                            }
                          }
                        • name: "func"
                        }
                      • value: FunctionExpression {...}
                        • type: "FunctionExpression"
                        • start: 36
                        • end: 94
                        • loc: {...}
                          • start: {...}
                            • line: 3
                            • column: 10
                            }
                          • end: {...}
                            • line: 5
                            • column: 5
                            }
                          }
                        • id: null
                        • expression: false
                        • generator: false
                        • async: false
                        • params: [...] (1)
                          • Identifier {...}
                            • type: "Identifier"
                            • start: 45
                            • end: 49
                            • loc: {...}
                              • start: {...}
                                • line: 3
                                • column: 19
                                }
                              • end: {...}
                                • line: 3
                                • column: 23
                                }
                              }
                            • name: "node"
                            }
                          ]
                        • body: BlockStatement {...}
                          • type: "BlockStatement"
                          • start: 51
                          • end: 94
                          • loc: {...}
                            • start: {...}
                              • line: 3
                              • column: 25
                              }
                            • end: {...}
                              • line: 5
                              • column: 5
                              }
                            }
                          • body: [...] (1)
                            • ExpressionStatement {...}
                              • type: "ExpressionStatement"
                              • start: 59
                              • end: 88
                              • loc: {...}
                                • start: {...}
                                  • line: 4
                                  • column: 6
                                  }
                                • end: {...}
                                  • line: 4
                                  • column: 35
                                  }
                                }
                              • expression: CallExpression {...}
                                • type: "CallExpression"
                                • start: 59
                                • end: 88
                                • loc: {...}
                                  • start: {...}
                                    • line: 4
                                    • column: 6
                                    }
                                  • end: {...}
                                    • line: 4
                                    • column: 35
                                    }
                                  }
                                • callee: MemberExpression {...}
                                  • type: "MemberExpression"
                                  • start: 59
                                  • end: 70
                                  • loc: {...}
                                    • start: {...}
                                      • line: 4
                                      • column: 6
                                      }
                                    • end: {...}
                                      • line: 4
                                      • column: 17
                                      }
                                    }
                                  • object: Identifier {...}
                                    • type: "Identifier"
                                    • start: 59
                                    • end: 66
                                    • loc: {...}
                                      • start: {...}
                                        • line: 4
                                        • column: 6
                                        }
                                      • end: {...}
                                        • line: 4
                                        • column: 13
                                        }
                                      }
                                    • name: "console"
                                    }
                                  • property: Identifier {...}
                                    • type: "Identifier"
                                    • start: 67
                                    • end: 70
                                    • loc: {...}
                                      • start: {...}
                                        • line: 4
                                        • column: 14
                                        }
                                      • end: {...}
                                        • line: 4
                                        • column: 17
                                        }
                                      }
                                    • name: "log"
                                    }
                                  • computed: false
                                  • optional: false
                                  }
                                • arguments: [...] (1)
                                  • MemberExpression {...}
                                    • type: "MemberExpression"
                                    • start: 71
                                    • end: 87
                                    • loc: {...}
                                      • start: {...}
                                        • line: 4
                                        • column: 18
                                        }
                                      • end: {...}
                                        • line: 4
                                        • column: 34
                                        }
                                      }
                                    • object: Identifier {...}
                                      • type: "Identifier"
                                      • start: 71
                                      • end: 75
                                      • loc: {...}
                                        • start: {...}
                                          • line: 4
                                          • column: 18
                                          }
                                        • end: {...}
                                          • line: 4
                                          • column: 22
                                          }
                                        }
                                      • name: "node"
                                      }
                                    • property: Identifier {...}
                                      • type: "Identifier"
                                      • start: 76
                                      • end: 87
                                      • loc: {...}
                                        • start: {...}
                                          • line: 4
                                          • column: 23
                                          }
                                        • end: {...}
                                          • line: 4
                                          • column: 34
                                          }
                                        }
                                      • name: "textContent"
                                      }
                                    • computed: false
                                    • optional: false
                                    }
                                  ]
                                • optional: false
                                }
                              }
                            ]
                          }
                        }
                      • kind: "init"
                      }
                    ]
                  }
                }
              ]
            • kind: "let"
            }
          ]
        • sourceType: "module"
        }
      }
    • module: undefined
    }
The AST is not public API and may change at any point in time