(contextsList)
| 5 | * @returns {Object} A representation of a stacking context adapted for the devtools scripts. |
| 6 | */ |
| 7 | export function generateContextTree(contextsList) { |
| 8 | let root = contextsList[0]; |
| 9 | |
| 10 | function linkChildren(context) { |
| 11 | // Get a context from its id (since the ids start from 0, the id is also its index inside the array) |
| 12 | context.children = context.children.map( (child) => contextsList[child] ); |
| 13 | for (let child of context.children) { |
| 14 | child.parent = context; |
| 15 | linkChildren(child); |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | linkChildren(root); |
| 20 | |
| 21 | return root; |
| 22 | } |
| 23 | |
| 24 | export function isValuableContainer(container) { |
| 25 | // Check if has children |
no test coverage detected