Skip to content

Unable to get templateId if there is no space after the id #2

@nodesiremonk

Description

@nodesiremonk

In line 251 of point.js, it tries to get the templateId after loading external html template.

templateId = tpl.split('point-component=')[1].replace(/\'|\"/gm, '').split(' ')[0];

However, the code does not work properly if there is no space after the point-component id, for example,

<ol>
    <li point-component="tasks">{{text}}</li>
</ol>

To get the id ("tasks") correctly, the code expects a space after the "tasks", so in order to make it work, you have to add a space before the > like <li point-component="tasks" >{{text}}</li>

So it might be better to split the > sign first before doing that for space, such as:
templateId = tpl.split('point-component=')[1].replace(/\'|\"/gm, '').split('>')[0].split(' ')[0];

In that way, it should handle both with space (<li point-component="tasks" class="someClass">{{text}}</li>) and no space (<li point-component="tasks">{{text}}</li>) case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions