aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJörn Zaefferer <joern.zaefferer@gmail.com>2006-10-11 13:35:05 +0000
committerJörn Zaefferer <joern.zaefferer@gmail.com>2006-10-11 13:35:05 +0000
commit2e544e9eb89c87b9eac6df445474d21e9be604eb (patch)
tree3658bac517b74b1876906425e0a8fd67dd92f5b2
parent6de5a6b96a72f7b0b2cc54fa7df5410664b6e18b (diff)
downloadjquery-2e544e9eb89c87b9eac6df445474d21e9be604eb.tar.gz
jquery-2e544e9eb89c87b9eac6df445474d21e9be604eb.zip
Added 2 of 3 fixes of #164
-rw-r--r--build/test/data/dashboard.xml8
-rw-r--r--src/ajax/ajax.js12
-rw-r--r--src/jquery/jquery.js19
3 files changed, 30 insertions, 9 deletions
diff --git a/build/test/data/dashboard.xml b/build/test/data/dashboard.xml
index 1bcbf8b0d..d954f27af 100644
--- a/build/test/data/dashboard.xml
+++ b/build/test/data/dashboard.xml
@@ -3,12 +3,8 @@
<locations>
<location>
<infowindowtab>
- <tab title="Location">
- <![CDATA[blabla]]>
- </tab>
- <tab title="Users">
- <![CDATA[blublu]]>
- </tab>
+ <tab title="Location"><![CDATA[blabla]]></tab>
+ <tab title="Users"><![CDATA[blublu]]></tab>
</infowindowtab>
</location>
</locations>
diff --git a/src/ajax/ajax.js b/src/ajax/ajax.js
index 896f92d2f..bcf9472d8 100644
--- a/src/ajax/ajax.js
+++ b/src/ajax/ajax.js
@@ -288,6 +288,18 @@ jQuery.extend({
* }
* )
*
+ * @test stop();
+ * $.get('data/dashboard.xml', function(xml) {
+ * var content = [];
+ * $('tab', xml).each(function() {
+ * content.push($(this).text());
+ * });
+ * ok( content[0] == 'blabla', 'Check first tab');
+ * ok( content[1] == 'blublu', 'Check second tab');
+ * start();
+ * });
+ *
+ *
* @name $.get
* @type jQuery
* @param String url The URL of the page to load.
diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js
index 9965fd349..965c2798a 100644
--- a/src/jquery/jquery.js
+++ b/src/jquery/jquery.js
@@ -50,8 +50,10 @@ jQuery = function(a,c) {
return new jQuery(a,c);
// Handle HTML strings
- var m = /^[^<]*(<.+>)[^>]*$/.exec(a);
- if ( m ) a = jQuery.clean( [ m[1] ] );
+ if (typeof a == "string") {
+ var m = /^[^<]*(<.+>)[^>]*$/.exec(a);
+ if ( m ) a = jQuery.clean( [ m[1] ] );
+ }
// Watch for when an array is passed in
this.get( a.constructor == Array || a.length && !a.nodeType && a[0] != undefined && a[0].nodeType ?
@@ -446,6 +448,17 @@ jQuery.fn = jQuery.prototype = {
* $("#check2").attr('checked', false);
* ok( document.getElementById('check2').checked == false, 'Set checked attribute' );
*
+ * @test stop();
+ * $.get('data/dashboard.xml', function(xml) {
+ * var titles = [];
+ * $('tab', xml).each(function() {
+ * titles.push($(this).attr('title'));
+ * });
+ * ok( titles[0] == 'Location', 'attr() in XML context: Check first title' );
+ * ok( titles[1] == 'Users', 'attr() in XML context: Check second title' );
+ * start();
+ * });
+ *
* @name attr
* @type jQuery
* @param String key The name of the property to set.
@@ -1558,7 +1571,7 @@ jQuery.extend({
empty: "!a.childNodes.length",
// Text Check
- contains: "(a.innerText||a.innerHTML).indexOf(m[3])>=0",
+ contains: "((a.firstChild && a.firstChild.nodeValue)||a.innerText||a.innerHTML).indexOf(m[3])>=0",
// Visibility
visible: "a.type!='hidden'&&jQuery.css(a,'display')!='none'&&jQuery.css(a,'visibility')!='hidden'",