diff --git a/README.md b/README.md index 58a42c8fd..5b2162ca7 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,7 @@ NodeJS >= 18.x and js-controller >= 5 is required * (klein0r) Added missing functions to protectFS * (klein0r) Fixed httpPost (missing data) +* (klein0r) Fixed hasAttribute blockly block ### 7.11.1 (2024-03-28) diff --git a/src/public/google-blockly/own/blocks_object.js b/src/public/google-blockly/own/blocks_object.js index 6009c18ed..8f00dd1d1 100644 --- a/src/public/google-blockly/own/blocks_object.js +++ b/src/public/google-blockly/own/blocks_object.js @@ -356,9 +356,9 @@ Blockly.Blocks['object_has_attr'] = { Blockly.JavaScript['object_has_attr'] = function(block) { const obj = Blockly.JavaScript.valueToCode(block, 'OBJECT', Blockly.JavaScript.ORDER_ATOMIC); - const attr = Blockly.JavaScript.valueToCode(block, 'ATTR', Blockly.JavaScript.ORDER_ATOMIC); + const attr = block.getFieldValue('ATTR'); - return [`Object.prototype.hasOwnProperty.call(${obj}, ${attr})`, Blockly.JavaScript.ORDER_ATOMIC]; + return [`Object.prototype.hasOwnProperty.call(${obj}, '${attr}')`, Blockly.JavaScript.ORDER_ATOMIC]; }; // --- object keys --------------------------------------------------