aboutsummaryrefslogtreecommitdiffstats
path: root/src/jqLite.js
diff options
context:
space:
mode:
authorMisko Hevery2012-03-15 22:18:06 -0700
committerMisko Hevery2012-03-19 11:35:10 -0700
commit9918b748be01266eb10db39d51b4d3098d54ab66 (patch)
tree41b9b46a1ac03bff7ec7e5d8027dd255e0c55ecc /src/jqLite.js
parent6ecac8e71a84792a434d21db2c245b3648c55f18 (diff)
downloadangular.js-9918b748be01266eb10db39d51b4d3098d54ab66.tar.bz2
fix(compiler): allow transclusion of root elements
Fixed an issue where a directive that uses transclusion (such as ngRepeat) failed to link if it was declared on the root element of the compilation tree. (For example ngView or ngInclude including template where ngRepeat was the top most element).
Diffstat (limited to 'src/jqLite.js')
-rw-r--r--src/jqLite.js19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/jqLite.js b/src/jqLite.js
index 2dd1aeb7..986d0002 100644
--- a/src/jqLite.js
+++ b/src/jqLite.js
@@ -168,17 +168,18 @@ function JQLitePatchJQueryRemove(name, dispatchThis) {
}
/////////////////////////////////////////////
-function jqLiteWrap(element) {
- if (isString(element) && element.charAt(0) != '<') {
- throw new Error('selectors not implemented');
- }
- return new JQLite(element);
-}
-
function JQLite(element) {
if (element instanceof JQLite) {
return element;
- } else if (isString(element)) {
+ }
+ if (!(this instanceof JQLite)) {
+ if (isString(element) && element.charAt(0) != '<') {
+ throw Error('selectors not implemented');
+ }
+ return new JQLite(element);
+ }
+
+ if (isString(element)) {
var div = document.createElement('div');
// Read about the NoScope elements here:
// http://msdn.microsoft.com/en-us/library/ms533897(VS.85).aspx
@@ -299,7 +300,7 @@ var JQLitePrototype = JQLite.prototype = {
this.bind('DOMContentLoaded', trigger); // works for modern browsers and IE9
// we can not use jqLite since we are not done loading and jQuery could be loaded later.
- jqLiteWrap(window).bind('load', trigger); // fallback to window.onload for others
+ JQLite(window).bind('load', trigger); // fallback to window.onload for others
},
toString: function() {
var value = [];