Re: [widgets] Seeking comments on Last Call WD of Widgets: APIs and Events spec; deadline 15 Sept 2009

On Thu, Aug 20, 2009 at 11:16 AM, Marcos Caceres<marcosc@opera.com> wrote:
>> The lack of review should be obvious from the errors in nearly all the
>> examples: in 6.5.1 it uses made-up schemes without pointing that out in
>> any way,

They are not made up? - only feed does not have a spec!  Specs below:

//open email
http://tools.ietf.org/html/rfc2368

//make a phone call
http://tools.ietf.org/html/rfc3966

//open a web page
http://www.rfc-editor.org/rfc/rfc2616.txt

//send and sms
http://dret.net/netdret/docs/draft-wilde-sms-uri-18.html

//SSH
http://tools.ietf.org/html/draft-ietf-secsh-scp-sftp-ssh-uri-04

//feed
I've removed feed, but still hold that is is valid even though it is
not standardized.

>  6.4.2 invokes a .forEach method on a NodeList that a NodeList
>> is not defined to have,

Yep, Robin's code was no good. I rewrote it (and tested it in FF using
window.localStorage to make sure it works):

<!doctype html>
...
<fieldset id="prefs-form">
  <legend>Game Options</legend>
  <label>Volume:  <input type="range" min="0" max="100"
name="volume"/> </label>
  <label>Difficulty:  <input type="range" min="0" max="100"
name="difficulty"/> </label>
  <input type="button" value="Save" onClick="savePrefs()"/>
</fieldset>
...

<script>
var form   = document.getElementById("prefs-form");
var fields = form.querySelectorAll("input[type='range']");

function loadPrefs () {
   for(i in fields){
      var field = fields[i];
      if (typeof widget.preferences[field.name] != "undefined") {
        field.value = widget.preferences[field.name];
      }
   }
}

function savePrefs () {
  for(var i = 0; i < fields.length; i++){
      var field = fields[i];
      widget.preferences[field.name] = field.value;
  }
}
</script>

>  in 6.4.1 the JSON code is malformed due to usage
>> of the wrong quote marks,

Ok, got me there! :) I didn't know you were not allowed to use single
quotes in JSON.

> and 6.1.1 fails to escape the markup it
>> attempts to insert, leading to undesired effects if special characters
>> are used in the values.

Ok, can you help us out with some good text to use here? How do you
recommend we secure this bit?

Kind regards,
Marcos

-- 
Marcos Caceres
http://datadriven.com.au

Received on Thursday, 20 August 2009 19:41:49 UTC