myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From we...@apache.org
Subject svn commit: r1412933 - in /myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl: _util/_Dom.js xhrCore/_AjaxResponse.js
Date Fri, 23 Nov 2012 16:07:22 GMT
Author: werpu
Date: Fri Nov 23 16:07:21 2012
New Revision: 1412933

URL: http://svn.apache.org/viewvc?rev=1412933&view=rev
Log:
https://issues.apache.org/jira/browse/MYFACES-3653 making the preserve focus code optional

Modified:
    myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js
    myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxResponse.js

Modified: myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js?rev=1412933&r1=1412932&r2=1412933&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js
(original)
+++ myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js
Fri Nov 23 16:07:21 2012
@@ -564,8 +564,12 @@ _MF_SINGLTN(_PFX_UTIL + "_Dom", Object, 
      *
      * @param item the item to be replaced
      * @param markup the markup for the replacement
+     * @param preserveFocus, tries to preserve the focus within the outerhtml operation
+     * if set to true a focus preservation algorithm based on document.activeElement is
+     * used to preserve the focus at the exactly same location as it was
+     *
      */
-    outerHTML : function(item, markup) {
+    outerHTML : function(item, markup, preserveFocus) {
         this._assertStdParams(item, markup, "outerHTML");
         // we can work on a single element in a cross browser fashion
         // regarding the focus thanks to the
@@ -581,7 +585,7 @@ _MF_SINGLTN(_PFX_UTIL + "_Dom", Object, 
 
                 var focusElementId = null;
                 var caretPosition = 0;
-                if ('undefined' != typeof document.activeElement) {
+                if (preserveFocus && 'undefined' != typeof document.activeElement)
{
                     focusElementId = (document.activeElement) ? document.activeElement.id
: null;
                     caretPosition = this.getCaretPosition(document.activeElement);
                 }

Modified: myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxResponse.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxResponse.js?rev=1412933&r1=1412932&r2=1412933&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxResponse.js
(original)
+++ myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxResponse.js
Fri Nov 23 16:07:21 2012
@@ -626,7 +626,7 @@ _MF_SINGLTN(_PFX_XHR + "_AjaxResponse", 
         if (!item) {
             throw this._raiseError(new Error(), _Lang.getMessage("ERR_ITEM_ID_NOTFOUND",
null, "_AjaxResponse.replaceHtmlItem", (itemIdToReplace) ? itemIdToReplace.toString() : "undefined"),
"replaceHtmlItem");
         }
-        return _Dom.outerHTML(item, markup);
+        return _Dom.outerHTML(item, markup, this._RT.getLocalOrGlobalConfig(context, "preserveFocus",
false));
     },
 
     /**



Mime
View raw message