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

v2.0.4 can't append symbol when runtime #101

Closed
pfdgithub opened this issue May 3, 2017 · 3 comments
Closed

v2.0.4 can't append symbol when runtime #101

pfdgithub opened this issue May 3, 2017 · 3 comments
Milestone

Comments

@pfdgithub
Copy link

svg-sprite-loader v0.3.1

Sprite.prototype.appendSymbol = function (content) {
  var symbol = this.wrapSVG(content, Sprite.symbolTemplate()).childNodes[0];

  this.svg.querySelector('defs').appendChild(symbol); // append symbol when runtime
  if (this.browser.name === 'firefox') {
    FirefoxSymbolBugWorkaround(this.svg);
  }
};

svg-sprite-loader v2.0.4

Sprite.prototype.add = function add (symbol) {
  var ref = this;
    var symbols = ref.symbols;
  var existing = this.find(symbol.id);

  if (existing) {
    symbols[symbols.indexOf(existing)] = symbol;
    return symbol;
  }

  symbols.push(symbol);

  // fix start
  if(ref.isMounted){
    // ref.node.appendChild(parse(symbol.content)); // it's not work. why?
    ref.node.insertAdjacentHTML('beforeend', symbol.content); // it's work
  }
  // fix end

  return symbol;
};
@kisenka
Copy link
Contributor

kisenka commented May 5, 2017

@pfdgithub which browser is used?

@pfdgithub
Copy link
Author

@kisenka chrome 55

@kisenka kisenka modified the milestone: 2.1 May 11, 2017
@kisenka
Copy link
Contributor

kisenka commented May 13, 2017

Fixed in [email protected]

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

No branches or pull requests

2 participants