Skip to content

Incomplete data is not supported #12

@bjoern-tantau

Description

@bjoern-tantau

When the tss is trying to read a non-existent property an uncaught TypeError is thrown.

var xml = '<h1>Foo</h1>';
var tss = 'h1 { repeat: data(headlines); content: iteration(); }';
var template = new Tranjsform.Builder(xml, tss);
template.output();

> tranjsform.js:784 Uncaught TypeError: Cannot read property 'headlines' of undefined
>     at Tranjsform.DataFunction.observe (tranjsform.js:784)
>     at Tranjsform.DataFunction.data (tranjsform.js:757)
>     at Tranjsform.Hook.parseValue (tranjsform.js:449)
>     at Tranjsform.Hook.run (tranjsform.js:418)
>     at Tranjsform.Template.processHooks (tranjsform.js:197)
>     at Tranjsform.Template.output (tranjsform.js:205)
>     at Tranjsform.Builder.output (tranjsform.js:38)
>     at <anonymous>:1:10

template.output({});

> tranjsform.js:737 Uncaught TypeError: Cannot read property '0' of undefined
>     at Tranjsform.DataFunction.bind (tranjsform.js:737)
>     at Tranjsform.Property.Repeat.run (tranjsform.js:692)
>     at Tranjsform.Hook.callProperty (tranjsform.js:425)
>     at Tranjsform.Hook.run (tranjsform.js:418)
>     at Tranjsform.Template.processHooks (tranjsform.js:197)
>     at Tranjsform.Template.output (tranjsform.js:205)
>     at Tranjsform.Builder.output (tranjsform.js:38)
>     at <anonymous>:1:10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions