-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Uncaught ReferenceError: Node is not defined #13442
Comments
Please provide more context information; stacktrace, minimal demo etc. |
This happens on specific d3 charts. Will try to create an example, but it works with 1.4.7 version. I see that there were some changes on jqlite. Probably that is the reason. I am using jquery, did how to use jquery + angularjs changed? |
It's happening after Bumping angular to be specifically 1.4.7 fixes the issue. |
Ah, I see it's a change that has been made to jqlite which relies on Node. I'm not sure how that's fixable for server use of angular. |
Actually, how exactly do you use Angular with require? In the browser or on the server? |
@Narretz I inherited this flow, and I haven't dove too deep/know if its best practice, but we We take several client JS libraries through |
I am getting the same exception with the mocha tests after upgrading to angular 1.4.8 var jqLiteContains = Node.prototype.contains || function(arg) { |
@gkalpak ping because you committed the change that causes this. Do you think this is something we should account for? |
Did I ? Let me take a closer look :) |
I don't think I was involved with 941c1c3, which introduced this, but I think it is worth solving anyway... |
@gkalpak Ah, sorry. But thanks for fixing it ;) |
@neha-nsharma: can you explain / show your setup? For example, Are you using a module loader or jsdom? |
I am using jsdom (0.11.1 version); I have the issue running my mocha tests. I was able to make it work by setting Node = window.Node; in the mocha config. Thank you,
|
If you are using jsdom, it's your responsibility to provide the correct context. So I'd say this is not fixable in angular. |
@neha-nesharma, does it mean that changing |
That is correct. This change will work. Thank you
|
@mgol is going to look into whether doing this comprehensively is feasible without too much work. |
When I change to I'm using IE8 and trying to get angular running there. |
@simkessy - Versions of Angular after 1.2 do not support IE8 |
@petebacondarwin - thanks for the response. I've begun reverting back to 1.2 (unfortunately) |
I am getting this issue in angular 1.5.3 version. How to fix this? Using jquery and d3. |
@mato75, you need to make sure |
Ok, thank you, but why is not the fix included with new versions of Angular library? |
@mato75, this doesn't break any of the "officially" supported browsers (and so far there hasn't been any report of an issue that couldn't be solved on the developer's side). But we are investigating if/how we can fix this and other similar issues, so it is easier for people running their code/tests in other environments (e.g. jsdom). This is not a high priority though, so don't expect a quick turnaround. |
@mato75 see #13442 (comment) |
PR: #14345 |
@gkalpak changing Node.prototype to window.Node.prototype doesnt solve this issue. Angular 1.5.7 + jquery 2.1.3 + Latest Chrome. |
@mato75 If window.Node.prototype doesn't exist for you in Chrome then something must be really weird with your setup. We'd have to see a reproducible example, we can't do anything here if we don't see the code. |
Ah I see. It is a problem when using angularjs library in web worker. |
That explains the problem. Angular 1 is not supported in Web Workers. What are you trying to do with Angular there? Since Web Workers don't have access to the DOM, most of the Angular functionality (directives/components, events, data binding etc.) disappears. |
angular.js:2789 Uncaught ReferenceError: Node is not defined
Updated from 1.4.7 to 1.4.8
The text was updated successfully, but these errors were encountered: