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

JQLite.find() fails on when collection contains text nodes #4120

@hsablonniere

Description

@hsablonniere

I created a directive. I use the transclude function passed by compile to clone one element of the original DOM into my template DOM.

compile: function (cElt, cAttrs, transclude) {
  return function ($scope, lElt, lAttrs) {
    // some code
    transclude($scope, function (clone) {
      var thead = clone.find('thead');
      lElt.append(thead);
    });
    // some code
  };
}

clone is a JQLite array-like object and when you call find(tagName) on it, it calls find(tagName) on each element and group the results. The problem is that clone can contain text nodes and behind the scenes, find(tagName) uses getElementsByTagName which doesn't work on text nodes.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions