Define behavior for too few execCommand() args
authorAryeh Gregor <AryehGregor+gitcommit@gmail.com>
Wed, 29 Jun 2011 14:50:14 -0600
changeset 353 2e4a02cf573b
parent 352 f5af9c0dc81c
child 354 c0ea111708e5
Define behavior for too few execCommand() args
editcommands.html
implementation.js
source.html
--- a/editcommands.html	Wed Jun 29 14:43:51 2011 -0600
+++ b/editcommands.html	Wed Jun 29 14:50:14 2011 -0600
@@ -485,6 +485,11 @@
 must run the following steps:
 
 <ol>
+  <li>If only one argument was provided, let <var title="">show UI</var> be false.
+
+  <li>If only one or two arguments were provided, let <var title="">value</var> be the
+  empty string.
+
   <li>If <var title="">command</var> is not <a href=#supported>supported</a>, raise a
   <code class=external data-anolis-spec=domcore title=dom-DOMException-NOT_SUPPORTED_ERR><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-domexception-not_supported_err>NOT_SUPPORTED_ERR</a></code> exception.
 
--- a/implementation.js	Wed Jun 29 14:43:51 2011 -0600
+++ b/implementation.js	Wed Jun 29 14:50:14 2011 -0600
@@ -530,6 +530,22 @@
 	// case-insensitively."
 	command = command.toLowerCase();
 
+	// "If only one argument was provided, let show UI be false."
+	//
+	// If range was passed, I can't actually detect how many args were passed
+	// . . .
+	if (arguments.length == 1
+	|| (arguments.length >=4 && typeof showUi == "undefined")) {
+		showUi = false;
+	}
+
+	// "If only one or two arguments were provided, let value be the empty
+	// string."
+	if (arguments.length <= 2
+	|| (arguments.length >=4 && typeof value == "undefined")) {
+		value = "";
+	}
+
 	// "If command is not supported, raise a NOT_SUPPORTED_ERR exception."
 	//
 	// "If command has no action, raise an INVALID_ACCESS_ERR exception."
--- a/source.html	Wed Jun 29 14:43:51 2011 -0600
+++ b/source.html	Wed Jun 29 14:50:14 2011 -0600
@@ -424,6 +424,11 @@
 must run the following steps:
 
 <ol>
+  <li>If only one argument was provided, let <var>show UI</var> be false.
+
+  <li>If only one or two arguments were provided, let <var>value</var> be the
+  empty string.
+
   <li>If <var>command</var> is not <span>supported</span>, raise a
   [[NOT_SUPPORTED_ERR]] exception.