Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Error: [jqLite:nosel] when compiling cached template #6053

Closed
mozey opened this issue Jan 30, 2014 · 2 comments
Closed

Error: [jqLite:nosel] when compiling cached template #6053

mozey opened this issue Jan 30, 2014 · 2 comments

Comments

@mozey
Copy link

mozey commented Jan 30, 2014

When I try to compile a template cached with

<script type="text/ng-template" id="template.html"> 

I get the error:

Error: [jqLite:nosel] Looking up elements via selectors is not supported by jqLite!

If I remove the script tag and create a file named template.html the same code works without any errors.

Here is a plunker with the code:
http://plnkr.co/edit/AM28MtrrzxHOmxgGhiA0

@ghost ghost assigned vojtajina Jan 31, 2014
@vojtajina
Copy link
Contributor

jqLite throws when given a string that does not start with "<", it should trim the string first.

@tbosch tbosch modified the milestones: 1.2.12, 1.2.11 Feb 3, 2014
caitp added a commit to caitp/angular.js that referenced this issue Feb 4, 2014
jQuery will construct DOM nodes containing leading whitespace. Prior to this change, jqLite would
throw a nosel minErr due to the first character of the string not being '<'. This change corrects
this behaviour by trimming the element string in jqLite constructor before testing for '<'.

Closes angular#6053
@caitp
Copy link
Contributor

caitp commented Feb 4, 2014

HTML strings are being trim'd in many parts of the framework for this reason, I think these could all be factored out by this fix, with a fairly negligible perf cost (most likely).

In the mean time, it should be noted that this works as expected if you use jQuery rather than jqLite.

@caitp caitp closed this as completed in 36d37c0 Feb 5, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants