在Aurelia repeat.for中指定时,SVG路径不起作用

时间:2016-04-01 20:06:40

标签: javascript svg internet-explorer-11 aurelia

我在Aurelia应用程序中使用美国的SVG地图。我希望能够遍历状态列表并在repeat.for中设置路径。这在Chrome和Firefox中运行得很好,但在IE11中失败却出现错误:

SVG4601:SVG路径数据格式不正确,无法完全解析。

我在Plunker中设置了一个示例:

http://plnkr.co/edit/UpxgfS?p=preview

<template>
    <div class="map">
        <svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://web.resource.org/cc/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
        xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 959 593" preserveAspectRatio="xMidYMid slice"
        id="us-map">
            <g>
                <path repeat.for="state of states" id="${state.name}" d="${state.path}"></path>
            </g>
        </svg>
    </div>
</template>

似乎Aurelia甚至没有试图绑定&#34; d&#34; IE11中的财产。

任何和所有帮助表示赞赏!

1 个答案:

答案 0 :(得分:1)

使用d.bind="state.path"

http://plnkr.co/edit/OVIe2dKxTKrDPDEmIU2a?p=preview

Internet Explorer严格禁止d属性中允许的内容 - ${...}不允许:

error

注意错误,IE解析HTML后d属性为空^^^。

当Aurelia编译模板时,IE的html解析逻辑已清除d属性。