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

jQuery / jQuery lite conflict? #877

Closed
idosela opened this issue Apr 12, 2012 · 4 comments
Closed

jQuery / jQuery lite conflict? #877

idosela opened this issue Apr 12, 2012 · 4 comments

Comments

@idosela
Copy link

idosela commented Apr 12, 2012

When trying to load jQuery before Angular 1.0.0rc5 it seems jQuery is ignored, which result in an exception.

To recreate, please run the following with the console open:
http://jsfiddle.net/Lc7SB/

@mhevery
Copy link
Contributor

mhevery commented Apr 13, 2012

The stack trace I got is:

TypeError: Object #<HTMLDocument> has no method 'setAttribute'
    at http://code.jquery.com/jquery-1.6.4.js:2290:10
    at Function.access (http://code.jquery.com/jquery-1.6.4.js:842:5)
    at [object Object].attr (http://code.jquery.com/jquery-1.6.4.js:1957:17)
    at new TestCtrl (http://fiddle.jshell.net/_display/:25:12)
    at invoke (http://code.angularjs.org/angular-1.0.0rc5.js:2670:28)
    at Object.instantiate (http://code.angularjs.org/angular-1.0.0rc5.js:2680:23)
    at http://code.angularjs.org/angular-1.0.0rc5.js:4352:24
    at http://code.angularjs.org/angular-1.0.0rc5.js:3984:17
    at forEach (http://code.angularjs.org/angular-1.0.0rc5.js:121:20)
    at compositeLinkFn (http://code.angularjs.org/angular-1.0.0rc5.js:3963:11)

Which clearly shows that we are using jQuery

Your tests is strange since

$(window.document).attr('title', 'Hello World!');

produces the same error

TypeError: Object #<HTMLDocument> has no method 'setAttribute'

That is because the document has no attributes, only elements have attributes.

I think you want :

$document.find('title').attr('title', 'Hello World!');

Closing until I have reproducible test case.

@mhevery mhevery closed this as completed Apr 13, 2012
@idosela
Copy link
Author

idosela commented Apr 13, 2012

If you switch angular to 1.0.0rc4 it works.
It also works with pure jQuery.

It seems like an angular rc5 issue to me.

@mhevery mhevery reopened this Apr 13, 2012
@mhevery
Copy link
Contributor

mhevery commented Apr 13, 2012

Long long time ego we hacked document

document.getAttribute = function(){}

not sure why. This hack confuses jQuery. In latest RC5, we changed the way in which we worked with document, which exposed this bug.

will remove the patch...

@idosela
Copy link
Author

idosela commented Apr 13, 2012

Got it. Thanks Misko!

IgorMinar pushed a commit to IgorMinar/angular.js that referenced this issue Apr 20, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants