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

fix(IE8+JQuery): "Object doesn't support this property or method" on route change #1876

Closed
jonbcard opened this issue Jan 24, 2013 · 7 comments
Assignees

Comments

@jonbcard
Copy link
Contributor

Not sure of the detailed route cause on this one yet, but Angular 1.1.2 seems to have a regression around the $routeChangeSuccess event when used on IE8 w/ JQuery . While the update() method is running, it bombs out while calling

element.contents().data('$ngControllerController', controller);

JSFiddle showing the issue:
http://jsfiddle.net/HsQRN/6/
Note that the new route doesn't load correctly, and that there is a console error. Works fine with 1.0.4, or without JQuery.

Edit: Updated the JSFiddle

@kloy
Copy link

kloy commented Jan 29, 2013

I am seeing this issue on Angular 1.0.4 as well. Issue does not exist in 1.0.3.

@ghost ghost assigned btford Jan 29, 2013
@IgorMinar
Copy link
Contributor

sounds like we need to use element.children().... instead of element.contents()...

@jonbcard
Copy link
Contributor Author

@kloy : Oops! You're totally right -- 1.0.4 is broken too. I guess I only tested that it was working in 1.0.2 and 1.0.3. Thanks for setting that straight.

@IgorMinar : Yup! You are right switching to children() there helps -- its no longer trying to do the setData on the text node -- but then just a few lines later during the link() it tries to do it again and dies due to change in 49f9e4c

@jafp
Copy link

jafp commented Jan 31, 2013

Are you guys working on a fix? Or can you maybe provide me with a hint, so I could try making a patch myself.

@jonbcard
Copy link
Contributor Author

@jafp If you need a temporary fix for it you can remove the line added in 49f9e4c but then of course you are re-introducing the transclusion issue it was meant to fix. That's what I'm doing.

I assume that this will probably be fixed by on of the following methods:

  1. Pick through all the places that data() is being used and make sure it is being done appropriately (ie. not trying to assign to text nodes now that wrapper spans are not being written). I'm run into two now, and I'm sure there are more.
  2. Drop in another JQLitePatchJQuery for data() to make these calls less error sensitive if the node handle has bad nodes? This one might be weird, and I honestly haven't looked at the JQLite code to see how its handling the call.
  3. Revert 49f9e4c and fix Wrapping root text elements of $compile in span causes issues #1059 some other sneaky way. Still means the DOM is getting polluted with extra markup it doesn't need, though.

Personally I didn't dare mess with a PR on this one myself since it could be a little bit sticky given the potential for further regressions.

petebacondarwin added a commit to petebacondarwin/angular.js that referenced this issue Feb 18, 2013
…ext nodes

The change to prevent <span> elements being wrapped around empty text nodes caused these empty text nodes to have scopes and controllers attached, through jqLite.data() calls, which led to memory leaks and errors in IE8.
Now we exclude all but document nodes and elements from having jqLite.data() set both in the compiler and in ng-view.

Fixes: angular#1968 and angular#1876
petebacondarwin added a commit that referenced this issue Feb 18, 2013
…ext nodes

The change to prevent <span> elements being wrapped around empty text nodes caused these empty text nodes to have scopes and controllers attached, through jqLite.data() calls, which led to memory leaks and errors in IE8.
Now we exclude all but document nodes and elements from having jqLite.data() set both in the compiler and in ng-view.

Fixes: #1968 and #1876
@petebacondarwin
Copy link
Contributor

Fixed in 791804b

@rwhitmire
Copy link

I think the issue Pete fixed has returned. I get the TypeError message in IE8 when using templates. Replacing all instances of .contents() with .children() in the debug file fixed the problem.

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

7 participants