Skip to content

L.Util.template fails for templates with double quotes. #2120

@jieter

Description

@jieter

When passing a template with double quotes, creating the compiled template fails with Uncaught SyntaxError: Unexpected string

example:

L.Util.template('<img src="{href}" class="{className}" />', {
    href: 'http://leafletjs.com/docs/images/logo.png',
    className: 'thumb'
});

creates a str in compileTemplate like this:

"<img src="" + o["href"] + "" class="" + o["className"] + "" />"

Which obviously needs some escaping...

http://jsfiddle.net/jieter/dCHLt/

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