Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

svgIcon with bound expression in contents fails for IE 11 #6093

Closed
isaacplmann opened this issue Jul 27, 2017 · 2 comments · Fixed by #6102
Closed

svgIcon with bound expression in contents fails for IE 11 #6093

isaacplmann opened this issue Jul 27, 2017 · 2 comments · Fixed by #6102
Assignees
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@isaacplmann
Copy link

Bug, feature request, or proposal:

<md-icon [svgIcon]="myIcon">{{myIcon}}</md-icon>

This fails in IE 11 if the md-icon component is hidden and shown. Removing {{myIcon}} from the template avoids the error.

What is the expected behavior?

No error is shown in the console. The icon is not duplicated.

What is the current behavior?

An error appears in the console and the icon is duplicated.

Error from the console
ERROR Error: Invalid argument.
   "ERROR"
   {
      [functions]: ,
      __proto__: { },
      description: "Invalid argument.",
      message: "Invalid argument.",
      name: "Error",
      ngDebugContext: { },
      number: -2147024809,
      stack: "Error: Invalid argument.
   at DefaultDomRenderer2.prototype.setValue (eval code:2940:71)
   at BaseAnimationRenderer.prototype.setValue (eval code:513:73)
   at DebugRenderer2.prototype.setValue (eval code:13793:66)
   at checkAndUpdateTextInline (eval code:11867:9)
   at checkAndUpdateNodeInline (eval code:12358:13)
   at checkAndUpdateNode (eval code:12301:9)
   at debugCheckAndUpdateNode (eval code:13162:5)
   at debugCheckRenderNodeFn (eval code:13141:13)
   at Anonymous function (Function code:17:5)
   at debugUpdateRenderer (eval code:13126:5)
   at checkAndUpdateView (eval code:12273:5)
   at callViewAction (eval code:12633:21)
   at execEmbeddedViewsAction (eval code:12591:17)
   at checkAndUpdateView (eval code:12269:5)
   at callViewAction (eval code:12633:21)",
      Symbol(rxSubscriber)_m.ix4mqv1tfg5: undefined
   }

What are the steps to reproduce?

http://plnkr.co/edit/IxGqqudBSwWHompYGZtD?p=preview

  1. Browse to plunker using IE 11.
  2. Open console in developer tools
  3. Toggle slider off
  4. Toggle slider on

What is the use-case or motivation for changing an existing behavior?

I wanted to fall back to having the name of the icon appear on the screen if the svg doesn't load over the network. This works great in other browsers, but fails for IE 11.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular 4.3.1, Material 2.0.0-beta.8, IE 11

Is there anything else we should know?

The error happens in DefaultDomRenderer2:

node.nodeValue = value

Because you're setting innerHtml here as a workaround for this issue

...which runs straight into the situation discussed here. Namely, setting innerHtml on a parent node and then trying to update the nodeValue of a removed node fails silently in modern browsers, but IE 11 throws an error.

@isaacplmann isaacplmann changed the title svgIcon with bound expression in svgIcon with bound expression in contents fails for IE 11 Jul 27, 2017
@jelbourn jelbourn added the P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent label Jul 27, 2017
crisbeto added a commit to crisbeto/material2 that referenced this issue Jul 28, 2017
* Fixes an error that was being logged by IE11 for icons that are toggled via `ngIf` and have a binding expression.
* Some minor readability improvements in the icon component.

Fixes angular#6093.
crisbeto added a commit to crisbeto/material2 that referenced this issue Jul 29, 2017
* Fixes an error that was being logged by IE11 for icons that are toggled via `ngIf` and have a binding expression.
* Some minor readability improvements in the icon component.

Fixes angular#6093.
crisbeto added a commit to crisbeto/material2 that referenced this issue Aug 1, 2017
* Fixes an error that was being logged by IE11 for icons that are toggled via `ngIf` and have a binding expression.
* Some minor readability improvements in the icon component.

Fixes angular#6093.
tinayuangao pushed a commit that referenced this issue Aug 2, 2017
* Fixes an error that was being logged by IE11 for icons that are toggled via `ngIf` and have a binding expression.
* Some minor readability improvements in the icon component.

Fixes #6093.
tinayuangao pushed a commit that referenced this issue Aug 2, 2017
* fix(icon): error when toggling icon with binding in IE11

* Fixes an error that was being logged by IE11 for icons that are toggled via `ngIf` and have a binding expression.
* Some minor readability improvements in the icon component.

Fixes #6093.

* fix: address feedback
@isaacplmann
Copy link
Author

isaacplmann commented Aug 3, 2017 via email

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants