3 ms·
> I'm not sure what `$name` is but `$body` is the string passed to the handler attribute in HTML. The name of the synthesized function is the attribute name it
by lifthrasiir 5y ago
> I'm not sure what `$name` is but `$body` is the string passed to the handler attribute in HTML.
The name of the synthesized function is the attribute name itself. So `<button onclick="alert(arguments.callee.name)">` will alert "onclick" on click.
- eatonphil 5y agoGood example. Thank you!
- hnbad 5y agoYeah, the paragraph immediately preceding the one giving the signature starts with "if $name is onerror" so that's clearly referencing the name of the attribute. I wonder if the name also reflects capitalization given that HTML element and attribute names are generally case insensitive.