angular.js icon indicating copy to clipboard operation
angular.js copied to clipboard

IE8 oddness with nested directives & transclude

Open leefernandes opened this issue 14 years ago • 19 comments

Here's an issue we've been chasing down in IE8. In some circumstances we have directive templates, which contain other directives, and they all incorporate their own transclude content. This is very powerful, and working great in Chrome, and IE9. But in IE8 it seems like the nested transclude content is not being transcluded at all.

http://jsfiddle.net/ItsLeeOwen/pSPeV/

leefernandes avatar Sep 19 '12 23:09 leefernandes

Hi, We are experiencing a similar issue - here's our fiddle that isolates it - it throws an error in ie8:

http://jsfiddle.net/edeustace/LAgTR

edeustace avatar Oct 03 '12 13:10 edeustace

@ItsLeeOwen I'm hunting down a similar issue, but FYI your fiddle does work for me in IE8. Did you do anything to fix it?

sbeam avatar Oct 29 '12 02:10 sbeam

@ItsLeeOwen @sbeam did you happen to find a good workaround for this problem? It's still a big issue for us.

evaneus avatar Nov 07 '12 16:11 evaneus

Unfortunately not, we've had to consider this not possible with angular projects that require IE8 support. On Nov 7, 2012 8:48 AM, "evaneus" [email protected] wrote:

@ItsLeeOwen https://github.com/ItsLeeOwen @sbeamhttps://github.com/sbeamdid you happen to find a good workaround for this problem? It's still a big issue for us.

— Reply to this email directly or view it on GitHubhttps://github.com/angular/angular.js/issues/1392#issuecomment-10155366.

leefernandes avatar Nov 07 '12 17:11 leefernandes

To workaround this issue - We are going to look at using attributes instead of node names. Here's a gist: https://gist.github.com/e4ec72f6ff5ea6f98759

edeustace avatar Nov 07 '12 19:11 edeustace

I had the following structure (directive1 has transclude=true, replace=true):

<directive1>
  <directive1>
    <form>
      <fieldset>
         <input />
      </fieldset>
    </form>
  </directive1>
<directive1>

It fails in IE8 as discussed above.

If I use inner directive1 as an attribute, then it shows content, but this time I see inner directive1 displayed twice - one with the content and another one just empty.

If I move form element outside of inner directive1 then it works in all browsers (ie8, FF, Chrome):

<directive1>
    <form>
      <fieldset>
  <directive1>
         <input />
  </directive1>
      </fieldset>
    </form>
<directive1>

mp31415 avatar Dec 03 '12 21:12 mp31415

Has anyone patched the angular directives code with a fix for this?

leefernandes avatar Feb 07 '13 03:02 leefernandes

Hi ItsLeeOwen.. as edeustace was mentioning... we worked around it by matching directives on attributes/classes instead of element name.

evaneus avatar Feb 07 '13 04:02 evaneus

Thanks for your reply evaneus, jsfiddle's new version isn't working in IE8 so I can't test quickly, but are you saying that by using an attribute directive instead of element directive, it works?

leefernandes avatar Feb 07 '13 06:02 leefernandes

Yes, using restrict: "A" instead of "E" does seem to work in IE8. Thanks guys x39! :D

leefernandes avatar Feb 07 '13 06:02 leefernandes

I also ran into this issue. Using restrict: "A" instead of "E" works in IE8. Would be nice to be able to use the element version and not have to modify all my existing directives in this big project.

BrianLenzo avatar May 20 '13 19:05 BrianLenzo

We are also experiencing this issue. Please look into fixing this, as it's been open for 10 months now.

rpoconn avatar Jul 30 '13 22:07 rpoconn

yes - I am following this bug as well

beninfobelt avatar Oct 02 '13 15:10 beninfobelt

Also note that you don't have to do just restrict: 'A' you can use restrict: 'EA' and then you can use the element form of the directive when not nesting, and the attribute form of the directive when nesting.

boushley avatar Oct 08 '13 15:10 boushley

This definitely needs to be fixed. Refactoring the application to use attribute directives instead of element directives is not a good workaround for the problem.

mb666 avatar Oct 22 '13 22:10 mb666

Is this an Angular issue or an IE8 issue? (I'm asking to see if it's something the community--including me--could investigate a fix for?) Anyone know off hand?

ebrentnelson avatar Nov 09 '13 00:11 ebrentnelson

Closing this issue since 1.3 is not supporting IE8. If there's a non-hacky way to fix this issue, a PR would likely be accepted.

jeffbcross avatar Mar 17 '14 22:03 jeffbcross

document.createElement('custom'); doesn't seem to do anything for custom elements nested inside of other custom elements.

kevinbeal avatar Nov 18 '14 21:11 kevinbeal

IE8 is no longer supported, and Microsoft (and everyone else) would absolutely love it if people were encouraged to upgrade rather than struggle to make things work in a very quirky browser

caitp avatar Nov 18 '14 21:11 caitp