Skip to content

JS HTML debugging doesn't pickup breakpoint on function def lines #3727

@th3coop

Description

@th3coop

Steps to Reproduce

If you have an event handler that is only one line the debugger won't pickup breakpoints set on it. See examples below and not the // a breakpoint set here... comments.

Does NOT Work

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <script>
        var clicker = () => {console.log("buyrger");document.getElementById("blah").innerHTML = "blaher";repeat();}; // a break point here is not detect and debugger does not stop
        var repeat = () => {console.log("yeah this does nothing.");};
    </script>
</head>
<body>
<button onclick="clicker();">click me</button>
<p id="blah"></p>
</body>
</html>

Works

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <script>
        var clicker = () => {
            console.log("burger"); // a breakpoint here is detected and debugger stops
            document.getElementById("blah").innerHTML = "blaher";
            repeat();
        };
        var repeat = () => console.log("yeah this does nothing.");
    </script>
</head>
<body>
<button onclick="clicker();">click me</button>
<p id="blah"></p>
</body>
</html>

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions