Path: blob/trunk/third_party/closure/goog/editor/focus.js
2868 views
// Copyright 2009 The Closure Library Authors. All Rights Reserved.1//2// Licensed under the Apache License, Version 2.0 (the "License");3// you may not use this file except in compliance with the License.4// You may obtain a copy of the License at5//6// http://www.apache.org/licenses/LICENSE-2.07//8// Unless required by applicable law or agreed to in writing, software9// distributed under the License is distributed on an "AS-IS" BASIS,10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.11// See the License for the specific language governing permissions and12// limitations under the License.1314/**15* @fileoverview Utilties to handle focusing related to rich text editing.16*17*/1819goog.provide('goog.editor.focus');2021goog.require('goog.dom.selection');222324/**25* Change focus to the given input field and set cursor to end of current text.26* @param {Element} inputElem Input DOM element.27*/28goog.editor.focus.focusInputField = function(inputElem) {29inputElem.focus();30goog.dom.selection.setCursorPosition(inputElem, inputElem.value.length);31};323334