fastmail / overture

Overture is a powerful JS library for building really slick web applications, with performance at, or surpassing, native apps.
MIT License
725 stars 25 forks source link

Nested SwitchViews can place their contents out of order #24

Closed chris-morgan closed 7 years ago

chris-morgan commented 7 years ago

Minimal test case:

<!DOCTYPE html>
<body>
<script src=Overture-raw.js></script>
<script>
O.RunLoop.invoke( function () {
    var root = new O.RootView(document);  // v0
    root.insertView( new O.View({  // v1
        layerTag: 'div',
        id: 'foo',
        childViews: [
            new O.SwitchView({ views: [[  // v5
                new O.SwitchView({ views: [  // v3
                    new O.LabelView({ value: 'A' })  // v2
                ] }),
                new O.LabelView({ value: 'B' })  // v4
            ]] })
        ],
    }) );
});
</script>

Expected output: AB

Expected HTML output (simplified):

<div id="v6">
    <!--SwitchView v5-->
    <!--SwitchView v3-->
    <span id="v2">A</span>
    <span id="v4">B</span>
</div>

Actual output: BA

Actual HTML output (simplified):

<div id="v6">
    <!--SwitchView v5-->
    <!--SwitchView v3-->
    <span id="v4">B</span>
    <span id="v2">A</span>
</div>