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

ts_ce fails on IE 9 #1

Closed
jamesarosen opened this issue May 11, 2011 · 3 comments
Closed

ts_ce fails on IE 9 #1

jamesarosen opened this issue May 11, 2011 · 3 comments

Comments

@jamesarosen
Copy link
Contributor

The problem is that ts_ce is checking for name && window.ActiveXObject as a way of checking for IE, but only IE < 9 supports creating elements with the whole HTML fragment. IE 9 behaves like the other browsers and should use the else branch. See also http://stackoverflow.com/questions/5344029/invalid-character-dom-exception-in-ie9

@jamesarosen
Copy link
Contributor Author

The following seems to work on IE9:

function ts_ce(tag, name) {
  var element;
  try {
    element = document.createElement('<'+tag+' name="'+name+'">');
  } catch(e) {
    element = document.createElement(tag);
    element.setAttribute('name',name);
  }
  return element;
}

@KeeperPat
Copy link
Owner

Submit a pull request and I'll merge it in.

@KeeperPat
Copy link
Owner

Merged in your change:

64b98ea

See the comment on that commit for a suggestion regarding readability.

Also, I see you forked the project. I'd suggest maintaining that going forward. I'm not the original author of this project, I just put it into github for easy access on a project I did a few years ago.

I no longer use this plugin.

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