Skip to content

Commit

Permalink
Set innerText only for <= IE8
Browse files Browse the repository at this point in the history
  • Loading branch information
okcoker committed Sep 17, 2013
1 parent 3c6228b commit fa5266f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Form-ready delicious style tagging.

## History

- 1.1.3 - Set innerText only for <= IE8
- 1.1.2 - Add support for IE8 and IE9
- 1.1.1 - Fix issue in ff and opera with adding tags
- 1.1.0 - Remove useless fontSize option. Add basic API
Expand Down
15 changes: 12 additions & 3 deletions assets/js/taggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
self.placeholder.style.opacity = 0;
self.placeholder.classList.add('taggle_placeholder');
self.container.appendChild(self.placeholder);
self.placeholder.innerText = self.options.placeholder;
_setText(self.placeholder, self.options.placeholder);

if (!self.options.tags.length) {
self.placeholder.style.opacity = 1;
Expand Down Expand Up @@ -399,7 +399,7 @@
Taggle.prototype.keyupEvents = function(e) {
e = e || window.event;
var self = this;
self.sizer.innerText = self.input.value;
_setText(self.sizer, self.input.value);
};

/**
Expand Down Expand Up @@ -452,7 +452,7 @@
close.className = 'close';
close.onclick = self.remove.bind(self, close);

span.innerText = text;
_setText(span, text);
span.className = 'taggle_text';

li.className = 'taggle ' + self.options.additionalTagClasses;
Expand Down Expand Up @@ -557,6 +557,15 @@
return str.replace(/^\s+|\s+$/g, '');
}

function _setText(el, text) {
if (window.attachEvent && !window.addEventListener) { // <= IE8
el.innerText = text;
}
else {
el.textContent = text;
}
}

window.Taggle = Taggle;

}(window, document));
2 changes: 1 addition & 1 deletion assets/js/taggle.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fa5266f

Please sign in to comment.