You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2012/12/19 09:55:21 UTC

svn commit: r1423800 - in /myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl: _util/_Dom.js _util/_DomQuirks.js core/_Runtime.js core/_RuntimeQuirks.js

Author: werpu
Date: Wed Dec 19 08:55:20 2012
New Revision: 1423800

URL: http://svn.apache.org/viewvc?rev=1423800&view=rev
Log:
https://issues.apache.org/jira/browse/MYFACES-3666

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/_util/_DomQuirks.js
    myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_Runtime.js
    myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_RuntimeQuirks.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=1423800&r1=1423799&r2=1423800&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 Wed Dec 19 08:55:20 2012
@@ -826,8 +826,9 @@ _MF_SINGLTN(_PFX_UTIL + "_Dom", Object, 
      * this method builds an assertion for those methods to reduce code
      *
      * @param item  the item to be tested
-     * @param markup the mark
-     * @param caller
+     * @param markup the markup
+     * @param caller caller function
+     * @param {optional} params array of assertion param names
      */
     _assertStdParams: function(item, markup, caller, params) {
         //internal error

Modified: myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_DomQuirks.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_DomQuirks.js?rev=1423800&r1=1423799&r2=1423800&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_DomQuirks.js (original)
+++ myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_DomQuirks.js Wed Dec 19 08:55:20 2012
@@ -104,7 +104,7 @@ if (_MF_SINGLTN) {
             if ('undefined' == typeof this._isCompliantBrowser) {
                 this._isCompliantBrowser = !!((window.Range
                         && typeof Range.prototype.createContextualFragment == 'function')
-                    //createContextualFragment hints to a no quirks browser but we need more fallbacks
+                                                            //createContextualFragment hints to a no quirks browser but we need more fallbacks
                         || document.querySelectoryAll       //query selector all hints to html5 capabilities
                         || document.createTreeWalker);      //treewalker is either firefox 3.5+ or ie9 standards mode
             }
@@ -325,9 +325,9 @@ if (_MF_SINGLTN) {
                         if (!this._isTableElement(childNode)) {    //table elements cannot be deleted
                             childNode.innerHTML = "";
                         }
-                        if (b.isIE && b.isIE < 8 && 'undefined' != childNode.outerHTML)
+                        if (b.isIE && b.isIE < 8 && 'undefined' != typeof childNode.outerHTML) {
                             childNode.outerHTML = '';
-                        else {
+                        } else {
                             node.removeChild(childNode);
                         }
                         if (!b.isIEMobile) {
@@ -582,21 +582,22 @@ if (_MF_SINGLTN) {
                 this.insertFirst(evalDiv);
 
                 //we remap it into a real boolean value
-                if (window.Range
-                        && typeof Range.prototype.createContextualFragment == 'function') {
+                if (this.isDomCompliant()) {
                     this._outerHTMLCompliant(evalDiv, markup);
                 } else {
                     //will not be called placeholder for quirks class
                     this._outerHTMLNonCompliant(evalDiv, markup);
                 }
 
+
             }
 
             return  !myfaces.config._autoeval;
         },
 
         getNamedElementFromForm:function (form, elementName) {
-            if(this._RT.browser.isIE < 8) {
+			var browser = this._RT.browser;
+            if(browser.isIE && browser.isIE < 8) {
                 if(!form.elements) return null;
                 for(var cnt = 0, l = form.elements.length; cnt < l; cnt ++) {
                     var element = form.elements[cnt];

Modified: myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_Runtime.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_Runtime.js?rev=1423800&r1=1423799&r2=1423800&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_Runtime.js (original)
+++ myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_Runtime.js Wed Dec 19 08:55:20 2012
@@ -758,17 +758,77 @@ if (!myfaces._impl.core._Runtime) {
         //implemented in extruntime
         this.singletonDelegateObj = function()  {};
 
-        //for modern browsers we do not need it anymore
-        //there we can rely on browser capabilities checks
-        //we only have one xml special case so webkit and opera is the
-        //only detection we still need for the minimal case
-        //TODO determine how to eliminate this check
-        //minimal modern should be able to cope without any browser checks
-        //at all
-        //with a direct capabilities check
-        _T.browser = {};
-        var d  = _T.browser;
-        d.isWebKit = parseFloat(navigator.userAgent.split("WebKit/")[1]) || undefined;
+        /**
+        * browser detection code
+        * cross ported from dojo 1.2
+        *
+        * dojos browser detection code is very sophisticated
+        * hence we port it over it allows a very fine grained detection of
+        * browsers including the version number
+        * this however only can work out if the user
+        * does not alter the user agent, which they normally dont!
+        *
+        * the exception is the ie detection which relies on specific quirks in ie
+        */
+       var n = navigator;
+       var dua = n.userAgent,
+               dav = n.appVersion,
+               tv = parseFloat(dav);
+       var _T = this;
+       _T.browser = {};
+       myfaces._impl.core._EvalHandlers.browser = _T.browser;
+       var d = _T.browser;
+
+       if (dua.indexOf("Opera") >= 0) {
+           _T.isOpera = tv;
+       }
+       if (dua.indexOf("AdobeAIR") >= 0) {
+           d.isAIR = 1;
+       }
+       if (dua.indexOf("BlackBerry") >= 0) {
+           d.isBlackBerry = tv;
+       }
+       d.isKhtml = (dav.indexOf("Konqueror") >= 0) ? tv : 0;
+       d.isWebKit = parseFloat(dua.split("WebKit/")[1]) || undefined;
+       d.isChrome = parseFloat(dua.split("Chrome/")[1]) || undefined;
+
+       // safari detection derived from:
+       //		http://developer.apple.com/internet/safari/faq.html#anchor2
+       //		http://developer.apple.com/internet/safari/uamatrix.html
+       var index = Math.max(dav.indexOf("WebKit"), dav.indexOf("Safari"), 0);
+       if (index && !d.isChrome) {
+           // try to grab the explicit Safari version first. If we don't get
+           // one, look for less than 419.3 as the indication that we're on something
+           // "Safari 2-ish".
+           d.isSafari = parseFloat(dav.split("Version/")[1]);
+           if (!d.isSafari || parseFloat(dav.substr(index + 7)) <= 419.3) {
+               d.isSafari = 2;
+           }
+       }
+
+       //>>excludeStart("webkitMobile", kwArgs.webkitMobile);
+
+       if (dua.indexOf("Gecko") >= 0 && !d.isKhtml && !d.isWebKit) {
+           d.isMozilla = d.isMoz = tv;
+       }
+       if (d.isMoz) {
+           //We really need to get away from _T. Consider a sane isGecko approach for the future.
+           d.isFF = parseFloat(dua.split("Firefox/")[1] || dua.split("Minefield/")[1] || dua.split("Shiretoko/")[1]) || undefined;
+       }
+
+       if (document.all && !d.isOpera && !d.isBlackBerry) {
+           d.isIE = parseFloat(dav.split("MSIE ")[1]) || undefined;
+           d.isIEMobile = parseFloat(dua.split("IEMobile")[1]);
+           //In cases where the page has an HTTP header or META tag with
+           //X-UA-Compatible, then it is in emulation mode, for a previous
+           //version. Make sure isIE reflects the desired version.
+           //document.documentMode of 5 means quirks mode.
+
+           /** @namespace document.documentMode */
+           if (d.isIE >= 8 && document.documentMode != 5) {
+               d.isIE = document.documentMode;
+           }
+       }
     };
 }
 

Modified: myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_RuntimeQuirks.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_RuntimeQuirks.js?rev=1423800&r1=1423799&r2=1423800&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_RuntimeQuirks.js (original)
+++ myfaces/core/branches/2.2.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_RuntimeQuirks.js Wed Dec 19 08:55:20 2012
@@ -13,17 +13,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-if (!document.querySelectorAll) {
+if (!document.querySelectorAll || !window.XMLHttpRequest) {
 
     //initial browser detection, we encapsule it in a closure
     //to drop all temporary variables from ram as soon as possible
+    //we run into the quirks fallback if XMLHttpRequest is not enabled
     (function() {
         var _T  = myfaces._impl.core._Runtime;
 
-
-
-
-
         _T.getXHRObject = function() {
             //since this is a global object ie hates it if we do not check for undefined
             if (window.XMLHttpRequest) {
@@ -49,76 +46,6 @@ if (!document.querySelectorAll) {
             return new ActiveXObject('Microsoft.XMLHTTP');
         };
 
-        /**
-         * browser detection code
-         * cross ported from dojo 1.2
-         *
-         * dojos browser detection code is very sophisticated
-         * hence we port it over it allows a very fine grained detection of
-         * browsers including the version number
-         * this however only can work out if the user
-         * does not alter the user agent, which they normally dont!
-         *
-         * the exception is the ie detection which relies on specific quirks in ie
-         */
-        var n = navigator;
-        var dua = n.userAgent,
-                dav = n.appVersion,
-                tv = parseFloat(dav);
-        var _T = myfaces._impl.core._Runtime;
-        _T.browser = {};
-        myfaces._impl.core._EvalHandlers.browser = _T.browser;
-        var d = _T.browser;
-
-        if (dua.indexOf("Opera") >= 0) {
-            _T.isOpera = tv;
-        }
-        if (dua.indexOf("AdobeAIR") >= 0) {
-            d.isAIR = 1;
-        }
-        if (dua.indexOf("BlackBerry") >= 0) {
-            d.isBlackBerry = tv;
-        }
-        d.isKhtml = (dav.indexOf("Konqueror") >= 0) ? tv : 0;
-        d.isWebKit = parseFloat(dua.split("WebKit/")[1]) || undefined;
-        d.isChrome = parseFloat(dua.split("Chrome/")[1]) || undefined;
-
-        // safari detection derived from:
-        //		http://developer.apple.com/internet/safari/faq.html#anchor2
-        //		http://developer.apple.com/internet/safari/uamatrix.html
-        var index = Math.max(dav.indexOf("WebKit"), dav.indexOf("Safari"), 0);
-        if (index && !d.isChrome) {
-            // try to grab the explicit Safari version first. If we don't get
-            // one, look for less than 419.3 as the indication that we're on something
-            // "Safari 2-ish".
-            d.isSafari = parseFloat(dav.split("Version/")[1]);
-            if (!d.isSafari || parseFloat(dav.substr(index + 7)) <= 419.3) {
-                d.isSafari = 2;
-            }
-        }
-
-        //>>excludeStart("webkitMobile", kwArgs.webkitMobile);
 
-        if (dua.indexOf("Gecko") >= 0 && !d.isKhtml && !d.isWebKit) {
-            d.isMozilla = d.isMoz = tv;
-        }
-        if (d.isMoz) {
-            //We really need to get away from _T. Consider a sane isGecko approach for the future.
-            d.isFF = parseFloat(dua.split("Firefox/")[1] || dua.split("Minefield/")[1] || dua.split("Shiretoko/")[1]) || undefined;
-        }
-
-        if (document.all && !d.isOpera && !d.isBlackBerry) {
-            d.isIE = parseFloat(dav.split("MSIE ")[1]) || undefined;
-            d.isIEMobile = parseFloat(dua.split("IEMobile")[1]);
-            //In cases where the page has an HTTP header or META tag with
-            //X-UA-Compatible, then it is in emulation mode, for a previous
-            //version. Make sure isIE reflects the desired version.
-            //document.documentMode of 5 means quirks mode.
-
-            /** @namespace document.documentMode */
-            if (d.isIE >= 8 && document.documentMode != 5) {
-                d.isIE = document.documentMode;
-            }
-        }
     })();
 }
\ No newline at end of file