Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Only respect USE_DOCUMENT_FOR_KEY_EVENTS when using an iframe.

R=nicksantos
DELTA=13  (4 added, 4 deleted, 5 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=5737


git-svn-id: http://closure-library.googlecode.com/svn/trunk@2264 0b95b8e8-c90f-11de-9d4f-f947ee5921c8
  • Loading branch information...
commit efc5519f33ca7deb3272870c2d4d9eee67c8af51 1 parent acb093a
gboyer@google.com authored
View
4 closure/goog/editor/browserfeature.js
@@ -116,7 +116,9 @@ goog.editor.BrowserFeature = {
// Whether keyboard events only reliably fire on the document.
// On Gecko without contentEditable, keyboard events only fire reliably on the
// document element. With contentEditable, the field itself is focusable,
- // which means that it will fire key events.
+ // which means that it will fire key events. This does not apply if
+ // application is using ContentEditableField or otherwise overriding Field
+ // not to use an iframe.
USE_DOCUMENT_FOR_KEY_EVENTS: goog.userAgent.GECKO &&
!goog.editor.defines.USE_CONTENTEDITABLE_IN_FIREFOX_3,
View
6 closure/goog/editor/field.js
@@ -446,8 +446,10 @@ goog.editor.Field.prototype.getOriginalElement = function() {
goog.editor.Field.prototype.addListener = function(type, listener, opt_capture,
opt_handler) {
var elem = this.getElement();
- // On Gecko, keyboard events only reliably fire on the document element.
- if (elem && goog.editor.BrowserFeature.USE_DOCUMENT_FOR_KEY_EVENTS) {
+ // On Gecko, keyboard events only reliably fire on the document element when
+ // using an iframe.
+ if (goog.editor.BrowserFeature.USE_DOCUMENT_FOR_KEY_EVENTS && elem &&
+ this.usesIframe()) {
elem = elem.ownerDocument;
}
this.eventRegister.listen(elem, type, listener, opt_capture, opt_handler);
View
6 closure/goog/editor/field_test.js
@@ -1201,9 +1201,5 @@ function testNoHandleWindowLevelMouseUp() {
goog.testing.events.fireMouseDownEvent(editableElement);
assertFalse(selectionHasFired);
goog.testing.events.fireMouseUpEvent(otherElement);
- if (goog.userAgent.GECKO && !editableField.usesIframe()) {
- assertTrue(selectionHasFired);
- } else {
- assertFalse(selectionHasFired);
- }
+ assertFalse(selectionHasFired);
}
Please sign in to comment.
Something went wrong with that request. Please try again.