mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-28 02:48:49 +00:00
Fixed: the text field selectText: message worked significantly differently in unit tests than in the browser.
The message normally makes the text field the first responder, but this did not happen outside of the DOM platform. Also documented the first responder side effect.
This commit is contained in:
1 parent
08dd7d6951
commit
fa3df44535
1 file changed
+11
-4
+11
-4
@@ -881,21 +881,28 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
}
|
||||
|
||||
/*!
|
||||
Select all the text in the CPTextField.
|
||||
Make the receiver the first responder and select all the text in the field.
|
||||
*/
|
||||
- (void)selectText:(id)sender
|
||||
{
|
||||
#if PLATFORM(DOM)
|
||||
var element = [self _inputElement];
|
||||
// FIXME Should this really make the text field the first responder?
|
||||
|
||||
if (([self isEditable] || [self isSelectable]))
|
||||
{
|
||||
#if PLATFORM(DOM)
|
||||
var element = [self _inputElement];
|
||||
|
||||
if ([[self window] firstResponder] === self)
|
||||
window.setTimeout(function() { element.select(); }, 0);
|
||||
else if ([self window] !== nil && [[self window] makeFirstResponder:self])
|
||||
window.setTimeout(function() {[self selectText:sender];}, 0);
|
||||
}
|
||||
#else
|
||||
// Even if we can't actually select the text we need to preserve the first
|
||||
// responder side effect.
|
||||
if ([self window] !== nil && [[self window] firstResponder] !== self)
|
||||
[[self window] makeFirstResponder:self];
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
- (void)copy:(id)sender
|
||||
|
||||
Reference in new issue
Block a user