Stay organized with collections
Save and categorize content based on your preferences.
blockly > Block > getRootBlock
Block.getRootBlock() method
Return the top-most block in this block's tree. This will return itself if this block is at the top level.
Signature:
getRootBlock(): this;
Returns:
this
The root block.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-18 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-18 UTC."],[[["The `getRootBlock()` method identifies and returns the top-level block within a block's hierarchy."],["If the block calling the method is already at the top level, the method will return the block itself."],["It helps in navigating and understanding the structure of block trees in Blockly."]]],["The `Block.getRootBlock()` method identifies the highest block in a block's tree structure. If the block itself is at the top level, the method returns that block. Otherwise, it traces upwards to find and return the root, or top-most, block. The method's signature is `getRootBlock(): this;`, and its return value is \"this,\" representing the root block.\n"]]