diff options
author | Michał Gołębiowski <m.goleb@gmail.com> | 2014-05-05 15:45:57 +0200 |
---|---|---|
committer | Michał Gołębiowski <m.goleb@gmail.com> | 2014-05-07 23:22:24 +0200 |
commit | 1bd576a3c4e9b95a4dcfe37fc58d3657ac10681e (patch) | |
tree | f048b78404d0b72ff13ccd687ea9364fa9b2d5b8 /test | |
parent | 67381173835b5f53ee36e0f1ca2211e348b3ae70 (diff) | |
download | jquery-1bd576a3c4e9b95a4dcfe37fc58d3657ac10681e.tar.gz jquery-1bd576a3c4e9b95a4dcfe37fc58d3657ac10681e.zip |
Ajax, Manipulation: don't test cross-document manip in Android 2.3
(cherry-picked from 213b9604f3da654e4281eeea56fcb169f88ffd19)
Fixes #14796
Closes gh-1572
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/ajax.js | 6 | ||||
-rw-r--r-- | test/unit/manipulation.js | 19 |
2 files changed, 23 insertions, 2 deletions
diff --git a/test/unit/ajax.js b/test/unit/ajax.js index 8dd97405a..68628a2d3 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -1513,6 +1513,12 @@ module( "ajax", { var parsedXML = jQuery( jQuery.parseXML("<tab title=\"Added\">blibli</tab>") ).find("tab"); ajaxXML = jQuery( ajaxXML ); try { + // Android 2.3 doesn't automatically adopt nodes from foreign documents. + // (see the comment in test/manipulation.js) + // Support: Android 2.3 + if ( /android 2\.3/i.test( navigator.userAgent ) ) { + parsedXML = jQuery( ajaxXML[ 0 ].adoptNode( parsedXML[ 0 ] ) ); + } ajaxXML.find("infowindowtab").append( parsedXML ); } catch( e ) { strictEqual( e, undefined, "error" ); diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index 48d5f3987..ad90df923 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -410,7 +410,7 @@ test( "XML DOM manipulation (#9960)", function() { expect( 5 ); - var + var scxml1Adopted, xmlDoc1 = jQuery.parseXML("<scxml xmlns='http://www.w3.org/2005/07/scxml' version='1.0'><state x='100' y='100' initial='actions' id='provisioning'></state><state x='100' y='100' id='error'></state><state x='100' y='100' id='finished' final='true'></state></scxml>"), xmlDoc2 = jQuery.parseXML("<scxml xmlns='http://www.w3.org/2005/07/scxml' version='1.0'><state id='provisioning3'></state></scxml>"), xml1 = jQuery( xmlDoc1 ), @@ -419,6 +419,15 @@ test( "XML DOM manipulation (#9960)", function() { scxml2 = jQuery( "scxml", xml2 ), state = scxml2.find("state"); + // Android 2.3 doesn't automatically adopt nodes from foreign documents. + // Although technically this is compliant behavior, no other browser + // (including newer Android Browsers) behave in this way so do the adopting + // just for Android 2.3. + // Support: Android 2.3 + if ( /android 2\.3/i.test( navigator.userAgent ) ) { + state = jQuery( xmlDoc1.adoptNode( state[ 0 ] ) ); + } + scxml1.append( state ); strictEqual( scxml1[0].lastChild, state[0], "append" ); @@ -431,7 +440,13 @@ test( "XML DOM manipulation (#9960)", function() { scxml1.find("#provisioning").before( state ); strictEqual( scxml1[0].firstChild, state[0], "before" ); - scxml2.replaceWith( scxml1 ); + // Support: Android 2.3 + if ( /android 2\.3/i.test( navigator.userAgent ) ) { + scxml1Adopted = jQuery( xmlDoc2.adoptNode( scxml1[ 0 ] ) ); + scxml2.replaceWith( scxml1Adopted ); + } else { + scxml2.replaceWith( scxml1 ); + } deepEqual( jQuery( "state", xml2 ).get(), scxml1.find("state").get(), "replaceWith" ); }); |