Просмотр исходного кода

Changed line endings to Unix format.

Charles Howes 12 лет назад
Родитель
Сommit
b6e79c1345
9 измененных файлов с 1519 добавлено и 1519 удалено
  1. 14 14
      driver-example.pl
  2. 399 399
      ide-plugin.js
  3. 362 362
      lib/Selenium/Remote/Commands.pm
  4. 166 166
      lib/Selenium/Remote/RemoteConnection.pm
  5. 68 68
      lib/Selenium/Remote/WDKeys.pm
  6. 15 15
      t/www/cookies.html
  7. 98 98
      t/www/formPage.html
  8. 253 253
      t/www/javascriptPage.html
  9. 144 144
      t/www/jquery-1.3.2.js

+ 14 - 14
driver-example.pl

@@ -1,14 +1,14 @@
-#!/usr/bin/perl
-use Selenium::Remote::Driver;
-use Test::More tests=>4;
-
-my $driver = Selenium::Remote::Driver->new;
-$driver->get("http://www.google.com");
-$driver->find_element('q','name')->send_keys("Hello WebDriver!");
-
-ok($driver->get_title =~ /Google/,"title matches google");
-is($driver->get_title,'Google',"Title is google");
-ok($driver->get_title eq 'Google','Title equals google');
-like($driver->get_title,qr/Google/,"Title matches google");
-
-$driver->quit();
+#!/usr/bin/perl
+use Selenium::Remote::Driver;
+use Test::More tests=>4;
+
+my $driver = Selenium::Remote::Driver->new;
+$driver->get("http://www.google.com");
+$driver->find_element('q','name')->send_keys("Hello WebDriver!");
+
+ok($driver->get_title =~ /Google/,"title matches google");
+is($driver->get_title,'Google',"Title is google");
+ok($driver->get_title eq 'Google','Title equals google');
+like($driver->get_title,qr/Google/,"Title matches google");
+
+$driver->quit();

+ 399 - 399
ide-plugin.js

@@ -1,399 +1,399 @@
-/*
- * Formatter for Selenium 2 / WebDriver perl-rc client.
- * To install...
-    1. Open the Selenium IDE
-    2. Options >> Options
-    3. Formats Tab
-    4. Click Add at the bottom
-    5. In the name field call it 'Perl-Webdriver'
-    6. Paste this entire source in the main textbox
-    7. Click 'Save'
-    8. Click 'Ok'
- */
-
-var subScriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].getService(Components.interfaces.mozIJSSubScriptLoader);
-subScriptLoader.loadSubScript('chrome://selenium-ide/content/formats/webdriver.js', this);
-
-function testClassName(testName) {
-  return testName.split(/[^0-9A-Za-z]+/).map(
-      function(x) {
-        return capitalize(x);
-      }).join('');
-}
-
-function testMethodName(testName) {
-  return "test_" + underscore(testName);
-}
-
-function nonBreakingSpace() {
-  return "\"\\xa0\"";
-}
-
-function array(value) {
-  var str = '[';
-  for (var i = 0; i < value.length; i++) {
-    str += string(value[i]);
-    if (i < value.length - 1) str += ", ";
-  }
-  str += ']';
-  return str;
-}
-
-notOperator = function() {
-  return "not ";
-};
-
-Equals.prototype.toString = function() {
-  return this.e2.toString() + " == " + this.e1.toString();
-};
-
-Equals.prototype.assert = function() {
-  return statement("is(" + this.e2.toString() + "," + this.e1.toString() + ")");
-};
-
-Equals.prototype.verify = function() {
-  return verify(this.assert());
-};
-
-NotEquals.prototype.toString = function() {
-  return this.e1.toString() + " != " + this.e2.toString();
-};
-
-NotEquals.prototype.assert = function() {
-  return statement("isnt(" + this.e2.toString() + "," + this.e1.toString() + ")");
-};
-
-NotEquals.prototype.verify = function() {
-  return verify(this.assert());
-};
-
-function joinExpression(expression) {
-  return "join(\",\"," + expression.toString() + ")";
-}
-
-function statement(expression) {
-  expression.noBraces = true;
-  var s = expression.toString();
-  if(s.length == 0) {
-    return null;
-  }
-  return s + ';';
-}
-
-function assignToVariable(type, variable, expression) {
-  return variable + " = " + expression.toString();
-}
-
-function ifCondition(expression, callback) {
-  return "if (" + expression.toString() + ") {\n" + callback() + "}";
-}
-
-function tryCatch(tryStatement, catchStatement, exception) {
-  return "eval {\n" +
-      indents(1) + tryStatement + "\n" +
-      "};\n if ($@) {\n" +
-      indents(1) + catchStatement + "\n" +
-      "}";
-}
-
-function assertTrue(expression) {
-  var exp = expression.toString();
-  //var r = exp.match(/^(.+)\.([0-9A-Za-z_]+)\?$/);
-  //if (r && r.length == 3) {
-  //  return "ok(" + r[1] + ".should be_" + r[2];
-  //} else {
-    return statement("ok(" + exp + ")");
-  //}
-}
-
-function assertFalse(expression) {
-  //return expression.invert().toString() + ".should be_false";
-  var exp = expression.toString();
-  //var r = exp.match(/^(.+)\.([0-9A-Za-z_]+)\?$/);
-  //if (r && r.length == 3) {
-  //  return r[1] + ".should_not be_" + r[2];
-  //} else {
-    return statement("ok(!" + exp + ")");
-  //}
-}
-
-function verify(stmt) {
-  return stmt;
-}
-
-function verifyTrue(expression) {
-  return verify(assertTrue(expression));
-}
-
-function verifyFalse(expression) {
-  return verify(assertFalse(expression));
-}
-
-RegexpMatch.patternAsRegEx = function(pattern) {
-  var str = pattern.replace(/\//g, "\\/");
-  if (str.match(/\n/)) {
-    str = str.replace(/\n/g, '\\n');
-    return '/' + str + '/m';
-  } else {
-    return str = '/' + str + '/';
-  }
-};
-
-RegexpMatch.prototype.patternAsRegEx = function() {
-  return RegexpMatch.patternAsRegEx(this.pattern);
-};
-
-RegexpMatch.prototype.toString = function() {
-  return this.expression + " =~ " + this.patternAsRegEx();
-};
-
-RegexpMatch.prototype.assert = function() {
-  return statement("like(qr" + this.patternAsRegEx() + "," + this.expression + ")");
-};
-
-RegexpMatch.prototype.verify = function() {
-  return verify(this.assert());
-};
-
-RegexpNotMatch.prototype.patternAsRegEx = function() {
-  return RegexpMatch.patternAsRegEx(this.pattern);
-};
-
-RegexpNotMatch.prototype.toString = function() {
-  return this.expression + " !~ " + this.patternAsRegEx();
-};
-
-RegexpNotMatch.prototype.assert = function() {
-  return statement("unlike(qr" + this.patternAsRegEx() + "," + this.expression + ")");
-};
-
-RegexpNotMatch.prototype.verify = function() {
-  return verify(this.assert());
-};
-
-function waitFor(expression) {
-  if (expression.negative) {
-    return "for(0..60) { my $ret = 1; eval { $ret = (" + expression.invert().toString() + ") }; if($@ || !$ret) { break }; sleep 1 }"
-  } else {
-    return "!60.times{ break if (" + expression.toString() + " rescue false); sleep 1 }"
-  }
-}
-
-function assertOrVerifyFailure(line, isAssert) {
-  return "assert_raise(Kernel) { " + line + "}";
-}
-
-function pause(milliseconds) {
-  return "sleep " + (parseInt(milliseconds) / 1000);
-}
-
-function echo(message) {
-  return "note " + xlateArgument(message);
-}
-
-function formatComment(comment) {
-  return comment.comment.replace(/.+/mg, function(str) {
-    return "# " + str;
-  });
-}
-
-/**
- * Returns a string representing the suite for this formatter language.
- *
- * @param testSuite  the suite to format
- * @param filename   the file the formatted suite will be saved as
- */
-function formatSuite(testSuite, filename) {
-  formattedSuite = 'require "spec/ruby"\n' +
-      'require "spec/runner"\n' +
-      '\n' +
-      "# output T/F as Green/Red\n" +
-      "ENV['RSPEC_COLOR'] = 'true'\n" +
-      '\n';
-
-  for (var i = 0; i < testSuite.tests.length; ++i) {
-    // have saved or loaded a suite
-    if (typeof testSuite.tests[i].filename != 'undefined') {
-      formattedSuite += 'require File.join(File.dirname(__FILE__),  "' + testSuite.tests[i].filename.replace(/\.\w+$/, '') + '")\n';
-    } else {
-      // didn't load / save as a suite
-      var testFile = testSuite.tests[i].getTitle();
-      formattedSuite += 'require "' + testFile + '"\n';
-    }
-  }
-  return formattedSuite;
-}
-
-this.options = {
-  receiver: "$driver",
-  rcHost: "localhost",
-  rcPort: "4444",
-  environment: "firefox",
-  showSelenese: 'false',
-  header:
-      "use strict;\n" +
-      "use warnings;\n" +
-      "use Selenium::Remote::Driver;\n" +
-      "use Test::More;\n" +
-      "\n" +
-      'my ${receiver} = Selenium::Remote::Driver->new( remote_server_addr => "${rcHost}",\n' +
-      '                                               port => ${rcPort},\n' +
-      '                                               browser_name => "${environment}");\n' +
-      "\n",
-  footer:
-      "$driver->quit();\n" +
-      "done_testing();\n",
-  indent: "0",
-  initialIndents: "0"
-};
-
-this.configForm =
-    '<description>Variable for Selenium instance</description>' +
-        '<textbox id="options_receiver" />' +
-        '<description>Selenium RC host</description>' +
-        '<textbox id="options_rcHost" />' +
-        '<description>Selenium RC port</description>' +
-        '<textbox id="options_rcPort" />' +
-        '<description>Environment</description>' +
-        '<textbox id="options_environment" />' +
-        '<description>Header</description>' +
-        '<textbox id="options_header" multiline="true" flex="1" rows="4"/>' +
-        '<description>Footer</description>' +
-        '<textbox id="options_footer" multiline="true" flex="1" rows="4"/>' +
-        '<description>Indent</description>' +
-        '<menulist id="options_indent"><menupopup>' +
-        '<menuitem label="Tab" value="tab"/>' +
-        '<menuitem label="1 space" value="1"/>' +
-        '<menuitem label="2 spaces" value="2"/>' +
-        '<menuitem label="3 spaces" value="3"/>' +
-        '<menuitem label="4 spaces" value="4"/>' +
-        '<menuitem label="5 spaces" value="5"/>' +
-        '<menuitem label="6 spaces" value="6"/>' +
-        '<menuitem label="7 spaces" value="7"/>' +
-        '<menuitem label="8 spaces" value="8"/>' +
-        '</menupopup></menulist>' +
-        '<checkbox id="options_showSelenese" label="Show Selenese"/>';
-
-this.name = "Perl Test::More(WebDriver)";
-this.testcaseExtension = ".t";
-this.suiteExtension = ".t";
-this.webdriver = true;
-
-WDAPI.Driver = function() {
-  this.ref = options.receiver;
-};
-
-WDAPI.Driver.searchContext = function(locatorType, locator) {
-  var locatorString = xlateArgument(locator).replace(/([@%$])/,"\\$1");
-  switch (locatorType) {
-    case 'xpath':
-      return locatorString + ', "xpath"';
-    case 'css':
-      return locatorString + ', "css"';
-    case 'id':
-      return locatorString + ', "id"';
-    case 'link':
-      return locatorString + ', "link"';
-    case 'name':
-      return locatorString + ', "name"';
-    case 'tag_name':
-      return locatorString + ', "tag_name"';
-  }
-  throw 'Error: unknown strategy [' + locatorType + '] for locator [' + locator + ']';
-};
-
-WDAPI.Driver.prototype.back = function() {
-  return this.ref + "->navigate->back";
-};
-
-WDAPI.Driver.prototype.close = function() {
-  return this.ref + "->close";
-};
-
-WDAPI.Driver.prototype.findElement = function(locatorType, locator) {
-  return new WDAPI.Element(this.ref + "->find_element(" + WDAPI.Driver.searchContext(locatorType, locator) + ")");
-};
-
-WDAPI.Driver.prototype.findElements = function(locatorType, locator) {
-  return new WDAPI.ElementList(this.ref + "->find_elements(" + WDAPI.Driver.searchContext(locatorType, locator) + ")");
-};
-
-WDAPI.Driver.prototype.getCurrentUrl = function() {
-  return this.ref + "->get_current_url";
-};
-
-WDAPI.Driver.prototype.get = function(url) {
-  return this.ref + "->get(" + url + ")";
-};
-
-WDAPI.Driver.prototype.getTitle = function() {
-  return this.ref + "->get_title";
-};
-
-WDAPI.Driver.prototype.refresh = function() {
-  return this.ref + "->refresh";
-};
-
-WDAPI.Driver.prototype.frame = function(locator) {
-  return this.ref + "->switch_to_frame(" + xlateArgument(locator) + ")";
-}
-
-WDAPI.Element = function(ref) {
-  this.ref = ref;
-};
-
-WDAPI.Element.prototype.clear = function() {
-  return this.ref + "->clear";
-};
-
-WDAPI.Element.prototype.click = function() {
-  return this.ref + "->click";
-};
-
-WDAPI.Element.prototype.getAttribute = function(attributeName) {
-  return this.ref + "->attribute(" + xlateArgument(attributeName) + ")";
-};
-
-WDAPI.Element.prototype.getText = function() {
-  return this.ref + "->get_text";
-};
-
-WDAPI.Element.prototype.isDisplayed = function() {
-  return this.ref + "->is_displayed";
-};
-
-WDAPI.Element.prototype.isSelected = function() {
-  return this.ref + "->is_selected";
-};
-
-WDAPI.Element.prototype.sendKeys = function(text) {
-  return this.ref + "->send_keys(" + xlateArgument(text) + ")";
-};
-
-WDAPI.Element.prototype.submit = function() {
-  return this.ref + "->submit";
-};
-
-WDAPI.ElementList = function(ref) {
-  this.ref = ref;
-};
-
-WDAPI.ElementList.prototype.getItem = function(index) {
-  return this.ref + "[" + index + "]";
-};
-
-WDAPI.ElementList.prototype.getSize = function() {
-  return this.ref + "->size";
-};
-
-WDAPI.ElementList.prototype.isEmpty = function() {
-  return this.ref + "->is_empty";
-};
-
-
-WDAPI.Utils = function() {
-};
-
-WDAPI.Utils.isElementPresent = function(how, what) {
-  return this.ref + "->is_element_present(" + xlateArgument(what) + ", \"" + how + "\")";
-};
+/*
+ * Formatter for Selenium 2 / WebDriver perl-rc client.
+ * To install...
+    1. Open the Selenium IDE
+    2. Options >> Options
+    3. Formats Tab
+    4. Click Add at the bottom
+    5. In the name field call it 'Perl-Webdriver'
+    6. Paste this entire source in the main textbox
+    7. Click 'Save'
+    8. Click 'Ok'
+ */
+
+var subScriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].getService(Components.interfaces.mozIJSSubScriptLoader);
+subScriptLoader.loadSubScript('chrome://selenium-ide/content/formats/webdriver.js', this);
+
+function testClassName(testName) {
+  return testName.split(/[^0-9A-Za-z]+/).map(
+      function(x) {
+        return capitalize(x);
+      }).join('');
+}
+
+function testMethodName(testName) {
+  return "test_" + underscore(testName);
+}
+
+function nonBreakingSpace() {
+  return "\"\\xa0\"";
+}
+
+function array(value) {
+  var str = '[';
+  for (var i = 0; i < value.length; i++) {
+    str += string(value[i]);
+    if (i < value.length - 1) str += ", ";
+  }
+  str += ']';
+  return str;
+}
+
+notOperator = function() {
+  return "not ";
+};
+
+Equals.prototype.toString = function() {
+  return this.e2.toString() + " == " + this.e1.toString();
+};
+
+Equals.prototype.assert = function() {
+  return statement("is(" + this.e2.toString() + "," + this.e1.toString() + ")");
+};
+
+Equals.prototype.verify = function() {
+  return verify(this.assert());
+};
+
+NotEquals.prototype.toString = function() {
+  return this.e1.toString() + " != " + this.e2.toString();
+};
+
+NotEquals.prototype.assert = function() {
+  return statement("isnt(" + this.e2.toString() + "," + this.e1.toString() + ")");
+};
+
+NotEquals.prototype.verify = function() {
+  return verify(this.assert());
+};
+
+function joinExpression(expression) {
+  return "join(\",\"," + expression.toString() + ")";
+}
+
+function statement(expression) {
+  expression.noBraces = true;
+  var s = expression.toString();
+  if(s.length == 0) {
+    return null;
+  }
+  return s + ';';
+}
+
+function assignToVariable(type, variable, expression) {
+  return variable + " = " + expression.toString();
+}
+
+function ifCondition(expression, callback) {
+  return "if (" + expression.toString() + ") {\n" + callback() + "}";
+}
+
+function tryCatch(tryStatement, catchStatement, exception) {
+  return "eval {\n" +
+      indents(1) + tryStatement + "\n" +
+      "};\n if ($@) {\n" +
+      indents(1) + catchStatement + "\n" +
+      "}";
+}
+
+function assertTrue(expression) {
+  var exp = expression.toString();
+  //var r = exp.match(/^(.+)\.([0-9A-Za-z_]+)\?$/);
+  //if (r && r.length == 3) {
+  //  return "ok(" + r[1] + ".should be_" + r[2];
+  //} else {
+    return statement("ok(" + exp + ")");
+  //}
+}
+
+function assertFalse(expression) {
+  //return expression.invert().toString() + ".should be_false";
+  var exp = expression.toString();
+  //var r = exp.match(/^(.+)\.([0-9A-Za-z_]+)\?$/);
+  //if (r && r.length == 3) {
+  //  return r[1] + ".should_not be_" + r[2];
+  //} else {
+    return statement("ok(!" + exp + ")");
+  //}
+}
+
+function verify(stmt) {
+  return stmt;
+}
+
+function verifyTrue(expression) {
+  return verify(assertTrue(expression));
+}
+
+function verifyFalse(expression) {
+  return verify(assertFalse(expression));
+}
+
+RegexpMatch.patternAsRegEx = function(pattern) {
+  var str = pattern.replace(/\//g, "\\/");
+  if (str.match(/\n/)) {
+    str = str.replace(/\n/g, '\\n');
+    return '/' + str + '/m';
+  } else {
+    return str = '/' + str + '/';
+  }
+};
+
+RegexpMatch.prototype.patternAsRegEx = function() {
+  return RegexpMatch.patternAsRegEx(this.pattern);
+};
+
+RegexpMatch.prototype.toString = function() {
+  return this.expression + " =~ " + this.patternAsRegEx();
+};
+
+RegexpMatch.prototype.assert = function() {
+  return statement("like(qr" + this.patternAsRegEx() + "," + this.expression + ")");
+};
+
+RegexpMatch.prototype.verify = function() {
+  return verify(this.assert());
+};
+
+RegexpNotMatch.prototype.patternAsRegEx = function() {
+  return RegexpMatch.patternAsRegEx(this.pattern);
+};
+
+RegexpNotMatch.prototype.toString = function() {
+  return this.expression + " !~ " + this.patternAsRegEx();
+};
+
+RegexpNotMatch.prototype.assert = function() {
+  return statement("unlike(qr" + this.patternAsRegEx() + "," + this.expression + ")");
+};
+
+RegexpNotMatch.prototype.verify = function() {
+  return verify(this.assert());
+};
+
+function waitFor(expression) {
+  if (expression.negative) {
+    return "for(0..60) { my $ret = 1; eval { $ret = (" + expression.invert().toString() + ") }; if($@ || !$ret) { break }; sleep 1 }"
+  } else {
+    return "!60.times{ break if (" + expression.toString() + " rescue false); sleep 1 }"
+  }
+}
+
+function assertOrVerifyFailure(line, isAssert) {
+  return "assert_raise(Kernel) { " + line + "}";
+}
+
+function pause(milliseconds) {
+  return "sleep " + (parseInt(milliseconds) / 1000);
+}
+
+function echo(message) {
+  return "note " + xlateArgument(message);
+}
+
+function formatComment(comment) {
+  return comment.comment.replace(/.+/mg, function(str) {
+    return "# " + str;
+  });
+}
+
+/**
+ * Returns a string representing the suite for this formatter language.
+ *
+ * @param testSuite  the suite to format
+ * @param filename   the file the formatted suite will be saved as
+ */
+function formatSuite(testSuite, filename) {
+  formattedSuite = 'require "spec/ruby"\n' +
+      'require "spec/runner"\n' +
+      '\n' +
+      "# output T/F as Green/Red\n" +
+      "ENV['RSPEC_COLOR'] = 'true'\n" +
+      '\n';
+
+  for (var i = 0; i < testSuite.tests.length; ++i) {
+    // have saved or loaded a suite
+    if (typeof testSuite.tests[i].filename != 'undefined') {
+      formattedSuite += 'require File.join(File.dirname(__FILE__),  "' + testSuite.tests[i].filename.replace(/\.\w+$/, '') + '")\n';
+    } else {
+      // didn't load / save as a suite
+      var testFile = testSuite.tests[i].getTitle();
+      formattedSuite += 'require "' + testFile + '"\n';
+    }
+  }
+  return formattedSuite;
+}
+
+this.options = {
+  receiver: "$driver",
+  rcHost: "localhost",
+  rcPort: "4444",
+  environment: "firefox",
+  showSelenese: 'false',
+  header:
+      "use strict;\n" +
+      "use warnings;\n" +
+      "use Selenium::Remote::Driver;\n" +
+      "use Test::More;\n" +
+      "\n" +
+      'my ${receiver} = Selenium::Remote::Driver->new( remote_server_addr => "${rcHost}",\n' +
+      '                                               port => ${rcPort},\n' +
+      '                                               browser_name => "${environment}");\n' +
+      "\n",
+  footer:
+      "$driver->quit();\n" +
+      "done_testing();\n",
+  indent: "0",
+  initialIndents: "0"
+};
+
+this.configForm =
+    '<description>Variable for Selenium instance</description>' +
+        '<textbox id="options_receiver" />' +
+        '<description>Selenium RC host</description>' +
+        '<textbox id="options_rcHost" />' +
+        '<description>Selenium RC port</description>' +
+        '<textbox id="options_rcPort" />' +
+        '<description>Environment</description>' +
+        '<textbox id="options_environment" />' +
+        '<description>Header</description>' +
+        '<textbox id="options_header" multiline="true" flex="1" rows="4"/>' +
+        '<description>Footer</description>' +
+        '<textbox id="options_footer" multiline="true" flex="1" rows="4"/>' +
+        '<description>Indent</description>' +
+        '<menulist id="options_indent"><menupopup>' +
+        '<menuitem label="Tab" value="tab"/>' +
+        '<menuitem label="1 space" value="1"/>' +
+        '<menuitem label="2 spaces" value="2"/>' +
+        '<menuitem label="3 spaces" value="3"/>' +
+        '<menuitem label="4 spaces" value="4"/>' +
+        '<menuitem label="5 spaces" value="5"/>' +
+        '<menuitem label="6 spaces" value="6"/>' +
+        '<menuitem label="7 spaces" value="7"/>' +
+        '<menuitem label="8 spaces" value="8"/>' +
+        '</menupopup></menulist>' +
+        '<checkbox id="options_showSelenese" label="Show Selenese"/>';
+
+this.name = "Perl Test::More(WebDriver)";
+this.testcaseExtension = ".t";
+this.suiteExtension = ".t";
+this.webdriver = true;
+
+WDAPI.Driver = function() {
+  this.ref = options.receiver;
+};
+
+WDAPI.Driver.searchContext = function(locatorType, locator) {
+  var locatorString = xlateArgument(locator).replace(/([@%$])/,"\\$1");
+  switch (locatorType) {
+    case 'xpath':
+      return locatorString + ', "xpath"';
+    case 'css':
+      return locatorString + ', "css"';
+    case 'id':
+      return locatorString + ', "id"';
+    case 'link':
+      return locatorString + ', "link"';
+    case 'name':
+      return locatorString + ', "name"';
+    case 'tag_name':
+      return locatorString + ', "tag_name"';
+  }
+  throw 'Error: unknown strategy [' + locatorType + '] for locator [' + locator + ']';
+};
+
+WDAPI.Driver.prototype.back = function() {
+  return this.ref + "->navigate->back";
+};
+
+WDAPI.Driver.prototype.close = function() {
+  return this.ref + "->close";
+};
+
+WDAPI.Driver.prototype.findElement = function(locatorType, locator) {
+  return new WDAPI.Element(this.ref + "->find_element(" + WDAPI.Driver.searchContext(locatorType, locator) + ")");
+};
+
+WDAPI.Driver.prototype.findElements = function(locatorType, locator) {
+  return new WDAPI.ElementList(this.ref + "->find_elements(" + WDAPI.Driver.searchContext(locatorType, locator) + ")");
+};
+
+WDAPI.Driver.prototype.getCurrentUrl = function() {
+  return this.ref + "->get_current_url";
+};
+
+WDAPI.Driver.prototype.get = function(url) {
+  return this.ref + "->get(" + url + ")";
+};
+
+WDAPI.Driver.prototype.getTitle = function() {
+  return this.ref + "->get_title";
+};
+
+WDAPI.Driver.prototype.refresh = function() {
+  return this.ref + "->refresh";
+};
+
+WDAPI.Driver.prototype.frame = function(locator) {
+  return this.ref + "->switch_to_frame(" + xlateArgument(locator) + ")";
+}
+
+WDAPI.Element = function(ref) {
+  this.ref = ref;
+};
+
+WDAPI.Element.prototype.clear = function() {
+  return this.ref + "->clear";
+};
+
+WDAPI.Element.prototype.click = function() {
+  return this.ref + "->click";
+};
+
+WDAPI.Element.prototype.getAttribute = function(attributeName) {
+  return this.ref + "->attribute(" + xlateArgument(attributeName) + ")";
+};
+
+WDAPI.Element.prototype.getText = function() {
+  return this.ref + "->get_text";
+};
+
+WDAPI.Element.prototype.isDisplayed = function() {
+  return this.ref + "->is_displayed";
+};
+
+WDAPI.Element.prototype.isSelected = function() {
+  return this.ref + "->is_selected";
+};
+
+WDAPI.Element.prototype.sendKeys = function(text) {
+  return this.ref + "->send_keys(" + xlateArgument(text) + ")";
+};
+
+WDAPI.Element.prototype.submit = function() {
+  return this.ref + "->submit";
+};
+
+WDAPI.ElementList = function(ref) {
+  this.ref = ref;
+};
+
+WDAPI.ElementList.prototype.getItem = function(index) {
+  return this.ref + "[" + index + "]";
+};
+
+WDAPI.ElementList.prototype.getSize = function() {
+  return this.ref + "->size";
+};
+
+WDAPI.ElementList.prototype.isEmpty = function() {
+  return this.ref + "->is_empty";
+};
+
+
+WDAPI.Utils = function() {
+};
+
+WDAPI.Utils.isElementPresent = function(how, what) {
+  return this.ref + "->is_element_present(" + xlateArgument(what) + ", \"" + how + "\")";
+};

+ 362 - 362
lib/Selenium/Remote/Commands.pm

@@ -1,362 +1,362 @@
-package Selenium::Remote::Commands;
-
-use strict;
-use warnings;
-
-sub new {
-    my $class = shift;
-    
-    # http://code.google.com/p/selenium/wiki/JsonWireProtocol
-    my $self = {
-        'status'     => {
-                          'method' => 'GET',
-                          'url'    => 'status'
-        },
-        'newSession' => {
-                          'method' => 'POST',
-                          'url'    => 'session'
-        },
-        'getSessions' => {
-                          'method' => 'GET',
-                          'url'    => 'sessions'
-        },
-        'getCapabilities' => {
-                          'method' => 'GET',
-                          'url'    => 'session/:sessionId'
-        },
-        'setTimeout' => {
-                        'method' => 'POST',
-                        'url'    => 'session/:sessionId/timeouts'
-        },
-        'setAsyncScriptTimeout' => {
-                        'method' => 'POST',
-                        'url'    => 'session/:sessionId/timeouts/async_script'
-        },
-        'setImplicitWaitTimeout' => {
-                        'method' => 'POST',
-                        'url'    => 'session/:sessionId/timeouts/implicit_wait'
-        },
-        'quit' => {
-                    'method' => 'DELETE',
-                    'url'    => "session/:sessionId"
-        },
-        'getCurrentWindowHandle' => {
-                 'method' => 'GET',
-                 'url' => "session/:sessionId/window_handle"
-        },
-        'getWindowHandles' => {
-                'method' => 'GET',
-                'url' => "session/:sessionId/window_handles"
-        },
-        'getWindowSize' => {
-                'method' => 'GET',
-                'url' => "session/:sessionId/window/:windowHandle/size"
-        },
-        'getWindowPosition' => {
-                'method' => 'GET',
-                'url' => "session/:sessionId/window/:windowHandle/position"
-        },
-        'setWindowSize' => {
-                'method' => 'POST',
-                'url' => "session/:sessionId/window/:windowHandle/size"
-        },
-        'setWindowPosition' => {
-                'method' => 'POST',
-                'url' => "session/:sessionId/window/:windowHandle/position"
-        },
-        'getCurrentUrl' => {
-                           'method' => 'GET',
-                           'url' => "session/:sessionId/url"
-        },
-        'get' => {
-                   'method' => 'POST',
-                   'url'    => "session/:sessionId/url"
-        },
-        'goForward' => {
-                       'method' => 'POST',
-                       'url' => "session/:sessionId/forward"
-        },
-        'goBack' => {
-                      'method' => 'POST',
-                      'url'    => "session/:sessionId/back"
-        },
-        'refresh' => {
-                       'method' => 'POST',
-                       'url' => "session/:sessionId/refresh"
-        },
-        'executeScript' => {
-                       'method' => 'POST',
-                       'url' => "session/:sessionId/execute"
-        },
-        'executeAsyncScript' => {
-                       'method' => 'POST',
-                       'url' => "session/:sessionId/execute_async"
-        },
-        'screenshot' => {
-                    'method' => 'GET',
-                    'url' => "session/:sessionId/screenshot"
-        },
-        'availableEngines' => {
-                    'method' => 'GET',
-                    'url' => "session/:sessionId/ime/available_engines"
-        },
-        'switchToFrame' => {
-                'method' => 'POST',
-                'url' => "session/:sessionId/frame"
-        },
-        'switchToWindow' => {
-             'method' => 'POST',
-             'url' => "session/:sessionId/window"
-        },
-        'getAllCookies' => {
-                        'method' => 'GET',
-                        'url' => "session/:sessionId/cookie"
-        },
-        'addCookie' => {
-                        'method' => 'POST',
-                        'url' => "session/:sessionId/cookie"
-        },
-        'deleteAllCookies' => {
-                        'method' => 'DELETE',
-                        'url' => "session/:sessionId/cookie"
-        },
-        'deleteCookieNamed' => {
-             'method' => 'DELETE',
-             'url' => "session/:sessionId/cookie/:name"
-        },
-        'getPageSource' => {
-                        'method' => 'GET',
-                        'url' => "session/:sessionId/source"
-        },
-        'getTitle' => {
-                        'method' => 'GET',
-                        'url' => "session/:sessionId/title"
-        },
-        'findElement' => {
-                       'method' => 'POST',
-                       'url' => "session/:sessionId/element"
-        },
-        'findElements' => {
-                      'method' => 'POST',
-                      'url' => "session/:sessionId/elements"
-        },
-        'getActiveElement' => {
-                'method' => 'POST',
-                'url' => "session/:sessionId/element/active"
-        },
-        'describeElement' => {
-                'method' => 'GET',
-                'url' => "session/:sessionId/element/:id"
-        },
-        'findChildElement' => {
-            'method' => 'POST',
-            'url' => "session/:sessionId/element/:id/element"
-        },
-        'findChildElements' => {
-            'method' => 'POST',
-            'url' => "session/:sessionId/element/:id/elements"
-        },
-        'clickElement' => {
-               'method' => 'POST',
-               'url' => "session/:sessionId/element/:id/click"
-        },
-        'submitElement' => {
-              'method' => 'POST',
-              'url' => "session/:sessionId/element/:id/submit"
-        },
-        'sendKeysToElement' => {
-               'method' => 'POST',
-               'url' => "session/:sessionId/element/:id/value"
-        },
-        'sendKeysToActiveElement' => {
-               'method' => 'POST',
-               'url' => "session/:sessionId/keys"
-        },
-        'sendModifier' => {
-               'method' => 'POST',
-               'url' => "session/:sessionId/modifier"
-        },
-        'isElementSelected' => {
-            'method' => 'GET',
-            'url' => "session/:sessionId/element/:id/selected"
-        },
-        'setElementSelected' => {
-            'method' => 'POST',
-            'url' => "session/:sessionId/element/:id/selected"
-        },
-        'toggleElement' => {
-              'method' => 'POST',
-              'url' => "session/:sessionId/element/:id/toggle"
-        },
-        'isElementEnabled' => {
-             'method' => 'GET',
-             'url' => "session/:sessionId/element/:id/enabled"
-        },
-        'getElementLocation' => {
-            'method' => 'GET',
-            'url' => "session/:sessionId/element/:id/location"
-        },
-        'getElementLocationInView' => {
-            'method' => 'GET',
-            'url' => "session/:sessionId/element/:id/location_in_view"
-        },
-        'getElementTagName' => {
-                'method' => 'GET',
-                'url' => "session/:sessionId/element/:id/name"
-        },
-        'clearElement' => {
-               'method' => 'POST',
-               'url' => "session/:sessionId/element/:id/clear"
-        },
-        'getElementAttribute' => {
-            'method' => 'GET',
-            'url' =>
-"session/:sessionId/element/:id/attribute/:name"
-        },
-        'elementEquals' => {
-            'method' => 'GET',
-            'url' => "session/:sessionId/element/:id/equals/:other"
-        },
-        'isElementDisplayed' => {
-            'method' => 'GET',
-            'url' => "session/:sessionId/element/:id/displayed"
-        },
-        'close' => {
-                     'method' => 'DELETE',
-                     'url'    => "session/:sessionId/window"
-        },
-        'dragElement' => {
-                'method' => 'POST',
-                'url' => "session/:sessionId/element/:id/drag"
-        },
-        'getElementSize' => {
-                'method' => 'GET',
-                'url' => "session/:sessionId/element/:id/size"
-        },
-        'getElementText' => {
-                'method' => 'GET',
-                'url' => "session/:sessionId/element/:id/text"
-        },
-        'getElementValueOfCssProperty' => {
-            'method' => 'GET',
-            'url' => "session/:sessionId/element/:id/css/:propertyName"
-        },
-        'hoverOverElement' => {
-               'method' => 'POST',
-               'url' => "session/:sessionId/element/:id/hover"
-        },
-        'mouseMoveToLocation' => {
-               'method' => 'POST',
-               'url' => "session/:sessionId/moveto"
-        },
-        'getAlertText' => {
-               'method' => 'GET',
-               'url'    => 'session/:sessionId/alert_text'
-        },
-        'sendKeysToPrompt' => {
-               'method' => 'POST',
-               'url'    => 'session/:sessionId/alert_text'
-        },
-        'acceptAlert' => {
-               'method' => 'POST',
-               'url'    => 'session/:sessionId/accept_alert'
-        },
-        'dismissAlert' => {
-               'method' => 'POST',
-               'url'    => 'session/:sessionId/dismiss_alert'
-        },
-        'click' => {
-               'method' => 'POST',
-               'url'    => 'session/:sessionId/click'
-        },
-        'doubleClick' => {
-               'method' => 'POST',
-               'url'    => 'session/:sessionId/doubleclick'
-        },
-        'buttonDown' => {
-               'method' => 'POST',
-               'url'    => 'session/:sessionId/buttondown'
-        },
-        'buttonUp' => {
-               'method' => 'POST',
-               'url'    => 'session/:sessionId/buttonup'
-        },
-        'uploadFile' => {
-               'method' => 'POST',
-               'url'    => 'session/:sessionId/file'
-        },
-        #'setVisible' => {
-        #               'method' => 'POST',
-        #               'url' => "session/:sessionId/visible"
-        #},
-        #'getVisible' => {
-        #               'method' => 'GET',
-        #               'url' => "session/:sessionId/visible"
-        #},
-    };
-
-    bless $self, $class or die "Can't bless $class: $!";
-    return $self;
-}
-
-# This method will replace the template & return
-sub get_params {
-    my ($self, $args) = @_;
-    if (!(defined $args->{'session_id'})) {
-        return;
-    }
-    my $data = {};
-    my $command = $args->{'command'};
-    my $url = $self->{$command}->{'url'};
-    
-    # Do the var substitutions.
-    $url =~ s/:sessionId/$args->{'session_id'}/;
-    $url =~ s/:id/$args->{'id'}/;
-    $url =~ s/:name/$args->{'name'}/;
-    $url =~ s/:propertyName/$args->{'property_name'}/;
-    $url =~ s/:other/$args->{'other'}/;
-    $url =~ s/:windowHandle/$args->{'window_handle'}/;
-
-    $data->{'method'} = $self->{$command}->{'method'};
-    $data->{'url'}    = $url;
-
-    return $data;
-}
-
-1;
-
-__END__
-
-=head1 SEE ALSO
-
-For more information about Selenium , visit the website at
-L<http://code.google.com/p/selenium/>.
-
-=head1 BUGS
-
-The Selenium issue tracking system is available online at
-L<http://github.com/aivaturi/Selenium-Remote-Driver/issues>.
-
-=head1 CURRENT MAINTAINER
-
-Gordon Child C<< <gchild@gordonchild.com> >>
-
-=head1 AUTHOR
-
-Perl Bindings for Selenium Remote Driver by Aditya Ivaturi C<< <ivaturi@gmail.com> >>
-
-=head1 LICENSE
-
-Copyright (c) 2010-2011 Aditya Ivaturi, Gordon Child
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-     http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
+package Selenium::Remote::Commands;
+
+use strict;
+use warnings;
+
+sub new {
+    my $class = shift;
+    
+    # http://code.google.com/p/selenium/wiki/JsonWireProtocol
+    my $self = {
+        'status'     => {
+                          'method' => 'GET',
+                          'url'    => 'status'
+        },
+        'newSession' => {
+                          'method' => 'POST',
+                          'url'    => 'session'
+        },
+        'getSessions' => {
+                          'method' => 'GET',
+                          'url'    => 'sessions'
+        },
+        'getCapabilities' => {
+                          'method' => 'GET',
+                          'url'    => 'session/:sessionId'
+        },
+        'setTimeout' => {
+                        'method' => 'POST',
+                        'url'    => 'session/:sessionId/timeouts'
+        },
+        'setAsyncScriptTimeout' => {
+                        'method' => 'POST',
+                        'url'    => 'session/:sessionId/timeouts/async_script'
+        },
+        'setImplicitWaitTimeout' => {
+                        'method' => 'POST',
+                        'url'    => 'session/:sessionId/timeouts/implicit_wait'
+        },
+        'quit' => {
+                    'method' => 'DELETE',
+                    'url'    => "session/:sessionId"
+        },
+        'getCurrentWindowHandle' => {
+                 'method' => 'GET',
+                 'url' => "session/:sessionId/window_handle"
+        },
+        'getWindowHandles' => {
+                'method' => 'GET',
+                'url' => "session/:sessionId/window_handles"
+        },
+        'getWindowSize' => {
+                'method' => 'GET',
+                'url' => "session/:sessionId/window/:windowHandle/size"
+        },
+        'getWindowPosition' => {
+                'method' => 'GET',
+                'url' => "session/:sessionId/window/:windowHandle/position"
+        },
+        'setWindowSize' => {
+                'method' => 'POST',
+                'url' => "session/:sessionId/window/:windowHandle/size"
+        },
+        'setWindowPosition' => {
+                'method' => 'POST',
+                'url' => "session/:sessionId/window/:windowHandle/position"
+        },
+        'getCurrentUrl' => {
+                           'method' => 'GET',
+                           'url' => "session/:sessionId/url"
+        },
+        'get' => {
+                   'method' => 'POST',
+                   'url'    => "session/:sessionId/url"
+        },
+        'goForward' => {
+                       'method' => 'POST',
+                       'url' => "session/:sessionId/forward"
+        },
+        'goBack' => {
+                      'method' => 'POST',
+                      'url'    => "session/:sessionId/back"
+        },
+        'refresh' => {
+                       'method' => 'POST',
+                       'url' => "session/:sessionId/refresh"
+        },
+        'executeScript' => {
+                       'method' => 'POST',
+                       'url' => "session/:sessionId/execute"
+        },
+        'executeAsyncScript' => {
+                       'method' => 'POST',
+                       'url' => "session/:sessionId/execute_async"
+        },
+        'screenshot' => {
+                    'method' => 'GET',
+                    'url' => "session/:sessionId/screenshot"
+        },
+        'availableEngines' => {
+                    'method' => 'GET',
+                    'url' => "session/:sessionId/ime/available_engines"
+        },
+        'switchToFrame' => {
+                'method' => 'POST',
+                'url' => "session/:sessionId/frame"
+        },
+        'switchToWindow' => {
+             'method' => 'POST',
+             'url' => "session/:sessionId/window"
+        },
+        'getAllCookies' => {
+                        'method' => 'GET',
+                        'url' => "session/:sessionId/cookie"
+        },
+        'addCookie' => {
+                        'method' => 'POST',
+                        'url' => "session/:sessionId/cookie"
+        },
+        'deleteAllCookies' => {
+                        'method' => 'DELETE',
+                        'url' => "session/:sessionId/cookie"
+        },
+        'deleteCookieNamed' => {
+             'method' => 'DELETE',
+             'url' => "session/:sessionId/cookie/:name"
+        },
+        'getPageSource' => {
+                        'method' => 'GET',
+                        'url' => "session/:sessionId/source"
+        },
+        'getTitle' => {
+                        'method' => 'GET',
+                        'url' => "session/:sessionId/title"
+        },
+        'findElement' => {
+                       'method' => 'POST',
+                       'url' => "session/:sessionId/element"
+        },
+        'findElements' => {
+                      'method' => 'POST',
+                      'url' => "session/:sessionId/elements"
+        },
+        'getActiveElement' => {
+                'method' => 'POST',
+                'url' => "session/:sessionId/element/active"
+        },
+        'describeElement' => {
+                'method' => 'GET',
+                'url' => "session/:sessionId/element/:id"
+        },
+        'findChildElement' => {
+            'method' => 'POST',
+            'url' => "session/:sessionId/element/:id/element"
+        },
+        'findChildElements' => {
+            'method' => 'POST',
+            'url' => "session/:sessionId/element/:id/elements"
+        },
+        'clickElement' => {
+               'method' => 'POST',
+               'url' => "session/:sessionId/element/:id/click"
+        },
+        'submitElement' => {
+              'method' => 'POST',
+              'url' => "session/:sessionId/element/:id/submit"
+        },
+        'sendKeysToElement' => {
+               'method' => 'POST',
+               'url' => "session/:sessionId/element/:id/value"
+        },
+        'sendKeysToActiveElement' => {
+               'method' => 'POST',
+               'url' => "session/:sessionId/keys"
+        },
+        'sendModifier' => {
+               'method' => 'POST',
+               'url' => "session/:sessionId/modifier"
+        },
+        'isElementSelected' => {
+            'method' => 'GET',
+            'url' => "session/:sessionId/element/:id/selected"
+        },
+        'setElementSelected' => {
+            'method' => 'POST',
+            'url' => "session/:sessionId/element/:id/selected"
+        },
+        'toggleElement' => {
+              'method' => 'POST',
+              'url' => "session/:sessionId/element/:id/toggle"
+        },
+        'isElementEnabled' => {
+             'method' => 'GET',
+             'url' => "session/:sessionId/element/:id/enabled"
+        },
+        'getElementLocation' => {
+            'method' => 'GET',
+            'url' => "session/:sessionId/element/:id/location"
+        },
+        'getElementLocationInView' => {
+            'method' => 'GET',
+            'url' => "session/:sessionId/element/:id/location_in_view"
+        },
+        'getElementTagName' => {
+                'method' => 'GET',
+                'url' => "session/:sessionId/element/:id/name"
+        },
+        'clearElement' => {
+               'method' => 'POST',
+               'url' => "session/:sessionId/element/:id/clear"
+        },
+        'getElementAttribute' => {
+            'method' => 'GET',
+            'url' =>
+"session/:sessionId/element/:id/attribute/:name"
+        },
+        'elementEquals' => {
+            'method' => 'GET',
+            'url' => "session/:sessionId/element/:id/equals/:other"
+        },
+        'isElementDisplayed' => {
+            'method' => 'GET',
+            'url' => "session/:sessionId/element/:id/displayed"
+        },
+        'close' => {
+                     'method' => 'DELETE',
+                     'url'    => "session/:sessionId/window"
+        },
+        'dragElement' => {
+                'method' => 'POST',
+                'url' => "session/:sessionId/element/:id/drag"
+        },
+        'getElementSize' => {
+                'method' => 'GET',
+                'url' => "session/:sessionId/element/:id/size"
+        },
+        'getElementText' => {
+                'method' => 'GET',
+                'url' => "session/:sessionId/element/:id/text"
+        },
+        'getElementValueOfCssProperty' => {
+            'method' => 'GET',
+            'url' => "session/:sessionId/element/:id/css/:propertyName"
+        },
+        'hoverOverElement' => {
+               'method' => 'POST',
+               'url' => "session/:sessionId/element/:id/hover"
+        },
+        'mouseMoveToLocation' => {
+               'method' => 'POST',
+               'url' => "session/:sessionId/moveto"
+        },
+        'getAlertText' => {
+               'method' => 'GET',
+               'url'    => 'session/:sessionId/alert_text'
+        },
+        'sendKeysToPrompt' => {
+               'method' => 'POST',
+               'url'    => 'session/:sessionId/alert_text'
+        },
+        'acceptAlert' => {
+               'method' => 'POST',
+               'url'    => 'session/:sessionId/accept_alert'
+        },
+        'dismissAlert' => {
+               'method' => 'POST',
+               'url'    => 'session/:sessionId/dismiss_alert'
+        },
+        'click' => {
+               'method' => 'POST',
+               'url'    => 'session/:sessionId/click'
+        },
+        'doubleClick' => {
+               'method' => 'POST',
+               'url'    => 'session/:sessionId/doubleclick'
+        },
+        'buttonDown' => {
+               'method' => 'POST',
+               'url'    => 'session/:sessionId/buttondown'
+        },
+        'buttonUp' => {
+               'method' => 'POST',
+               'url'    => 'session/:sessionId/buttonup'
+        },
+        'uploadFile' => {
+               'method' => 'POST',
+               'url'    => 'session/:sessionId/file'
+        },
+        #'setVisible' => {
+        #               'method' => 'POST',
+        #               'url' => "session/:sessionId/visible"
+        #},
+        #'getVisible' => {
+        #               'method' => 'GET',
+        #               'url' => "session/:sessionId/visible"
+        #},
+    };
+
+    bless $self, $class or die "Can't bless $class: $!";
+    return $self;
+}
+
+# This method will replace the template & return
+sub get_params {
+    my ($self, $args) = @_;
+    if (!(defined $args->{'session_id'})) {
+        return;
+    }
+    my $data = {};
+    my $command = $args->{'command'};
+    my $url = $self->{$command}->{'url'};
+    
+    # Do the var substitutions.
+    $url =~ s/:sessionId/$args->{'session_id'}/;
+    $url =~ s/:id/$args->{'id'}/;
+    $url =~ s/:name/$args->{'name'}/;
+    $url =~ s/:propertyName/$args->{'property_name'}/;
+    $url =~ s/:other/$args->{'other'}/;
+    $url =~ s/:windowHandle/$args->{'window_handle'}/;
+
+    $data->{'method'} = $self->{$command}->{'method'};
+    $data->{'url'}    = $url;
+
+    return $data;
+}
+
+1;
+
+__END__
+
+=head1 SEE ALSO
+
+For more information about Selenium , visit the website at
+L<http://code.google.com/p/selenium/>.
+
+=head1 BUGS
+
+The Selenium issue tracking system is available online at
+L<http://github.com/aivaturi/Selenium-Remote-Driver/issues>.
+
+=head1 CURRENT MAINTAINER
+
+Gordon Child C<< <gchild@gordonchild.com> >>
+
+=head1 AUTHOR
+
+Perl Bindings for Selenium Remote Driver by Aditya Ivaturi C<< <ivaturi@gmail.com> >>
+
+=head1 LICENSE
+
+Copyright (c) 2010-2011 Aditya Ivaturi, Gordon Child
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.

+ 166 - 166
lib/Selenium/Remote/RemoteConnection.pm

@@ -1,166 +1,166 @@
-package Selenium::Remote::RemoteConnection;
-
-use strict;
-use warnings;
-
-use LWP::UserAgent;
-use HTTP::Headers;
-use HTTP::Request;
-use Net::Ping;
-use Carp qw(croak);
-use JSON;
-use Data::Dumper;
-
-use Selenium::Remote::ErrorHandler;
-
-sub new {
-    my ($class, $remote_srvr, $port) = @_;
-    
-    my $self = {
-                 remote_server_addr => $remote_srvr,
-                 port               => $port,
-                 debug              => 0,
-    };
-    bless $self, $class or die "Can't bless $class: $!";
-    my $status = eval {$self->request('GET','status');};
-    croak "Could not connect to SeleniumWebDriver" if($@);
-    if($status->{cmd_status} ne 'OK') {
-        # Could be grid, see if we can talk to it
-        $status = undef;
-        $status = $self->request('GET', 'grid/api/testsession');
-    }
-    if($status->{cmd_status} eq 'OK') {
-        return $self;
-    } else {
-        croak "Selenium server did not return proper status";
-    }
-}
-
-# This request method is tailored for Selenium RC server
-sub request {
-    my ($self, $method, $url, $params) = @_;
-    my $content = '';
-    my $fullurl = '';
-
-    # Construct full url.
-    if ($url =~ m/^http/g) {
-        $fullurl = $url;
-    }
-    elsif ($url =~ m/grid/g) {
-        $fullurl =
-            "http://"
-          . $self->{remote_server_addr} . ":"
-          . $self->{port}
-          . "/$url";
-    }
-    else {
-        $fullurl =
-            "http://"
-          . $self->{remote_server_addr} . ":"
-          . $self->{port}
-          . "/wd/hub/$url";
-    }
-
-    if ((defined $params) && $params ne '') {
-        my $json = new JSON;
-        $json->allow_blessed;
-        $content = $json->allow_nonref->utf8->encode($params);
-    }
-    
-    print "REQ: $url, $content\n" if $self->{debug};
-
-    # HTTP request
-    my $ua = LWP::UserAgent->new;
-    my $header =
-      HTTP::Headers->new(Content_Type => 'application/json; charset=utf-8');
-    $header->header('Accept' => 'application/json');
-    my $request = HTTP::Request->new($method, $fullurl, $header, $content);
-    my $response = $ua->request($request);
-
-    return $self->_process_response($response);
-}
-
-sub _process_response {
-    my ($self, $response) = @_;
-    my $data; # server response 'value' that'll be returned to the user
-    my $json = new JSON;
-
-    if ($response->is_redirect) {
-        return $self->request('GET', $response->header('location'));
-    }
-    else {
-        my $decoded_json = undef;
-        print "RES: ".$response->decoded_content."\n\n" if $self->{debug};
-        if (($response->message ne 'No Content') && ($response->content ne '')) {
-            $decoded_json = $json->allow_nonref(1)->utf8(1)->decode($response->content);
-            $data->{'sessionId'} = $decoded_json->{'sessionId'};
-        }
-        
-        if ($response->is_error) {
-            my $error_handler = new Selenium::Remote::ErrorHandler;
-            $data->{'cmd_status'} = 'NOTOK';
-            if (defined $decoded_json) {
-                $data->{'cmd_return'} = $error_handler->process_error($decoded_json);
-            }
-            else {
-                $data->{'cmd_return'} = 'Server returned error code '.$response->code.' and no data';          
-            }
-            return $data;
-        }
-        elsif ($response->is_success) {
-            $data->{'cmd_status'} = 'OK';
-            if (defined $decoded_json) {
-                $data->{'cmd_return'} = $decoded_json->{'value'};
-            }
-            else {
-                $data->{'cmd_return'} = 'Server returned status code '.$response->code.' but no data';          
-            }
-            return $data;
-        }
-        else {
-            # No idea what the server is telling me, must be high
-            $data->{'cmd_status'} = 'NOTOK';
-            $data->{'cmd_return'} = 'Server returned status code '.$response->code.' which I don\'t understand';
-            return $data;
-        }
-    }
-}
-
-
-1;
-
-__END__
-
-=head1 SEE ALSO
-
-For more information about Selenium , visit the website at
-L<http://code.google.com/p/selenium/>.
-
-=head1 BUGS
-
-The Selenium issue tracking system is available online at
-L<http://github.com/aivaturi/Selenium-Remote-Driver/issues>.
-
-=head1 CURRENT MAINTAINER
-
-Gordon Child C<< <gchild@gordonchild.com> >>
-
-=head1 AUTHOR
-
-Perl Bindings for Selenium Remote Driver by Aditya Ivaturi C<< <ivaturi@gmail.com> >>
-
-=head1 LICENSE
-
-Copyright (c) 2010-2011 Aditya Ivaturi, Gordon Child
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-     http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
+package Selenium::Remote::RemoteConnection;
+
+use strict;
+use warnings;
+
+use LWP::UserAgent;
+use HTTP::Headers;
+use HTTP::Request;
+use Net::Ping;
+use Carp qw(croak);
+use JSON;
+use Data::Dumper;
+
+use Selenium::Remote::ErrorHandler;
+
+sub new {
+    my ($class, $remote_srvr, $port) = @_;
+    
+    my $self = {
+                 remote_server_addr => $remote_srvr,
+                 port               => $port,
+                 debug              => 0,
+    };
+    bless $self, $class or die "Can't bless $class: $!";
+    my $status = eval {$self->request('GET','status');};
+    croak "Could not connect to SeleniumWebDriver" if($@);
+    if($status->{cmd_status} ne 'OK') {
+        # Could be grid, see if we can talk to it
+        $status = undef;
+        $status = $self->request('GET', 'grid/api/testsession');
+    }
+    if($status->{cmd_status} eq 'OK') {
+        return $self;
+    } else {
+        croak "Selenium server did not return proper status";
+    }
+}
+
+# This request method is tailored for Selenium RC server
+sub request {
+    my ($self, $method, $url, $params) = @_;
+    my $content = '';
+    my $fullurl = '';
+
+    # Construct full url.
+    if ($url =~ m/^http/g) {
+        $fullurl = $url;
+    }
+    elsif ($url =~ m/grid/g) {
+        $fullurl =
+            "http://"
+          . $self->{remote_server_addr} . ":"
+          . $self->{port}
+          . "/$url";
+    }
+    else {
+        $fullurl =
+            "http://"
+          . $self->{remote_server_addr} . ":"
+          . $self->{port}
+          . "/wd/hub/$url";
+    }
+
+    if ((defined $params) && $params ne '') {
+        my $json = new JSON;
+        $json->allow_blessed;
+        $content = $json->allow_nonref->utf8->encode($params);
+    }
+    
+    print "REQ: $url, $content\n" if $self->{debug};
+
+    # HTTP request
+    my $ua = LWP::UserAgent->new;
+    my $header =
+      HTTP::Headers->new(Content_Type => 'application/json; charset=utf-8');
+    $header->header('Accept' => 'application/json');
+    my $request = HTTP::Request->new($method, $fullurl, $header, $content);
+    my $response = $ua->request($request);
+
+    return $self->_process_response($response);
+}
+
+sub _process_response {
+    my ($self, $response) = @_;
+    my $data; # server response 'value' that'll be returned to the user
+    my $json = new JSON;
+
+    if ($response->is_redirect) {
+        return $self->request('GET', $response->header('location'));
+    }
+    else {
+        my $decoded_json = undef;
+        print "RES: ".$response->decoded_content."\n\n" if $self->{debug};
+        if (($response->message ne 'No Content') && ($response->content ne '')) {
+            $decoded_json = $json->allow_nonref(1)->utf8(1)->decode($response->content);
+            $data->{'sessionId'} = $decoded_json->{'sessionId'};
+        }
+        
+        if ($response->is_error) {
+            my $error_handler = new Selenium::Remote::ErrorHandler;
+            $data->{'cmd_status'} = 'NOTOK';
+            if (defined $decoded_json) {
+                $data->{'cmd_return'} = $error_handler->process_error($decoded_json);
+            }
+            else {
+                $data->{'cmd_return'} = 'Server returned error code '.$response->code.' and no data';          
+            }
+            return $data;
+        }
+        elsif ($response->is_success) {
+            $data->{'cmd_status'} = 'OK';
+            if (defined $decoded_json) {
+                $data->{'cmd_return'} = $decoded_json->{'value'};
+            }
+            else {
+                $data->{'cmd_return'} = 'Server returned status code '.$response->code.' but no data';          
+            }
+            return $data;
+        }
+        else {
+            # No idea what the server is telling me, must be high
+            $data->{'cmd_status'} = 'NOTOK';
+            $data->{'cmd_return'} = 'Server returned status code '.$response->code.' which I don\'t understand';
+            return $data;
+        }
+    }
+}
+
+
+1;
+
+__END__
+
+=head1 SEE ALSO
+
+For more information about Selenium , visit the website at
+L<http://code.google.com/p/selenium/>.
+
+=head1 BUGS
+
+The Selenium issue tracking system is available online at
+L<http://github.com/aivaturi/Selenium-Remote-Driver/issues>.
+
+=head1 CURRENT MAINTAINER
+
+Gordon Child C<< <gchild@gordonchild.com> >>
+
+=head1 AUTHOR
+
+Perl Bindings for Selenium Remote Driver by Aditya Ivaturi C<< <ivaturi@gmail.com> >>
+
+=head1 LICENSE
+
+Copyright (c) 2010-2011 Aditya Ivaturi, Gordon Child
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.

+ 68 - 68
lib/Selenium/Remote/WDKeys.pm

@@ -1,69 +1,69 @@
-package Selenium::Remote::WDKeys;
-
-use strict;
-use warnings;
-
-use base 'Exporter';
-
-# http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/value
-use constant KEYS => {
-    'null'	 => "\N{U+E000}",
-    'cancel'	 => "\N{U+E001}",
-    'help'	 => "\N{U+E002}",
-    'backspace'	 => "\N{U+E003}",
-    'tab'	 => "\N{U+E004}",
-    'clear'	 => "\N{U+E005}",
-    'return'	 => "\N{U+E006}",
-    'enter'	 => "\N{U+E007}",
-    'shift'	 => "\N{U+E008}",
-    'control'	 => "\N{U+E009}",
-    'alt'	 => "\N{U+E00A}",
-    'pause'	 => "\N{U+E00B}",
-    'escape'	 => "\N{U+E00C}",
-    'space'	 => "\N{U+E00D}",
-    'page_up'	 => "\N{U+E00E}",
-    'page_down'	 => "\N{U+E00f}",
-    'end'	 => "\N{U+E010}",
-    'home'	 => "\N{U+E011}",
-    'left_arrow'	 => "\N{U+E012}",
-    'up_arrow'	 => "\N{U+E013}",
-    'right_arrow'	 => "\N{U+E014}",
-    'down_arrow'	 => "\N{U+E015}",
-    'insert'	 => "\N{U+E016}",
-    'delete'	 => "\N{U+E017}",
-    'semicolon'	 => "\N{U+E018}",
-    'equals'	 => "\N{U+E019}",
-    'numpad_0'	 => "\N{U+E01A}",
-    'numpad_1'	 => "\N{U+E01B}",
-    'numpad_2'	 => "\N{U+E01C}",
-    'numpad_3'	 => "\N{U+E01D}",
-    'numpad_4'	 => "\N{U+E01E}",
-    'numpad_5'	 => "\N{U+E01f}",
-    'numpad_6'	 => "\N{U+E020}",
-    'numpad_7'	 => "\N{U+E021}",
-    'numpad_8'	 => "\N{U+E022}",
-    'numpad_9'	 => "\N{U+E023}",
-    'multiply'	 => "\N{U+E024}",
-    'add'	 => "\N{U+E025}",
-    'separator'	 => "\N{U+E026}",
-    'subtract'	 => "\N{U+E027}",
-    'decimal'	 => "\N{U+E028}",
-    'divide'	 => "\N{U+E029}",
-    'f1'	 => "\N{U+E031}",
-    'f2'	 => "\N{U+E032}",
-    'f3'	 => "\N{U+E033}",
-    'f4'	 => "\N{U+E034}",
-    'f5'	 => "\N{U+E035}",
-    'f6'	 => "\N{U+E036}",
-    'f7'	 => "\N{U+E037}",
-    'f8'	 => "\N{U+E038}",
-    'f9'	 => "\N{U+E039}",
-    'f10'	 => "\N{U+E03A}",
-    'f11'	 => "\N{U+E03B}",
-    'f12'	 => "\N{U+E03C}",
-    'command_meta'  => "\N{U+E03D}",
-};
-
-our @EXPORT = ('KEYS');
-
+package Selenium::Remote::WDKeys;
+
+use strict;
+use warnings;
+
+use base 'Exporter';
+
+# http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/value
+use constant KEYS => {
+    'null'	 => "\N{U+E000}",
+    'cancel'	 => "\N{U+E001}",
+    'help'	 => "\N{U+E002}",
+    'backspace'	 => "\N{U+E003}",
+    'tab'	 => "\N{U+E004}",
+    'clear'	 => "\N{U+E005}",
+    'return'	 => "\N{U+E006}",
+    'enter'	 => "\N{U+E007}",
+    'shift'	 => "\N{U+E008}",
+    'control'	 => "\N{U+E009}",
+    'alt'	 => "\N{U+E00A}",
+    'pause'	 => "\N{U+E00B}",
+    'escape'	 => "\N{U+E00C}",
+    'space'	 => "\N{U+E00D}",
+    'page_up'	 => "\N{U+E00E}",
+    'page_down'	 => "\N{U+E00f}",
+    'end'	 => "\N{U+E010}",
+    'home'	 => "\N{U+E011}",
+    'left_arrow'	 => "\N{U+E012}",
+    'up_arrow'	 => "\N{U+E013}",
+    'right_arrow'	 => "\N{U+E014}",
+    'down_arrow'	 => "\N{U+E015}",
+    'insert'	 => "\N{U+E016}",
+    'delete'	 => "\N{U+E017}",
+    'semicolon'	 => "\N{U+E018}",
+    'equals'	 => "\N{U+E019}",
+    'numpad_0'	 => "\N{U+E01A}",
+    'numpad_1'	 => "\N{U+E01B}",
+    'numpad_2'	 => "\N{U+E01C}",
+    'numpad_3'	 => "\N{U+E01D}",
+    'numpad_4'	 => "\N{U+E01E}",
+    'numpad_5'	 => "\N{U+E01f}",
+    'numpad_6'	 => "\N{U+E020}",
+    'numpad_7'	 => "\N{U+E021}",
+    'numpad_8'	 => "\N{U+E022}",
+    'numpad_9'	 => "\N{U+E023}",
+    'multiply'	 => "\N{U+E024}",
+    'add'	 => "\N{U+E025}",
+    'separator'	 => "\N{U+E026}",
+    'subtract'	 => "\N{U+E027}",
+    'decimal'	 => "\N{U+E028}",
+    'divide'	 => "\N{U+E029}",
+    'f1'	 => "\N{U+E031}",
+    'f2'	 => "\N{U+E032}",
+    'f3'	 => "\N{U+E033}",
+    'f4'	 => "\N{U+E034}",
+    'f5'	 => "\N{U+E035}",
+    'f6'	 => "\N{U+E036}",
+    'f7'	 => "\N{U+E037}",
+    'f8'	 => "\N{U+E038}",
+    'f9'	 => "\N{U+E039}",
+    'f10'	 => "\N{U+E03A}",
+    'f11'	 => "\N{U+E03B}",
+    'f12'	 => "\N{U+E03C}",
+    'command_meta'  => "\N{U+E03D}",
+};
+
+our @EXPORT = ('KEYS');
+
 1;

+ 15 - 15
t/www/cookies.html

@@ -1,16 +1,16 @@
-<html>
-<head>
-    <title>Testing cookies</title>
-
-    <script type="text/javascript">
-        function setCookie(NameOfCookie, value, expiredays) {
-		var ExpireDate = new Date ();
-		ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
-
-		  document.cookie = NameOfCookie + "=" + escape(value) + 
-		  ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
-		}
-    </script>
-</head>
-<body onload="setCookie('foo1', 'bar1', 365); setCookie('foo2', 'bar2', 365);" />
+<html>
+<head>
+    <title>Testing cookies</title>
+
+    <script type="text/javascript">
+        function setCookie(NameOfCookie, value, expiredays) {
+		var ExpireDate = new Date ();
+		ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
+
+		  document.cookie = NameOfCookie + "=" + escape(value) + 
+		  ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
+		}
+    </script>
+</head>
+<body onload="setCookie('foo1', 'bar1', 365); setCookie('foo2', 'bar2', 365);" />
 </html>

+ 98 - 98
t/www/formPage.html

@@ -1,98 +1,98 @@
-<html>
-<head>
-    <title>We Leave From Here</title>
-
-    <script type="text/javascript">
-        function changePage() {
-            var newLocation = '/common/page/3';
-            window.location = newLocation;
-        }
-    </script>
-</head>
-<body>
-<a href="/index.html">Home Page Link</a><br/><br/>
-
-There should be a form here:
-
-<form method="get" action="resultPage.html" name="login">
-    <input type="submit" id="submitButton" value="Hello there"/>
-</form>
-
-<form method="get" action="resultPage.html" name="image">
-    <input type="image" id="imageButton" alt="click me!" src="images/button.gif"/>
-</form>
-
-<form method="get" action="resultPage.html" name="optional" style="display: block">
-    Here's a checkbox: <input type="checkbox" id="checky" name="checky" value="furrfu"/><br/>
-    <select name="selectomatic">
-        <option selected="selected">One</option>
-        <option>Two</option>
-        <option>Four</option>
-        <option>Still learning how to count, apparently</option>
-    </select>
-
-    <select name="multi" id="multi" multiple="multiple">
-        <option selected="selected">Eggs</option>
-        <option>Ham</option>
-        <option selected="selected">Sausages</option>
-        <option>Onion gravy</option>
-    </select>
-
-    <select name="no-select" disabled="disabled">
-      <option value="foo">Foo</option>
-    </select>
-
-    <br/>
-
-    <input type="radio" id="cheese" name="snack" value="cheese"/>Cheese<br/>
-    <input type="radio" id="peas" name="snack" value="peas"/>Peas<br/>
-    <input type="radio" id="cheese_and_peas" name="snack" value="cheese and peas" checked/>Cheese and peas<br/>
-    <input type="radio" id="nothing" name="snack" value="nowt" disabled="disabled"/>Not a sausage
-
-    <input type="hidden" name="hidden" value="fromage" />
-
-    <p id="cheeseLiker">I like cheese</p>
-    <input type="submit" value="Click!"/>
-</form>
-
-<form method="get" action="resultPage.html" name="disable">
-    <input type="text" id="working"/>
-    <input type="text" id="notWorking" disabled="true"/>
-
-    <textarea id="notWorkingArea" disabled="disabled" cols="5" rows="5"></textarea>
-
-    <textarea id="withText" rows="5" cols="5">Example text</textarea>
-    <textarea id="emptyTextArea" rows="5" cols="5"></textarea>
-</form>
-
-<form method="post" action="resultPage.html">
-    <select id="redirect" onchange="javascript:changePage();">
-        <option selected="selected">One</option>
-        <option id="changeme">Two</option>
-    </select>
-
-    <input id="no-type" />
-    <input type="file" id="upload" onchange="document.getElementById('fileResults').innerHTML = 'changed';" />
-    <span id="fileResults"></span>
-</form>
-
-<form method="get" action="resultPage.html">
-  <input type="text" value="name" name="id-name1"/>
-  <input type="text" value="id"   id="id-name1"/>
-
-  <!-- Reverse the ordering -->
-  <input type="text" value="id"   id="id-name2"/>
-  <input type="text" value="name" name="id-name2"/>
-  <input name="readonly" readonly="readonly" />
-</form>
-
-<!-- form with nested children -->
-<form method="get" action="resultPage.html" id="nested_form">
-  <div>
-    <input type="text" value="name" name="x"/>
-  </div>
-  <input type="submit" />
-</form>  
-
-</body>
-</html>
+<html>
+<head>
+    <title>We Leave From Here</title>
+
+    <script type="text/javascript">
+        function changePage() {
+            var newLocation = '/common/page/3';
+            window.location = newLocation;
+        }
+    </script>
+</head>
+<body>
+<a href="/index.html">Home Page Link</a><br/><br/>
+
+There should be a form here:
+
+<form method="get" action="resultPage.html" name="login">
+    <input type="submit" id="submitButton" value="Hello there"/>
+</form>
+
+<form method="get" action="resultPage.html" name="image">
+    <input type="image" id="imageButton" alt="click me!" src="images/button.gif"/>
+</form>
+
+<form method="get" action="resultPage.html" name="optional" style="display: block">
+    Here's a checkbox: <input type="checkbox" id="checky" name="checky" value="furrfu"/><br/>
+    <select name="selectomatic">
+        <option selected="selected">One</option>
+        <option>Two</option>
+        <option>Four</option>
+        <option>Still learning how to count, apparently</option>
+    </select>
+
+    <select name="multi" id="multi" multiple="multiple">
+        <option selected="selected">Eggs</option>
+        <option>Ham</option>
+        <option selected="selected">Sausages</option>
+        <option>Onion gravy</option>
+    </select>
+
+    <select name="no-select" disabled="disabled">
+      <option value="foo">Foo</option>
+    </select>
+
+    <br/>
+
+    <input type="radio" id="cheese" name="snack" value="cheese"/>Cheese<br/>
+    <input type="radio" id="peas" name="snack" value="peas"/>Peas<br/>
+    <input type="radio" id="cheese_and_peas" name="snack" value="cheese and peas" checked/>Cheese and peas<br/>
+    <input type="radio" id="nothing" name="snack" value="nowt" disabled="disabled"/>Not a sausage
+
+    <input type="hidden" name="hidden" value="fromage" />
+
+    <p id="cheeseLiker">I like cheese</p>
+    <input type="submit" value="Click!"/>
+</form>
+
+<form method="get" action="resultPage.html" name="disable">
+    <input type="text" id="working"/>
+    <input type="text" id="notWorking" disabled="true"/>
+
+    <textarea id="notWorkingArea" disabled="disabled" cols="5" rows="5"></textarea>
+
+    <textarea id="withText" rows="5" cols="5">Example text</textarea>
+    <textarea id="emptyTextArea" rows="5" cols="5"></textarea>
+</form>
+
+<form method="post" action="resultPage.html">
+    <select id="redirect" onchange="javascript:changePage();">
+        <option selected="selected">One</option>
+        <option id="changeme">Two</option>
+    </select>
+
+    <input id="no-type" />
+    <input type="file" id="upload" onchange="document.getElementById('fileResults').innerHTML = 'changed';" />
+    <span id="fileResults"></span>
+</form>
+
+<form method="get" action="resultPage.html">
+  <input type="text" value="name" name="id-name1"/>
+  <input type="text" value="id"   id="id-name1"/>
+
+  <!-- Reverse the ordering -->
+  <input type="text" value="id"   id="id-name2"/>
+  <input type="text" value="name" name="id-name2"/>
+  <input name="readonly" readonly="readonly" />
+</form>
+
+<!-- form with nested children -->
+<form method="get" action="resultPage.html" id="nested_form">
+  <div>
+    <input type="text" value="name" name="x"/>
+  </div>
+  <input type="submit" />
+</form>  
+
+</body>
+</html>

+ 253 - 253
t/www/javascriptPage.html

@@ -1,253 +1,253 @@
-<?xml version="1.0"?>
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-    <title>Testing Javascript</title>
-    <script type="text/javascript">
-        var seen = {};
-
-        function updateContent(input) {
-            document.getElementById('result').innerHTML = "<p>" + input.value + "</p>";
-        }
-
-        function displayMessage(message) {
-            document.getElementById('result').innerHTML = "<p>" + message + "</p>";
-        }
-
-        function appendMessage(message) {
-            document.getElementById('result').innerHTML += message + " ";
-        }
-
-        function register(message) {
-          if (!seen[message]) {
-            appendMessage(message);
-            seen[message] = true;
-          }
-        }
-
-        function delayedShowHide(delay, show) {
-          var blackBox = document.getElementById('clickToHide');
-          window.setTimeout(function() {
-            blackBox.style.display = show ? '' : 'none';
-          }, delay);
-        }
-    </script>
-    <script type="text/javascript">
-        var startList = function() {
-            // Ugh. Let's hope no-one is faking their user agent when running the tests
-            if (navigator.userAgent.indexOf("MSIE") != -1) {
-                var navRoot = document.getElementById("nav");
-                for (var i = 0; i < navRoot.childNodes.length; i++) {
-                    var node = navRoot.childNodes[i];
-                    if (node.nodeName == "LI") {
-                        node.onmouseover = function() {
-                            this.className += " over";
-                        };
-                        node.onmouseout = function() {
-                            this.className = this.className.replace(" over", "");
-                        };
-                    }
-                }
-            }
-        };
-        window.onload=startList;
-    </script>
-    <style type="text/css">
-        #nav {
-            padding: 0; margin: 0; list-style: none;
-        }
-        #nav li {
-            float: left; position: relative; width: 10em;
-        }
-        #nav li ul {
-            display: none; position: absolute; top: 1em; left: 0;
-        }
-        #nav li > ul { top: auto; left: auto; }
-        #nav li:hover ul, #nav li.over ul{ display: block; background: white; }
-    </style>
-</head>
-<body>
-<h1>Type Stuff</h1>
-
-<div>
-    <ul id="nav">
-        <li id="menu1">Menu 1
-            <ul>
-                <li id="item1" onclick="displayMessage('item 1');">Item 1</li>
-                <li>Item 2</li>
-            </ul>
-        </li>
-    </ul>
-</div>
-
-<div id="result">
-	&nbsp;
-</div>
-                                                                                         
-<div id="formageddon">
-    <form action="#">
-        Key Up: <input type="text" id="keyUp" onkeyup="javascript:updateContent(this)"/><br/>
-        Key Down: <input type="text" id="keyDown" onkeydown="javascript:updateContent(this)"/><br/>
-        Key Press: <input type="text" id="keyPress" onkeypress="javascript:updateContent(this)"/><br/>
-        Change: <input type="text" id="change" onkeypress="javascript:displayMessage('change')"/><br/>
-        <textarea id="keyDownArea" onkeydown="javascript:updateContent(this)" rows="2" cols="15"></textarea>
-        <textarea id="keyPressArea" onkeypress="javascript:updateContent(this)" rows="2" cols="15"></textarea>
-        <textarea id="keyUpArea" onkeyup="javascript:updateContent(this)" rows="2" cols="15"></textarea>
-        <select id="selector" onchange="javascript:updateContent(this)">
-            <option value="foo">Foo</option>
-            <option value="bar">Bar</option>
-        </select>
-        <input type="checkbox" id="checkbox" value="checkbox thing" onchange="javascript:updateContent(this)"/>
-        <input id="clickField" type="text" onclick="document.getElementById('clickField').value='Clicked';" value="Hello"/>
-        <input id="clearMe" value="Something" onchange="displayMessage('Cleared')"/>
-    </form>
-</div>
-
-<div>
-    <p><a href="#" onclick="javascript:document.title='Changed'">Change the page title!</a></p>
-
-    <p><a onclick="javascript:document.title='Changed'" id="nohref">No href</a></p>
-
-    <p><a id="updatediv" href="#" onclick="javascript:document.getElementById('dynamo').innerHTML = 'Fish and chips!';">Update a
-        div</a></p>
-</div>
-
-<div id="dynamo">What's for dinner?</div>
-
-<div id="mousedown" onmousedown="javascript:displayMessage('mouse down');">
-    <p>Click for the mouse down event</p>
-    <span><p id="child">Here's some text</p></span>
-</div>
-
-<div id="mouseup" onmouseup="javascript:displayMessage('mouse up');">
-    <p>Click for the mouse up event</p>
-</div>
-
-<div id="mouseclick" onclick="javascript:displayMessage('mouse click');">
-    <p>Click for the mouse click event</p>
-</div>
-
-<div id="error" onclick="document.getElementById('doesnotexist').innerHTML = 'cheese';">
-    Clicking this causes a JS exception in the click handler
-</div>
-
-<div>
-  <form action="resultPage.html" id="on-form">
-    <input id="theworks"
-           onfocus="appendMessage('focus')"
-           onkeydown="appendMessage('keydown')"
-           onkeypress="appendMessage('keypress')"
-           onkeyup="appendMessage('keyup')"
-           onblur="appendMessage('blur')"
-           onchange="appendMessage('change')"
-           />
-
-    <input id="changeable" name="changeable" onfocus="appendMessage('focus')" onchange="appendMessage('change')" onblur="appendMessage('blur')"/>
-           
-    <button type="button" id="plainButton" 
-    		onfocus="appendMessage('focus')"
-           	onkeydown="appendMessage('keydown')"
-           	onkeypress="appendMessage('keypress')"
-           	onkeyup="appendMessage('keyup')"
-           	onblur="appendMessage('blur')"
-           	onclick="appendMessage('click')"
-           	onmousedown="appendMessage('mousedown ')" 
-           	onmouseup="appendMessage('mouseup ')"
-            onmouseover="register('mouseover ')"
-            onmousemove="register('mousemove ')"
-    >
-        <b>Go somewhere</b>
-    </button>
-    <button type="submit" id="submittingButton"><emph>submit</emph></button>
-    <button type="button" id="jsSubmitButton" onclick="javascript:document.getElementById('on-form').submit();">Submitomatic</button>
-
-    <button type="button" id="switchFocus" onclick="document.getElementById('theworks').focus();">Switch focus</button>
-    <button type="button" onclick="var element = document.getElementById('switchFocus'); var clickEvent = document.createEvent('MouseEvents'); clickEvent.initMouseEvent('click', true, true, null, 0, 0, 0, 0, 0,false, false, false, false, 0, element);element.dispatchEvent(clickEvent);">Do magic</button>
-  </form>
-  
-  <form action="javascriptPage.html" id="submitListeningForm" onsubmit="appendMessage('form-onsubmit '); return false;">
-    <p>
-      <input id="submitListeningForm-text" type="text" onsubmit="appendMessage('text-onsubmit ')" onclick="appendMessage('text-onclick ');" />
-      <input id="submitListeningForm-submit" type="submit" onsubmit="appendMessage('submit-onsubmit ')" onclick="appendMessage('submit-onclick ');" />
-    </p>
-  </form>
-</div>
-
-<p id="suppressedParagraph" style="display: none">A paragraph suppressed using CSS display=none</p>
-
-<div>
-    <p id="displayed">Displayed</p>
-
-    <form action="#"><input type="hidden" name="hidden" /> </form>
-
-    <p id="none" style="display: none;">Display set to none</p>
-
-    <p id="hidden" style="visibility: hidden;">Hidden</p>
-
-    <div id="hiddenparent" style="height: 2em; display: none;">
-      <div id="hiddenchild">
-        <a href="#" id="hiddenlink">ok</a>
-      </div>
-    </div>
-    
-    <div style="visibility: hidden;">
-      <span>
-        <input id="unclickable" />
-        <input type="checkbox" id="untogglable" checked="checked" />Check box you can't see
-      </span>
-    </div>
-
-    <p id="outer" style="visibility: hidden">A <b id="visibleSubElement" style="visibility: visible">sub-element that is explicitly visible</b> using CSS visibility=visible</p>
-</div>
-
-<div>
-    <form>
-        <input type="text" id="keyReporter" size="80"
-               onkeyup="appendMessage('up: ' + event.keyCode)"
-               onkeypress="appendMessage('press: ' + event.keyCode)"
-               onkeydown="displayMessage(''); appendMessage('down: ' + event.keyCode)" />
-        <input name="suppress" onkeydown="if (event.preventDefault) event.preventDefault(); event.returnValue = false; return false;" onkeypress="appendMessage('press');"/>
-    </form>
-</div>
-
-<!-- Used for testing styles -->
-<div style="background-color: green;" id="green-parent">
-  <p id="style1">This should be greenish</p>
-    <ul>
-      <li id="green-item">So should this</li>
-      <li id="red-item" style="background-color: red;">But this is red</li>
-    </ul>
-</div>
-
-<p id="zeroheight" style="height:0px;">This is a foo</p>
-
-<p id="zerowidth" style="width:0;">This is a bar</p>
-
-<a href="#" id="close" onclick="window.close();">Close window</a>
-
-<div id="delete" onclick="var d = document.getElementById('deleted'); this.removeChild(d);">
-    <p id="deleted">I should be deleted when you click my containing div</p>
-    <p>Whereas, I should not</p>
-</div>
-
-<div>
-    <span id="hideMe" onclick="this.style.display = 'none';">Click to hide me.</span>
-</div>
-
-<div style="margin-top: 10px;">
-  Click actions delayed by 3000ms:
-  <div id="clickToShow" onclick="delayedShowHide(3000, true);"
-       style="float: left;width: 100px;height:100px;border: 1px solid black;">
-    Click to show black box
-  </div>
-  <div id="clickToHide" onclick="delayedShowHide(3000, false);"
-       style="float: left;width: 100px;height:100px;border: 1px solid black;
-              background-color: black; color: white; display: none;">
-    Click to hide black box
-  </div>
-  <div style="clear: both"></div>
-</div>
-
-</body>
-</html>
-
-
+<?xml version="1.0"?>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+    <title>Testing Javascript</title>
+    <script type="text/javascript">
+        var seen = {};
+
+        function updateContent(input) {
+            document.getElementById('result').innerHTML = "<p>" + input.value + "</p>";
+        }
+
+        function displayMessage(message) {
+            document.getElementById('result').innerHTML = "<p>" + message + "</p>";
+        }
+
+        function appendMessage(message) {
+            document.getElementById('result').innerHTML += message + " ";
+        }
+
+        function register(message) {
+          if (!seen[message]) {
+            appendMessage(message);
+            seen[message] = true;
+          }
+        }
+
+        function delayedShowHide(delay, show) {
+          var blackBox = document.getElementById('clickToHide');
+          window.setTimeout(function() {
+            blackBox.style.display = show ? '' : 'none';
+          }, delay);
+        }
+    </script>
+    <script type="text/javascript">
+        var startList = function() {
+            // Ugh. Let's hope no-one is faking their user agent when running the tests
+            if (navigator.userAgent.indexOf("MSIE") != -1) {
+                var navRoot = document.getElementById("nav");
+                for (var i = 0; i < navRoot.childNodes.length; i++) {
+                    var node = navRoot.childNodes[i];
+                    if (node.nodeName == "LI") {
+                        node.onmouseover = function() {
+                            this.className += " over";
+                        };
+                        node.onmouseout = function() {
+                            this.className = this.className.replace(" over", "");
+                        };
+                    }
+                }
+            }
+        };
+        window.onload=startList;
+    </script>
+    <style type="text/css">
+        #nav {
+            padding: 0; margin: 0; list-style: none;
+        }
+        #nav li {
+            float: left; position: relative; width: 10em;
+        }
+        #nav li ul {
+            display: none; position: absolute; top: 1em; left: 0;
+        }
+        #nav li > ul { top: auto; left: auto; }
+        #nav li:hover ul, #nav li.over ul{ display: block; background: white; }
+    </style>
+</head>
+<body>
+<h1>Type Stuff</h1>
+
+<div>
+    <ul id="nav">
+        <li id="menu1">Menu 1
+            <ul>
+                <li id="item1" onclick="displayMessage('item 1');">Item 1</li>
+                <li>Item 2</li>
+            </ul>
+        </li>
+    </ul>
+</div>
+
+<div id="result">
+	&nbsp;
+</div>
+                                                                                         
+<div id="formageddon">
+    <form action="#">
+        Key Up: <input type="text" id="keyUp" onkeyup="javascript:updateContent(this)"/><br/>
+        Key Down: <input type="text" id="keyDown" onkeydown="javascript:updateContent(this)"/><br/>
+        Key Press: <input type="text" id="keyPress" onkeypress="javascript:updateContent(this)"/><br/>
+        Change: <input type="text" id="change" onkeypress="javascript:displayMessage('change')"/><br/>
+        <textarea id="keyDownArea" onkeydown="javascript:updateContent(this)" rows="2" cols="15"></textarea>
+        <textarea id="keyPressArea" onkeypress="javascript:updateContent(this)" rows="2" cols="15"></textarea>
+        <textarea id="keyUpArea" onkeyup="javascript:updateContent(this)" rows="2" cols="15"></textarea>
+        <select id="selector" onchange="javascript:updateContent(this)">
+            <option value="foo">Foo</option>
+            <option value="bar">Bar</option>
+        </select>
+        <input type="checkbox" id="checkbox" value="checkbox thing" onchange="javascript:updateContent(this)"/>
+        <input id="clickField" type="text" onclick="document.getElementById('clickField').value='Clicked';" value="Hello"/>
+        <input id="clearMe" value="Something" onchange="displayMessage('Cleared')"/>
+    </form>
+</div>
+
+<div>
+    <p><a href="#" onclick="javascript:document.title='Changed'">Change the page title!</a></p>
+
+    <p><a onclick="javascript:document.title='Changed'" id="nohref">No href</a></p>
+
+    <p><a id="updatediv" href="#" onclick="javascript:document.getElementById('dynamo').innerHTML = 'Fish and chips!';">Update a
+        div</a></p>
+</div>
+
+<div id="dynamo">What's for dinner?</div>
+
+<div id="mousedown" onmousedown="javascript:displayMessage('mouse down');">
+    <p>Click for the mouse down event</p>
+    <span><p id="child">Here's some text</p></span>
+</div>
+
+<div id="mouseup" onmouseup="javascript:displayMessage('mouse up');">
+    <p>Click for the mouse up event</p>
+</div>
+
+<div id="mouseclick" onclick="javascript:displayMessage('mouse click');">
+    <p>Click for the mouse click event</p>
+</div>
+
+<div id="error" onclick="document.getElementById('doesnotexist').innerHTML = 'cheese';">
+    Clicking this causes a JS exception in the click handler
+</div>
+
+<div>
+  <form action="resultPage.html" id="on-form">
+    <input id="theworks"
+           onfocus="appendMessage('focus')"
+           onkeydown="appendMessage('keydown')"
+           onkeypress="appendMessage('keypress')"
+           onkeyup="appendMessage('keyup')"
+           onblur="appendMessage('blur')"
+           onchange="appendMessage('change')"
+           />
+
+    <input id="changeable" name="changeable" onfocus="appendMessage('focus')" onchange="appendMessage('change')" onblur="appendMessage('blur')"/>
+           
+    <button type="button" id="plainButton" 
+    		onfocus="appendMessage('focus')"
+           	onkeydown="appendMessage('keydown')"
+           	onkeypress="appendMessage('keypress')"
+           	onkeyup="appendMessage('keyup')"
+           	onblur="appendMessage('blur')"
+           	onclick="appendMessage('click')"
+           	onmousedown="appendMessage('mousedown ')" 
+           	onmouseup="appendMessage('mouseup ')"
+            onmouseover="register('mouseover ')"
+            onmousemove="register('mousemove ')"
+    >
+        <b>Go somewhere</b>
+    </button>
+    <button type="submit" id="submittingButton"><emph>submit</emph></button>
+    <button type="button" id="jsSubmitButton" onclick="javascript:document.getElementById('on-form').submit();">Submitomatic</button>
+
+    <button type="button" id="switchFocus" onclick="document.getElementById('theworks').focus();">Switch focus</button>
+    <button type="button" onclick="var element = document.getElementById('switchFocus'); var clickEvent = document.createEvent('MouseEvents'); clickEvent.initMouseEvent('click', true, true, null, 0, 0, 0, 0, 0,false, false, false, false, 0, element);element.dispatchEvent(clickEvent);">Do magic</button>
+  </form>
+  
+  <form action="javascriptPage.html" id="submitListeningForm" onsubmit="appendMessage('form-onsubmit '); return false;">
+    <p>
+      <input id="submitListeningForm-text" type="text" onsubmit="appendMessage('text-onsubmit ')" onclick="appendMessage('text-onclick ');" />
+      <input id="submitListeningForm-submit" type="submit" onsubmit="appendMessage('submit-onsubmit ')" onclick="appendMessage('submit-onclick ');" />
+    </p>
+  </form>
+</div>
+
+<p id="suppressedParagraph" style="display: none">A paragraph suppressed using CSS display=none</p>
+
+<div>
+    <p id="displayed">Displayed</p>
+
+    <form action="#"><input type="hidden" name="hidden" /> </form>
+
+    <p id="none" style="display: none;">Display set to none</p>
+
+    <p id="hidden" style="visibility: hidden;">Hidden</p>
+
+    <div id="hiddenparent" style="height: 2em; display: none;">
+      <div id="hiddenchild">
+        <a href="#" id="hiddenlink">ok</a>
+      </div>
+    </div>
+    
+    <div style="visibility: hidden;">
+      <span>
+        <input id="unclickable" />
+        <input type="checkbox" id="untogglable" checked="checked" />Check box you can't see
+      </span>
+    </div>
+
+    <p id="outer" style="visibility: hidden">A <b id="visibleSubElement" style="visibility: visible">sub-element that is explicitly visible</b> using CSS visibility=visible</p>
+</div>
+
+<div>
+    <form>
+        <input type="text" id="keyReporter" size="80"
+               onkeyup="appendMessage('up: ' + event.keyCode)"
+               onkeypress="appendMessage('press: ' + event.keyCode)"
+               onkeydown="displayMessage(''); appendMessage('down: ' + event.keyCode)" />
+        <input name="suppress" onkeydown="if (event.preventDefault) event.preventDefault(); event.returnValue = false; return false;" onkeypress="appendMessage('press');"/>
+    </form>
+</div>
+
+<!-- Used for testing styles -->
+<div style="background-color: green;" id="green-parent">
+  <p id="style1">This should be greenish</p>
+    <ul>
+      <li id="green-item">So should this</li>
+      <li id="red-item" style="background-color: red;">But this is red</li>
+    </ul>
+</div>
+
+<p id="zeroheight" style="height:0px;">This is a foo</p>
+
+<p id="zerowidth" style="width:0;">This is a bar</p>
+
+<a href="#" id="close" onclick="window.close();">Close window</a>
+
+<div id="delete" onclick="var d = document.getElementById('deleted'); this.removeChild(d);">
+    <p id="deleted">I should be deleted when you click my containing div</p>
+    <p>Whereas, I should not</p>
+</div>
+
+<div>
+    <span id="hideMe" onclick="this.style.display = 'none';">Click to hide me.</span>
+</div>
+
+<div style="margin-top: 10px;">
+  Click actions delayed by 3000ms:
+  <div id="clickToShow" onclick="delayedShowHide(3000, true);"
+       style="float: left;width: 100px;height:100px;border: 1px solid black;">
+    Click to show black box
+  </div>
+  <div id="clickToHide" onclick="delayedShowHide(3000, false);"
+       style="float: left;width: 100px;height:100px;border: 1px solid black;
+              background-color: black; color: white; display: none;">
+    Click to hide black box
+  </div>
+  <div style="clear: both"></div>
+</div>
+
+</body>
+</html>
+
+

+ 144 - 144
t/www/jquery-1.3.2.js

@@ -1266,150 +1266,150 @@ jQuery.each({
 function num(elem, prop) {
 	return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0;
 }
-var expando = "jQuery" + now(), uuid = 0, windowData = {};
-
-jQuery.extend({
-	cache: {},
-
-	data: function( elem, name, data ) {
-		elem = elem == window ?
-			windowData :
-			elem;
-
-		var id = elem[ expando ];
-
-		// Compute a unique ID for the element
-		if ( !id )
-			id = elem[ expando ] = ++uuid;
-
-		// Only generate the data cache if we're
-		// trying to access or manipulate it
-		if ( name && !jQuery.cache[ id ] )
-			jQuery.cache[ id ] = {};
-
-		// Prevent overriding the named cache with undefined values
-		if ( data !== undefined )
-			jQuery.cache[ id ][ name ] = data;
-
-		// Return the named cache data, or the ID for the element
-		return name ?
-			jQuery.cache[ id ][ name ] :
-			id;
-	},
-
-	removeData: function( elem, name ) {
-		elem = elem == window ?
-			windowData :
-			elem;
-
-		var id = elem[ expando ];
-
-		// If we want to remove a specific section of the element's data
-		if ( name ) {
-			if ( jQuery.cache[ id ] ) {
-				// Remove the section of cache data
-				delete jQuery.cache[ id ][ name ];
-
-				// If we've removed all the data, remove the element's cache
-				name = "";
-
-				for ( name in jQuery.cache[ id ] )
-					break;
-
-				if ( !name )
-					jQuery.removeData( elem );
-			}
-
-		// Otherwise, we want to remove all of the element's data
-		} else {
-			// Clean up the element expando
-			try {
-				delete elem[ expando ];
-			} catch(e){
-				// IE has trouble directly removing the expando
-				// but it's ok with using removeAttribute
-				if ( elem.removeAttribute )
-					elem.removeAttribute( expando );
-			}
-
-			// Completely remove the data cache
-			delete jQuery.cache[ id ];
-		}
-	},
-	queue: function( elem, type, data ) {
-		if ( elem ){
-	
-			type = (type || "fx") + "queue";
-	
-			var q = jQuery.data( elem, type );
-	
-			if ( !q || jQuery.isArray(data) )
-				q = jQuery.data( elem, type, jQuery.makeArray(data) );
-			else if( data )
-				q.push( data );
-	
-		}
-		return q;
-	},
-
-	dequeue: function( elem, type ){
-		var queue = jQuery.queue( elem, type ),
-			fn = queue.shift();
-		
-		if( !type || type === "fx" )
-			fn = queue[0];
-			
-		if( fn !== undefined )
-			fn.call(elem);
-	}
-});
-
-jQuery.fn.extend({
-	data: function( key, value ){
-		var parts = key.split(".");
-		parts[1] = parts[1] ? "." + parts[1] : "";
-
-		if ( value === undefined ) {
-			var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
-
-			if ( data === undefined && this.length )
-				data = jQuery.data( this[0], key );
-
-			return data === undefined && parts[1] ?
-				this.data( parts[0] ) :
-				data;
-		} else
-			return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){
-				jQuery.data( this, key, value );
-			});
-	},
-
-	removeData: function( key ){
-		return this.each(function(){
-			jQuery.removeData( this, key );
-		});
-	},
-	queue: function(type, data){
-		if ( typeof type !== "string" ) {
-			data = type;
-			type = "fx";
-		}
-
-		if ( data === undefined )
-			return jQuery.queue( this[0], type );
-
-		return this.each(function(){
-			var queue = jQuery.queue( this, type, data );
-			
-			 if( type == "fx" && queue.length == 1 )
-				queue[0].call(this);
-		});
-	},
-	dequeue: function(type){
-		return this.each(function(){
-			jQuery.dequeue( this, type );
-		});
-	}
+var expando = "jQuery" + now(), uuid = 0, windowData = {};
+
+jQuery.extend({
+	cache: {},
+
+	data: function( elem, name, data ) {
+		elem = elem == window ?
+			windowData :
+			elem;
+
+		var id = elem[ expando ];
+
+		// Compute a unique ID for the element
+		if ( !id )
+			id = elem[ expando ] = ++uuid;
+
+		// Only generate the data cache if we're
+		// trying to access or manipulate it
+		if ( name && !jQuery.cache[ id ] )
+			jQuery.cache[ id ] = {};
+
+		// Prevent overriding the named cache with undefined values
+		if ( data !== undefined )
+			jQuery.cache[ id ][ name ] = data;
+
+		// Return the named cache data, or the ID for the element
+		return name ?
+			jQuery.cache[ id ][ name ] :
+			id;
+	},
+
+	removeData: function( elem, name ) {
+		elem = elem == window ?
+			windowData :
+			elem;
+
+		var id = elem[ expando ];
+
+		// If we want to remove a specific section of the element's data
+		if ( name ) {
+			if ( jQuery.cache[ id ] ) {
+				// Remove the section of cache data
+				delete jQuery.cache[ id ][ name ];
+
+				// If we've removed all the data, remove the element's cache
+				name = "";
+
+				for ( name in jQuery.cache[ id ] )
+					break;
+
+				if ( !name )
+					jQuery.removeData( elem );
+			}
+
+		// Otherwise, we want to remove all of the element's data
+		} else {
+			// Clean up the element expando
+			try {
+				delete elem[ expando ];
+			} catch(e){
+				// IE has trouble directly removing the expando
+				// but it's ok with using removeAttribute
+				if ( elem.removeAttribute )
+					elem.removeAttribute( expando );
+			}
+
+			// Completely remove the data cache
+			delete jQuery.cache[ id ];
+		}
+	},
+	queue: function( elem, type, data ) {
+		if ( elem ){
+	
+			type = (type || "fx") + "queue";
+	
+			var q = jQuery.data( elem, type );
+	
+			if ( !q || jQuery.isArray(data) )
+				q = jQuery.data( elem, type, jQuery.makeArray(data) );
+			else if( data )
+				q.push( data );
+	
+		}
+		return q;
+	},
+
+	dequeue: function( elem, type ){
+		var queue = jQuery.queue( elem, type ),
+			fn = queue.shift();
+		
+		if( !type || type === "fx" )
+			fn = queue[0];
+			
+		if( fn !== undefined )
+			fn.call(elem);
+	}
+});
+
+jQuery.fn.extend({
+	data: function( key, value ){
+		var parts = key.split(".");
+		parts[1] = parts[1] ? "." + parts[1] : "";
+
+		if ( value === undefined ) {
+			var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
+
+			if ( data === undefined && this.length )
+				data = jQuery.data( this[0], key );
+
+			return data === undefined && parts[1] ?
+				this.data( parts[0] ) :
+				data;
+		} else
+			return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){
+				jQuery.data( this, key, value );
+			});
+	},
+
+	removeData: function( key ){
+		return this.each(function(){
+			jQuery.removeData( this, key );
+		});
+	},
+	queue: function(type, data){
+		if ( typeof type !== "string" ) {
+			data = type;
+			type = "fx";
+		}
+
+		if ( data === undefined )
+			return jQuery.queue( this[0], type );
+
+		return this.each(function(){
+			var queue = jQuery.queue( this, type, data );
+			
+			 if( type == "fx" && queue.length == 1 )
+				queue[0].call(this);
+		});
+	},
+	dequeue: function(type){
+		return this.each(function(){
+			jQuery.dequeue( this, type );
+		});
+	}
 });/*!
  * Sizzle CSS Selector Engine - v0.9.3
  *  Copyright 2009, The Dojo Foundation