aurelia / framework

The Aurelia 1 framework entry point, bringing together all the required sub-modules of Aurelia.
MIT License
11.75k stars 623 forks source link

aurelia.enhance parses entire dom body #765

Closed doubleaa93 closed 7 years ago

doubleaa93 commented 7 years ago

I'm submitting a bug report

Please tell us about your environment:

I'm using Aurelia to enhance an element on an existing page using aurelia.enhance which works fine but, aurelia parses the entire dom body and this page contains jquery templates like this

<script id="template-name" type="text/x-jquery-tmpl">
<div>A property ${myProperty}</div>
</script>

EDIT I'm passing an element to aurelia.enhance aurelia.enhance(document.querySelector('my-component')

When the page loads aurelia has remove all the${} inside the jquery templates making the existing application not work correctly.

Can I prevent aurelia from parsing the entire body, but to do starting from a certain dom element.

gheoan commented 7 years ago

Pass an Element as the second argument to aurelia.enhance to limit the enhancement. See http://aurelia.io/hub.html#/doc/article/aurelia/framework/latest/app-configuration-and-startup/8.

AshleyGrant commented 7 years ago

@EisenbergEffect this may be closed.

doubleaa93 commented 7 years ago

@Gheoan Sorry forgot to mention I am passing an element and the same problem applies aurelia.enhance(document.querySelector('my-component')

In html

<body aurelia-app="main">
....
<div>
<my-component></my-component>
</div>
gheoan commented 7 years ago

@doubleaa93, the aurelia-app attribute on the body element is not needed if you are using enhance.