From d0dc64ce7660fde1ed0a40eec0f6dfccbedeaa96 Mon Sep 17 00:00:00 2001 From: "Evan W. Patton" Date: Sat, 1 Oct 2016 03:16:10 -0400 Subject: [PATCH] Fix broken (and unnecessary) try block in blockly.js --- core/blockly.js | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/core/blockly.js b/core/blockly.js index 3ec37d56a..010ef3401 100644 --- a/core/blockly.js +++ b/core/blockly.js @@ -269,25 +269,23 @@ Blockly.onKeyDown_ = function(e) { Blockly.hideChaff(); } else if (e.keyCode == 8 || e.keyCode == 46) { // Delete or backspace. - try { - // Stop the browser from going back to the previous page. - // Do this first to prevent an error in the delete code from resulting in - // data loss. - e.preventDefault(); - if (Blockly.selected && Blockly.selected.isDeletable()) { - var descendantCount = Blockly.selected.getDescendants().length; - if (Blockly.selected.nextConnection && Blockly.selected.nextConnection.targetConnection) { - descendantCount -= Blockly.selected.nextConnection.targetBlock(). - getDescendants().length; - } - // Ask for confirmation before deleting 3 or more blocks - if (descendantCount >= 3) { - if (confirm("Are you sure you want to delete all " + descendantCount + " of these blocks?")) { - deleteBlock = true; - } - } else { + // Stop the browser from going back to the previous page. + // Do this first to prevent an error in the delete code from resulting in + // data loss. + e.preventDefault(); + if (Blockly.selected && Blockly.selected.isDeletable()) { + var descendantCount = Blockly.selected.getDescendants().length; + if (Blockly.selected.nextConnection && Blockly.selected.nextConnection.targetConnection) { + descendantCount -= Blockly.selected.nextConnection.targetBlock(). + getDescendants().length; + } + // Ask for confirmation before deleting 3 or more blocks + if (descendantCount >= 3) { + if (confirm("Are you sure you want to delete all " + descendantCount + " of these blocks?")) { deleteBlock = true; } + } else { + deleteBlock = true; } } } else if (e.altKey || e.ctrlKey || e.metaKey) {