diff --git a/src/jqLite.js b/src/jqLite.js index e59805147886..304312b2a48b 100644 --- a/src/jqLite.js +++ b/src/jqLite.js @@ -176,7 +176,7 @@ function JQLite(element) { return element; } if (!(this instanceof JQLite)) { - if (isString(element) && element.charAt(0) != '<') { + if (isString(element) && (element = trim(element)).charAt(0) != '<') { throw jqLiteMinErr('nosel', 'Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element'); } return new JQLite(element); diff --git a/test/jqLiteSpec.js b/test/jqLiteSpec.js index 931f9b2e5cb3..a98e94b93e6e 100644 --- a/test/jqLiteSpec.js +++ b/test/jqLiteSpec.js @@ -65,6 +65,17 @@ describe('jqLite', function() { }); + it('should allow construction of html with leading whitespace', function() { + var nodes = jqLite(' \n\r \r\n