Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Bug fixes for IE9 beta.
Browse files Browse the repository at this point in the history
  • Loading branch information
cheeaun committed Oct 24, 2010
1 parent fd18940 commit e6aa788
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Source/MooEditable/MooEditable.Group.js
Expand Up @@ -62,7 +62,7 @@ MooEditable.Group.Item = new Class({
this.parent(textarea, options);
this.addEvent('attach', function(){
var focus = function(){
self.group.activeEditor = self;
if (this == self.win) self.group.activeEditor = self;
};
self.textarea.addEvent('focus', focus);
self.win.addEvent('focus', focus);
Expand Down
26 changes: 22 additions & 4 deletions Source/MooEditable/MooEditable.js
Expand Up @@ -264,6 +264,10 @@ this.MooEditable = new Class({
if (Browser.firefox2) this.doc.addEvent('focus', function(){
self.win.fireEvent('focus').focus();
});
// IE9 is also not firing focus event
this.doc.addEventListener('focus', function(){
self.win.fireEvent('focus');
}, true);

// styleWithCSS, not supported in IE and Opera
if (!Browser.ie && !Browser.opera){
Expand Down Expand Up @@ -942,7 +946,7 @@ MooEditable.Selection = new Class({
getNode: function(){
var r = this.getRange();

if (!Browser.ie){
if (!Browser.ie || Browser.version >= 9){
var el = null;

if (r){
Expand All @@ -967,9 +971,23 @@ MooEditable.Selection = new Class({
insertContent: function(content){
if (Browser.ie){
var r = this.getRange();
r.pasteHTML(content);
r.collapse(false);
r.select();
if (r.pasteHTML){
r.pasteHTML(content);
r.collapse(false);
r.select();
} else if (r.insertNode){
r.deleteContents();
if (r.createContextualFragment){
r.insertNode(r.createContextualFragment(content));
} else {
var doc = this.win.document;
var fragment = doc.createDocumentFragment();
var temp = doc.createElement('div');
fragment.appendChild(temp);
temp.outerHTML = content;
r.insertNode(fragment);
}
}
} else {
this.win.document.execCommand('insertHTML', false, content);
}
Expand Down

0 comments on commit e6aa788

Please sign in to comment.