W3C home > Mailing lists > Public > public-html@w3.org > January 2010

Re: spec verbosity and algorithms

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Fri, 22 Jan 2010 22:37:40 -0600
Message-ID: <dd0fbad1001222037h25f1334emfa54be5bfccba702@mail.gmail.com>
To: Karl Dubost <karl@la-grange.net>
Cc: Julian Reschke <julian.reschke@gmx.de>, "public-html@w3.org" <public-html@w3.org>
On Fri, Jan 22, 2010 at 10:28 PM, Karl Dubost <karl@la-grange.net> wrote:
> [23:24]  <TabAtkins> karlcow: Yeah, it's wrong.  The opaque-identifier portion should completely separate from the same-components section.  If they're opaque, they don't *have* components.
> [23:25]  <karlcow> TabAtkins: ah. I'll modify. It is not clear in the prose of the spec I have the feeling.
> [23:25]  * karlcow likes to visualize to understand
> [23:26]  <TabAtkins> If you translate it from prose directly to if/then code in your favorite programming language, it becomes very clear.  ^_^

function sameOriginP(A,B) {
  if(opaque(A) && opaque(B) && A.value == B.value) {
    return true;}
  if(opaque(A) || opaque(B)) {
    return false;}
  if(A.scheme != B.scheme || A.host != B.host || A.port != B.port) {
    return false;}
  for(key in A.extraData) {
    if(A.extraData[key] != B.extraData[key]) {
      return false;}}
  for(key in B.extraData) {
    //have to do it both ways with this method, in case B has some
extra data that A doesn't.
    //there are probably better ways to handle this
    if(A.extraData[key] != B.extraData[key]) {
      return false;}}
  return true;
}

~TJ
Received on Saturday, 23 January 2010 04:38:28 UTC

This archive was generated by hypermail 2.4.0 : Saturday, 9 October 2021 18:45:08 UTC