Skip to content

Commit

Permalink
Fixed commenting on Facebook
Browse files Browse the repository at this point in the history
Fixed a regression in f87e7d0 that causes comments to be mangled as they are added on Facebook. Use deleteData() / insertData() instead of replaceData(). For some reason Facebook fails to react to the latter through its mutation observers. This change shouldn’t affect performance much because it’s still limited to just the one word.

Fixes #105.
  • Loading branch information
1ec5 committed Nov 27, 2014
1 parent 972f052 commit 0f3bad9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions content/frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,15 +263,18 @@ function SpliceTxn(outer, node, pos, len, repl) {
*/
this.doTransaction = this.redoTransaction = function() {
this.orig = node.substringData(pos, len);
node.replaceData(pos, len, repl);
node.deleteData(pos, len);
node.insertData(pos, repl);
this.shiftSelection(repl.length - len);
};

/**
* Replaces the previously inserted substitution with the original string.
*/
this.undoTransaction = function() {
node.replaceData(pos, repl.length, this.orig);
//node.replaceData(pos, repl.length, this.orig);
node.deleteData(pos, repl.length);
node.insertData(pos, this.orig);
this.shiftSelection(0);
};

Expand Down

0 comments on commit 0f3bad9

Please sign in to comment.