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

Wrapping root text elements of $compile in span causes issues #1059

Closed
mhevery opened this issue Jun 15, 2012 · 3 comments
Closed

Wrapping root text elements of $compile in span causes issues #1059

mhevery opened this issue Jun 15, 2012 · 3 comments

Comments

@mhevery
Copy link
Contributor

mhevery commented Jun 15, 2012

$compile wraps root text elements in span's so that it can attach data elements. This cause issues with transclusion since it can add int

@cristatus
Copy link

At least empty nodes should be ignored.

if (node.nodeType == 3 /* text node */ && node.childNodes.length /* non-empty */) {
  $compileNode[index] = jqLite(node).wrap('<span>').parent()[0];
}

@boneskull
Copy link
Contributor

I'm having this issue as well. This code fixes the problem. Thanks!

@woeye
Copy link

woeye commented Jan 8, 2013

Yeah, transcluding a more complex body of an element (and not just some hello world stuff) results currently in a huge bloat of empty spans. If you care about your markup (and you should) this issue is really a no go.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants