Skip to content

TypeError: Cannot read property 'ownerDocument' of undefined #114

Description

@bitflower

Hi,

I'm running the form builder since 2014 in a project of a customer.

We now have updated Angular to 1.6.5 (from 1.5.9), Bootstrap to 3.3.7 (from 3.3.6) and jQuery from 2.2.4 to 3.1.1 (from 2.2.4).

After these updates we get the error mentioned.

I have done some investigations and found out that there is a connection to jQuery and Sizzle.js. In the .contains() method the ownerDocument is not set. In a long chain of calls the initial call that is causing the problem is the last line in the below block - return $(element).html(view);:

.directive('fbComponent', [ '$injector', function($injector) { var $builder, $compile, $drag; $builder = $injector.get('$builder'); $drag = $injector.get('$drag'); $compile = $injector.get('$compile'); return { restrict: 'A', scope: { component: '=fbComponent' }, controller: 'fbComponentController', link: function(scope, element) { scope.copyObjectToScope(scope.component); $drag.draggable($(element), { mode: 'mirror', defer: false, object: { componentName: scope.component.name } }); return scope.$watch('component.template', function(template) { var view; if (!template) { return; } view = $compile(template)(scope); return $(element).html(view); }); } };

What I find strange is that view object is handed over to html() instead of just the html-content (The view object contains way more properties and is not just a string of html).

I have the feeling that this is somehow related to the jQuery / jQLite update to version 3 which came with Angular 1.6.

Any ideas?

Activity

  1. johnlim commented on Jan 26, 2018

    @johnlim

    Hi @bitflower, did you ever resolve this?

  2. blinder commented on Jun 6, 2023

    @blinder

    I've just happened across this in some old code after upgrading to the latest angularjs. Anyone know of a fix. And @bitflower your observation about passing back the whole view object does strike me as a bit odd as well. Just pass back the compiled view as a string of HTML?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions