easy - accepted / - tried
Given a DOM tree, flatten it into an one dimensional array, in the order of layer by layer, like below.
Always try to find a better approach.