diff options
Diffstat (limited to 'contexts/data/lib/closure-library/third_party/closure')
87 files changed, 54 insertions, 10030 deletions
diff --git a/contexts/data/lib/closure-library/third_party/closure/.svn/all-wcprops b/contexts/data/lib/closure-library/third_party/closure/.svn/all-wcprops deleted file mode 100644 index 9532daf..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 44 -/svn/!svn/ver/1472/trunk/third_party/closure -END diff --git a/contexts/data/lib/closure-library/third_party/closure/.svn/entries b/contexts/data/lib/closure-library/third_party/closure/.svn/entries deleted file mode 100644 index 333b2d8..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -1494 -http://closure-library.googlecode.com/svn/trunk/third_party/closure -http://closure-library.googlecode.com/svn - - - -2011-12-13T22:20:28.000000Z -1472 -ccalabro@google.com - - - - - - - - - - - - - - -0b95b8e8-c90f-11de-9d4f-f947ee5921c8 - -goog -dir - diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/.svn/all-wcprops b/contexts/data/lib/closure-library/third_party/closure/goog/.svn/all-wcprops deleted file mode 100644 index 2083858..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/.svn/all-wcprops +++ /dev/null @@ -1,17 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 49 -/svn/!svn/ver/1472/trunk/third_party/closure/goog -END -base.js -K 25 -svn:wc:ra_dav:version-url -V 56 -/svn/!svn/ver/850/trunk/third_party/closure/goog/base.js -END -deps.js -K 25 -svn:wc:ra_dav:version-url -V 57 -/svn/!svn/ver/1434/trunk/third_party/closure/goog/deps.js -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/.svn/entries b/contexts/data/lib/closure-library/third_party/closure/goog/.svn/entries deleted file mode 100644 index 845aacd..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/.svn/entries +++ /dev/null @@ -1,117 +0,0 @@ -10 - -dir -1494 -http://closure-library.googlecode.com/svn/trunk/third_party/closure/goog -http://closure-library.googlecode.com/svn - - - -2011-12-13T22:20:28.000000Z -1472 -ccalabro@google.com - - - - - - - - - - - - - - -0b95b8e8-c90f-11de-9d4f-f947ee5921c8 - -jpeg_encoder -dir - -base.js -file - - - - -2011-12-23T22:42:21.837247Z -af34d867efff2238d2c73747f1385fc6 -2011-04-12T20:35:47.000000Z -850 -diegosalas@google.com -has-props - - - - - - - - - - - - - - - - - - - - -101 - -deps.js -file - - - - -2011-12-23T22:42:21.837247Z -a03423cddc943ee7ed55c12d0e7a76ac -2011-11-30T22:16:21.000000Z -1434 -chrishenry@google.com -has-props - - - - - - - - - - - - - - - - - - - - -820 - -mochikit -dir - -dojo -dir - -osapi -dir - -loremipsum -dir - -silverlight -dir - -caja -dir - diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/.svn/prop-base/base.js.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/.svn/prop-base/base.js.svn-base deleted file mode 100644 index 7febff5..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/.svn/prop-base/base.js.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 22 -application/javascript -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/.svn/prop-base/deps.js.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/.svn/prop-base/deps.js.svn-base deleted file mode 100644 index 530636b..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/.svn/prop-base/deps.js.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 15 -text/javascript -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/.svn/text-base/base.js.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/.svn/text-base/base.js.svn-base deleted file mode 100644 index c889043..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/.svn/text-base/base.js.svn-base +++ /dev/null @@ -1,2 +0,0 @@ -// This is a dummy file to trick genjsdeps into doing the right thing. -// TODO(nicksantos): fix this diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/.svn/text-base/deps.js.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/.svn/text-base/deps.js.svn-base deleted file mode 100644 index 46e6762..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/.svn/text-base/deps.js.svn-base +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2010 The Closure Library Authors. All Rights Reserved. -// -// 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. - - -/** - * @deprecated This file is deprecated. The contents have been - * migrated to the main deps.js instead (which is auto-included by - * base.js). Please do not add new dependency here. - */ diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/caja/.svn/all-wcprops b/contexts/data/lib/closure-library/third_party/closure/goog/caja/.svn/all-wcprops deleted file mode 100644 index ef11622..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/caja/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 53 -/svn/!svn/ver/850/trunk/third_party/closure/goog/caja -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/caja/.svn/entries b/contexts/data/lib/closure-library/third_party/closure/goog/caja/.svn/entries deleted file mode 100644 index 14fb77d..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/caja/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -1494 -http://closure-library.googlecode.com/svn/trunk/third_party/closure/goog/caja -http://closure-library.googlecode.com/svn - - - -2011-04-12T20:35:47.000000Z -850 -diegosalas@google.com - - - - - - - - - - - - - - -0b95b8e8-c90f-11de-9d4f-f947ee5921c8 - -string -dir - diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/caja/string/.svn/all-wcprops b/contexts/data/lib/closure-library/third_party/closure/goog/caja/string/.svn/all-wcprops deleted file mode 100644 index 139d608..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/caja/string/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 60 -/svn/!svn/ver/850/trunk/third_party/closure/goog/caja/string -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/caja/string/.svn/entries b/contexts/data/lib/closure-library/third_party/closure/goog/caja/string/.svn/entries deleted file mode 100644 index 6e4c60f..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/caja/string/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -1494 -http://closure-library.googlecode.com/svn/trunk/third_party/closure/goog/caja/string -http://closure-library.googlecode.com/svn - - - -2011-04-12T20:35:47.000000Z -850 -diegosalas@google.com - - - - - - - - - - - - - - -0b95b8e8-c90f-11de-9d4f-f947ee5921c8 - -html -dir - diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/caja/string/html/.svn/all-wcprops b/contexts/data/lib/closure-library/third_party/closure/goog/caja/string/html/.svn/all-wcprops deleted file mode 100644 index 22d6301..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/caja/string/html/.svn/all-wcprops +++ /dev/null @@ -1,17 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 65 -/svn/!svn/ver/850/trunk/third_party/closure/goog/caja/string/html -END -htmlsanitizer.js -K 25 -svn:wc:ra_dav:version-url -V 82 -/svn/!svn/ver/850/trunk/third_party/closure/goog/caja/string/html/htmlsanitizer.js -END -htmlparser.js -K 25 -svn:wc:ra_dav:version-url -V 79 -/svn/!svn/ver/850/trunk/third_party/closure/goog/caja/string/html/htmlparser.js -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/caja/string/html/.svn/entries b/contexts/data/lib/closure-library/third_party/closure/goog/caja/string/html/.svn/entries deleted file mode 100644 index e9c6fe8..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/caja/string/html/.svn/entries +++ /dev/null @@ -1,96 +0,0 @@ -10 - -dir -1494 -http://closure-library.googlecode.com/svn/trunk/third_party/closure/goog/caja/string/html -http://closure-library.googlecode.com/svn - - - -2011-04-12T20:35:47.000000Z -850 -diegosalas@google.com - - - - - - - - - - - - - - -0b95b8e8-c90f-11de-9d4f-f947ee5921c8 - -htmlsanitizer.js -file - - - - -2011-12-23T22:42:21.833247Z -5745bb0b8b4a224fd67b580bb05e33af -2011-04-12T20:35:47.000000Z -850 -diegosalas@google.com -has-props - - - - - - - - - - - - - - - - - - - - -19311 - -htmlparser.js -file - - - - -2011-12-23T22:42:21.833247Z -68d2deefe2a1eab14d4a18418931e8d6 -2011-04-12T20:35:47.000000Z -850 -diegosalas@google.com -has-props - - - - - - - - - - - - - - - - - - - - -18569 - diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/caja/string/html/.svn/prop-base/htmlparser.js.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/caja/string/html/.svn/prop-base/htmlparser.js.svn-base deleted file mode 100644 index 7febff5..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/caja/string/html/.svn/prop-base/htmlparser.js.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 22 -application/javascript -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/caja/string/html/.svn/prop-base/htmlsanitizer.js.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/caja/string/html/.svn/prop-base/htmlsanitizer.js.svn-base deleted file mode 100644 index 7febff5..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/caja/string/html/.svn/prop-base/htmlsanitizer.js.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 22 -application/javascript -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/caja/string/html/.svn/text-base/htmlparser.js.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/caja/string/html/.svn/text-base/htmlparser.js.svn-base deleted file mode 100644 index d241d4b..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/caja/string/html/.svn/text-base/htmlparser.js.svn-base +++ /dev/null @@ -1,611 +0,0 @@ -// Copyright 2006-2008, The Google Caja project. -// Modifications Copyright 2009 The Closure Library Authors. All Rights Reserved. -// All Rights Reserved - -/** - * @license Portions of this code are from the google-caja project, received by - * Google under the Apache license (http://code.google.com/p/google-caja/). - * All other code is Copyright 2009 Google, Inc. All Rights Reserved. - -// Copyright (C) 2006 Google Inc. -// -// 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. - - */ - -/** - * @fileoverview A Html SAX parser. - * - * Examples of usage of the {@code goog.string.html.HtmlParser}: - * <pre> - * var handler = new MyCustomHtmlVisitorHandlerThatExtendsHtmlSaxHandler(); - * var parser = new goog.string.html.HtmlParser(); - * parser.parse(handler, '<html><a href="google.com">link found!</a></html>'); - * </pre> - * - * TODO(user, msamuel): validate sanitizer regex against the HTML5 grammar at - * http://www.whatwg.org/specs/web-apps/current-work/multipage/syntax.html - * http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html - * http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html - * http://www.whatwg.org/specs/web-apps/current-work/multipage/tree-construction.html - * - * @supported IE6, IE7, IE8, FF1.5, FF2, FF3, Chrome 3.0, Safari and Opera 10. - */ - -goog.provide('goog.string.html.HtmlParser'); -goog.provide('goog.string.html.HtmlParser.EFlags'); -goog.provide('goog.string.html.HtmlParser.Elements'); -goog.provide('goog.string.html.HtmlParser.Entities'); -goog.provide('goog.string.html.HtmlSaxHandler'); - - -/** - * An Html parser: {@code parse} takes a string and calls methods on - * {@code goog.string.html.HtmlSaxHandler} while it is visiting it. - * - * @constructor - */ -goog.string.html.HtmlParser = function() { -}; - - -/** - * HTML entities that are encoded/decoded. - * TODO(user): use {@code goog.string.htmlEncode} instead. - * @enum {string} - */ -goog.string.html.HtmlParser.Entities = { - lt: '<', - gt: '>', - amp: '&', - nbsp: '\240', - quot: '"', - apos: '\'' -}; - - -/** - * The html eflags, used internally on the parser. - * @enum {number} - */ -goog.string.html.HtmlParser.EFlags = { - OPTIONAL_ENDTAG: 1, - EMPTY: 2, - CDATA: 4, - RCDATA: 8, - UNSAFE: 16, - FOLDABLE: 32 -}; - - -/** - * A map of element to a bitmap of flags it has, used internally on the parser. - * @type {Object} - */ -goog.string.html.HtmlParser.Elements = { - 'a': 0, - 'abbr': 0, - 'acronym': 0, - 'address': 0, - 'applet': goog.string.html.HtmlParser.EFlags.UNSAFE, - 'area': goog.string.html.HtmlParser.EFlags.EMPTY, - 'b': 0, - 'base': goog.string.html.HtmlParser.EFlags.EMPTY | - goog.string.html.HtmlParser.EFlags.UNSAFE, - 'basefont': goog.string.html.HtmlParser.EFlags.EMPTY | - goog.string.html.HtmlParser.EFlags.UNSAFE, - 'bdo': 0, - 'big': 0, - 'blockquote': 0, - 'body': goog.string.html.HtmlParser.EFlags.OPTIONAL_ENDTAG | - goog.string.html.HtmlParser.EFlags.UNSAFE | - goog.string.html.HtmlParser.EFlags.FOLDABLE, - 'br': goog.string.html.HtmlParser.EFlags.EMPTY, - 'button': 0, - 'caption': 0, - 'center': 0, - 'cite': 0, - 'code': 0, - 'col': goog.string.html.HtmlParser.EFlags.EMPTY, - 'colgroup': goog.string.html.HtmlParser.EFlags.OPTIONAL_ENDTAG, - 'dd': goog.string.html.HtmlParser.EFlags.OPTIONAL_ENDTAG, - 'del': 0, - 'dfn': 0, - 'dir': 0, - 'div': 0, - 'dl': 0, - 'dt': goog.string.html.HtmlParser.EFlags.OPTIONAL_ENDTAG, - 'em': 0, - 'fieldset': 0, - 'font': 0, - 'form': 0, - 'frame': goog.string.html.HtmlParser.EFlags.EMPTY | - goog.string.html.HtmlParser.EFlags.UNSAFE, - 'frameset': goog.string.html.HtmlParser.EFlags.UNSAFE, - 'h1': 0, - 'h2': 0, - 'h3': 0, - 'h4': 0, - 'h5': 0, - 'h6': 0, - 'head': goog.string.html.HtmlParser.EFlags.OPTIONAL_ENDTAG | - goog.string.html.HtmlParser.EFlags.UNSAFE | - goog.string.html.HtmlParser.EFlags.FOLDABLE, - 'hr': goog.string.html.HtmlParser.EFlags.EMPTY, - 'html': goog.string.html.HtmlParser.EFlags.OPTIONAL_ENDTAG | - goog.string.html.HtmlParser.EFlags.UNSAFE | - goog.string.html.HtmlParser.EFlags.FOLDABLE, - 'i': 0, - 'iframe': goog.string.html.HtmlParser.EFlags.UNSAFE | - goog.string.html.HtmlParser.EFlags.CDATA, - 'img': goog.string.html.HtmlParser.EFlags.EMPTY, - 'input': goog.string.html.HtmlParser.EFlags.EMPTY, - 'ins': 0, - 'isindex': goog.string.html.HtmlParser.EFlags.EMPTY | - goog.string.html.HtmlParser.EFlags.UNSAFE, - 'kbd': 0, - 'label': 0, - 'legend': 0, - 'li': goog.string.html.HtmlParser.EFlags.OPTIONAL_ENDTAG, - 'link': goog.string.html.HtmlParser.EFlags.EMPTY | - goog.string.html.HtmlParser.EFlags.UNSAFE, - 'map': 0, - 'menu': 0, - 'meta': goog.string.html.HtmlParser.EFlags.EMPTY | - goog.string.html.HtmlParser.EFlags.UNSAFE, - 'noframes': goog.string.html.HtmlParser.EFlags.UNSAFE | - goog.string.html.HtmlParser.EFlags.CDATA, - 'noscript': goog.string.html.HtmlParser.EFlags.UNSAFE | - goog.string.html.HtmlParser.EFlags.CDATA, - 'object': goog.string.html.HtmlParser.EFlags.UNSAFE, - 'ol': 0, - 'optgroup': 0, - 'option': goog.string.html.HtmlParser.EFlags.OPTIONAL_ENDTAG, - 'p': goog.string.html.HtmlParser.EFlags.OPTIONAL_ENDTAG, - 'param': goog.string.html.HtmlParser.EFlags.EMPTY | - goog.string.html.HtmlParser.EFlags.UNSAFE, - 'pre': 0, - 'q': 0, - 's': 0, - 'samp': 0, - 'script': goog.string.html.HtmlParser.EFlags.UNSAFE | - goog.string.html.HtmlParser.EFlags.CDATA, - 'select': 0, - 'small': 0, - 'span': 0, - 'strike': 0, - 'strong': 0, - 'style': goog.string.html.HtmlParser.EFlags.UNSAFE | - goog.string.html.HtmlParser.EFlags.CDATA, - 'sub': 0, - 'sup': 0, - 'table': 0, - 'tbody': goog.string.html.HtmlParser.EFlags.OPTIONAL_ENDTAG, - 'td': goog.string.html.HtmlParser.EFlags.OPTIONAL_ENDTAG, - 'textarea': goog.string.html.HtmlParser.EFlags.RCDATA, - 'tfoot': goog.string.html.HtmlParser.EFlags.OPTIONAL_ENDTAG, - 'th': goog.string.html.HtmlParser.EFlags.OPTIONAL_ENDTAG, - 'thead': goog.string.html.HtmlParser.EFlags.OPTIONAL_ENDTAG, - 'title': goog.string.html.HtmlParser.EFlags.RCDATA | - goog.string.html.HtmlParser.EFlags.UNSAFE, - 'tr': goog.string.html.HtmlParser.EFlags.OPTIONAL_ENDTAG, - 'tt': 0, - 'u': 0, - 'ul': 0, - 'var': 0 -}; - - -/** - * Regular expression that matches &s. - * @type {RegExp} - * @private - */ -goog.string.html.HtmlParser.AMP_RE_ = /&/g; - - -/** - * Regular expression that matches loose &s. - * @type {RegExp} - * @private - */ -goog.string.html.HtmlParser.LOOSE_AMP_RE_ = - /&([^a-z#]|#(?:[^0-9x]|x(?:[^0-9a-f]|$)|$)|$)/gi; - - -/** - * Regular expression that matches <. - * @type {RegExp} - * @private - */ -goog.string.html.HtmlParser.LT_RE_ = /</g; - - -/** - * Regular expression that matches >. - * @type {RegExp} - * @private - */ -goog.string.html.HtmlParser.GT_RE_ = />/g; - - -/** - * Regular expression that matches ". - * @type {RegExp} - * @private - */ -goog.string.html.HtmlParser.QUOTE_RE_ = /\"/g; - - -/** - * Regular expression that matches =. - * @type {RegExp} - * @private - */ -goog.string.html.HtmlParser.EQUALS_RE_ = /=/g; - - -/** - * Regular expression that matches null characters. - * @type {RegExp} - * @private - */ -goog.string.html.HtmlParser.NULL_RE_ = /\0/g; - - -/** - * Regular expression that matches entities. - * @type {RegExp} - * @private - */ -goog.string.html.HtmlParser.ENTITY_RE_ = /&(#\d+|#x[0-9A-Fa-f]+|\w+);/g; - - -/** - * Regular expression that matches decimal numbers. - * @type {RegExp} - * @private - */ -goog.string.html.HtmlParser.DECIMAL_ESCAPE_RE_ = /^#(\d+)$/; - - -/** - * Regular expression that matches hexadecimal numbers. - * @type {RegExp} - * @private - */ -goog.string.html.HtmlParser.HEX_ESCAPE_RE_ = /^#x([0-9A-Fa-f]+)$/; - - -/** - * Regular expression that matches the next token to be processed. - * @type {RegExp} - * @private - */ -goog.string.html.HtmlParser.INSIDE_TAG_TOKEN_ = new RegExp( - // Don't capture space. - '^\\s*(?:' + - // Capture an attribute name in group 1, and value in group 3. - // We capture the fact that there was an attribute in group 2, since - // interpreters are inconsistent in whether a group that matches nothing - // is null, undefined, or the empty string. - ('(?:' + - '([a-z][a-z-]*)' + // attribute name - ('(' + // optionally followed - '\\s*=\\s*' + - ('(' + - // A double quoted string. - '\"[^\"]*\"' + - // A single quoted string. - '|\'[^\']*\'' + - // The positive lookahead is used to make sure that in - // <foo bar= baz=boo>, the value for bar is blank, not "baz=boo". - '|(?=[a-z][a-z-]*\\s*=)' + - // An unquoted value that is not an attribute name. - // We know it is not an attribute name because the previous - // zero-width match would've eliminated that possibility. - '|[^>\"\'\\s]*' + - ')' - ) + - ')' - ) + '?' + - ')' - ) + - // End of tag captured in group 3. - '|(/?>)' + - // Don't capture cruft - '|[^a-z\\s>]+)', - 'i'); - - -/** - * Regular expression that matches the next token to be processed when we are - * outside a tag. - * @type {RegExp} - * @private - */ -goog.string.html.HtmlParser.OUTSIDE_TAG_TOKEN_ = new RegExp( - '^(?:' + - // Entity captured in group 1. - '&(\\#[0-9]+|\\#[x][0-9a-f]+|\\w+);' + - // Comment, doctypes, and processing instructions not captured. - '|<[!]--[\\s\\S]*?-->|<!\\w[^>]*>|<\\?[^>*]*>' + - // '/' captured in group 2 for close tags, and name captured in group 3. - '|<(/)?([a-z][a-z0-9]*)' + - // Text captured in group 4. - '|([^<&>]+)' + - // Cruft captured in group 5. - '|([<&>]))', - 'i'); - - -/** - * Given a SAX-like {@code goog.string.html.HtmlSaxHandler} parses a - * {@code htmlText} and lets the {@code handler} know the structure while - * visiting the nodes. - * - * @param {goog.string.html.HtmlSaxHandler} handler The HtmlSaxHandler that will - * receive the events. - * @param {string} htmlText The html text. - */ -goog.string.html.HtmlParser.prototype.parse = function(handler, htmlText) { - var htmlLower = null; - var inTag = false; // True iff we're currently processing a tag. - var attribs = []; // Accumulates attribute names and values. - var tagName; // The name of the tag currently being processed. - var eflags; // The element flags for the current tag. - var openTag; // True if the current tag is an open tag. - - // Lets the handler know that we are starting to parse the document. - handler.startDoc(); - - // Consumes tokens from the htmlText and stops once all tokens are processed. - while (htmlText) { - var regex = inTag ? - goog.string.html.HtmlParser.INSIDE_TAG_TOKEN_ : - goog.string.html.HtmlParser.OUTSIDE_TAG_TOKEN_; - // Gets the next token - var m = htmlText.match(regex); - // And removes it from the string - htmlText = htmlText.substring(m[0].length); - - // TODO(goto): cleanup this code breaking it into separate methods. - if (inTag) { - if (m[1]) { // Attribute. - // SetAttribute with uppercase names doesn't work on IE6. - var attribName = goog.string.html.toLowerCase(m[1]); - var decodedValue; - if (m[2]) { - var encodedValue = m[3]; - switch (encodedValue.charCodeAt(0)) { // Strip quotes. - case 34: case 39: - encodedValue = encodedValue.substring( - 1, encodedValue.length - 1); - break; - } - decodedValue = this.unescapeEntities_(this.stripNULs_(encodedValue)); - } else { - // Use name as value for valueless attribs, so - // <input type=checkbox checked> - // gets attributes ['type', 'checkbox', 'checked', 'checked'] - decodedValue = attribName; - } - attribs.push(attribName, decodedValue); - } else if (m[4]) { - if (eflags !== void 0) { // False if not in whitelist. - if (openTag) { - if (handler.startTag) { - handler.startTag(/** @type {string} */ (tagName), attribs); - } - } else { - if (handler.endTag) { - handler.endTag(/** @type {string} */ (tagName)); - } - } - } - - if (openTag && (eflags & - (goog.string.html.HtmlParser.EFlags.CDATA | - goog.string.html.HtmlParser.EFlags.RCDATA))) { - if (htmlLower === null) { - htmlLower = goog.string.html.toLowerCase (htmlText); - } else { - htmlLower = htmlLower.substring( - htmlLower.length - htmlText.length); - } - var dataEnd = htmlLower.indexOf('</' + tagName); - if (dataEnd < 0) { - dataEnd = htmlText.length; - } - if (eflags & goog.string.html.HtmlParser.EFlags.CDATA) { - if (handler.cdata) { - handler.cdata(htmlText.substring(0, dataEnd)); - } - } else if (handler.rcdata) { - handler.rcdata( - this.normalizeRCData_(htmlText.substring(0, dataEnd))); - } - htmlText = htmlText.substring(dataEnd); - } - - tagName = eflags = openTag = void 0; - attribs.length = 0; - inTag = false; - } - } else { - if (m[1]) { // Entity. - handler.pcdata(m[0]); - } else if (m[3]) { // Tag. - openTag = !m[2]; - inTag = true; - tagName = goog.string.html.toLowerCase (m[3]); - eflags = goog.string.html.HtmlParser.Elements.hasOwnProperty(tagName) ? - goog.string.html.HtmlParser.Elements[tagName] : void 0; - } else if (m[4]) { // Text. - handler.pcdata(m[4]); - } else if (m[5]) { // Cruft. - switch (m[5]) { - case '<': handler.pcdata('<'); break; - case '>': handler.pcdata('>'); break; - default: handler.pcdata('&'); break; - } - } - } - } - - // Lets the handler know that we are done parsing the document. - handler.endDoc(); -}; - - -/** - * Decodes an HTML entity. - * - * @param {string} name The content between the '&' and the ';'. - * @return {string} A single unicode code-point as a string. - * @private - */ -goog.string.html.HtmlParser.prototype.lookupEntity_ = function(name) { - // TODO(goto): use {goog.string.htmlDecode} instead ? - // TODO(goto): π is different from Π - name = goog.string.html.toLowerCase(name); - if (goog.string.html.HtmlParser.Entities.hasOwnProperty(name)) { - return goog.string.html.HtmlParser.Entities[name]; - } - var m = name.match(goog.string.html.HtmlParser.DECIMAL_ESCAPE_RE_); - if (m) { - return String.fromCharCode(parseInt(m[1], 10)); - } else if ( - !!(m = name.match(goog.string.html.HtmlParser.HEX_ESCAPE_RE_))) { - return String.fromCharCode(parseInt(m[1], 16)); - } - return ''; -}; - - -/** - * Removes null characters on the string. - * @param {string} s The string to have the null characters removed. - * @return {string} A string without null characters. - * @private - */ -goog.string.html.HtmlParser.prototype.stripNULs_ = function(s) { - return s.replace(goog.string.html.HtmlParser.NULL_RE_, ''); -}; - - -/** - * The plain text of a chunk of HTML CDATA which possibly containing. - * - * TODO(goto): use {@code goog.string.unescapeEntities} instead ? - * @param {string} s A chunk of HTML CDATA. It must not start or end inside - * an HTML entity. - * @return {string} The unescaped entities. - * @private - */ -goog.string.html.HtmlParser.prototype.unescapeEntities_ = function(s) { - return s.replace( - goog.string.html.HtmlParser.ENTITY_RE_, - goog.bind(this.lookupEntity_, this)); -}; - - -/** - * Escape entities in RCDATA that can be escaped without changing the meaning. - * @param {string} rcdata The RCDATA string we want to normalize. - * @return {string} A normalized version of RCDATA. - * @private - */ -goog.string.html.HtmlParser.prototype.normalizeRCData_ = function(rcdata) { - return rcdata. - replace(goog.string.html.HtmlParser.LOOSE_AMP_RE_, '&$1'). - replace(goog.string.html.HtmlParser.LT_RE_, '<'). - replace(goog.string.html.HtmlParser.GT_RE_, '>'); -}; - - -/** - * TODO(goto): why isn't this in the string package ? does this solves any - * real problem ? move it to the goog.string package if it does. - * - * @param {string} str The string to lower case. - * @return {string} The str in lower case format. - */ -goog.string.html.toLowerCase = function(str) { - // The below may not be true on browsers in the Turkish locale. - if ('script' === 'SCRIPT'.toLowerCase()) { - return str.toLowerCase(); - } else { - return str.replace(/[A-Z]/g, function(ch) { - return String.fromCharCode(ch.charCodeAt(0) | 32); - }); - } -}; - - -/** - * An interface to the {@code goog.string.html.HtmlParser} visitor, that gets - * called while the HTML is being parsed. - * - * @constructor - */ -goog.string.html.HtmlSaxHandler = function() { -}; - - -/** - * Handler called when the parser found a new tag. - * @param {string} name The name of the tag that is starting. - * @param {Array.<string>} attributes The attributes of the tag. - */ -goog.string.html.HtmlSaxHandler.prototype.startTag = goog.abstractMethod; - - -/** - * Handler called when the parser found a closing tag. - * @param {string} name The name of the tag that is ending. - */ -goog.string.html.HtmlSaxHandler.prototype.endTag = goog.abstractMethod; - - -/** - * Handler called when PCDATA is found. - * @param {string} text The PCDATA text found. - */ -goog.string.html.HtmlSaxHandler.prototype.pcdata = goog.abstractMethod; - - -/** - * Handler called when RCDATA is found. - * @param {string} text The RCDATA text found. - */ -goog.string.html.HtmlSaxHandler.prototype.rcdata = goog.abstractMethod; - - -/** - * Handler called when CDATA is found. - * @param {string} text The CDATA text found. - */ -goog.string.html.HtmlSaxHandler.prototype.cdata = goog.abstractMethod; - - -/** - * Handler called when the parser is starting to parse the document. - */ -goog.string.html.HtmlSaxHandler.prototype.startDoc = goog.abstractMethod; - - -/** - * Handler called when the parsing is done. - */ -goog.string.html.HtmlSaxHandler.prototype.endDoc = goog.abstractMethod; diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/caja/string/html/.svn/text-base/htmlsanitizer.js.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/caja/string/html/.svn/text-base/htmlsanitizer.js.svn-base deleted file mode 100644 index 7fa1a1d..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/caja/string/html/.svn/text-base/htmlsanitizer.js.svn-base +++ /dev/null @@ -1,605 +0,0 @@ -// Copyright 2006-2008, The Google Caja project. -// Modifications Copyright 2009 The Closure Library Authors. All Rights Reserved. -// All Rights Reserved - -/** - * @license Portions of this code are from the google-caja project, received by - * Google under the Apache license (http://code.google.com/p/google-caja/). - * All other code is Copyright 2009 Google, Inc. All Rights Reserved. - -// Copyright (C) 2006 Google Inc. -// -// 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. - - */ - -/** - * @fileoverview An HTML sanitizer that can satisfy a variety of security - * policies. The HTML sanitizer is built around a SAX parser and HTML element - * and attributes schemas. - * - * This package provides html sanitizing and parsing functions. - * {@code goog.string.htmlSanitize} is basically just using a custom written - * {@code goog.string.HtmlSaxHandler} that outputs safe html as the unsafe - * html content is parsed by {@code goog.string.HtmlParser}. - * - * Examples of usage of the static {@code goog.string.htmlSanitize}: - * <pre> - * var safeHtml = goog.string.html.htmlSanitize('<script src="xss.js" />'); - * el.innerHTML = safeHtml; - * </pre> - * - * We use {@code goog.string.StringBuffer} for fast string concatenation, since - * htmlSanitize is relatively heavy considering that it is designed to parse - * large html files. - * - * @supported IE6, IE7, IE8, FF1.5, FF2, FF3, Chrome 4.0, Safari and Opera 10. - */ - -goog.provide('goog.string.html.HtmlSanitizer'); -goog.provide('goog.string.html.HtmlSanitizer.AttributeType'); -goog.provide('goog.string.html.HtmlSanitizer.Attributes'); -goog.provide('goog.string.html.htmlSanitize'); - -goog.require('goog.string.StringBuffer'); -goog.require('goog.string.html.HtmlParser'); -goog.require('goog.string.html.HtmlParser.EFlags'); -goog.require('goog.string.html.HtmlParser.Elements'); -goog.require('goog.string.html.HtmlSaxHandler'); - - -/** - * Strips unsafe tags and attributes from HTML. - * - * @param {string} htmlText The HTML text to sanitize. - * @param {function(string) : string} opt_urlPolicy A transform to apply to URL - * attribute values. - * @param {function(string) : string} opt_nmTokenPolicy A transform to apply to - * names, IDs, and classes. - * @return {string} A sanitized HTML, safe to be embedded on the page. - */ -goog.string.html.htmlSanitize = function( - htmlText, opt_urlPolicy, opt_nmTokenPolicy) { - var stringBuffer = new goog.string.StringBuffer(); - var handler = new goog.string.html.HtmlSanitizer( - stringBuffer, opt_urlPolicy, opt_nmTokenPolicy); - var parser = new goog.string.html.HtmlParser(); - parser.parse(handler, htmlText); - return stringBuffer.toString(); -}; - - -/** - * An implementation of the {@code goog.string.HtmlSaxHandler} interface that - * will take each of the html tags and sanitize it. - * - * @param {goog.string.StringBuffer} stringBuffer A string buffer, used to - * output the html as we sanitize it. - * @param {?function(string):string} opt_urlPolicy An optional function to be - * applied in URLs. - * @param {?function(string):string} opt_nmTokenPolicy An optional function to - * be applied in names. - * @constructor - * @extends {goog.string.html.HtmlSaxHandler} - */ -goog.string.html.HtmlSanitizer = function( - stringBuffer, opt_urlPolicy, opt_nmTokenPolicy) { - goog.string.html.HtmlSaxHandler.call(this); - - /** - * The string buffer that holds the sanitized version of the html. Used - * during the parse time. - * @type {goog.string.StringBuffer} - * @private - */ - this.stringBuffer_ = stringBuffer; - - /** - * A stack that holds how the handler is being called. - * @type {Array} - * @private - */ - this.stack_ = []; - - /** - * Whether we are ignoring what is being processed or not. - * @type {boolean} - * @private - */ - this.ignoring_ = false; - - /** - * A function to be applied to urls found on the parsing process. - * @type {?function(string):string} - * @private - */ - this.urlPolicy_ = opt_urlPolicy; - - /** - * A function to be applied to names fround on the parsing process. - * @type {?function(string):string} - * @private - */ - this.nmTokenPolicy_ = opt_nmTokenPolicy; -}; -goog.inherits( - goog.string.html.HtmlSanitizer, - goog.string.html.HtmlSaxHandler); - - - -/** - * The HTML types the parser supports. - * @enum {number} - */ -goog.string.html.HtmlSanitizer.AttributeType = { - NONE: 0, - URI: 1, - URI_FRAGMENT: 11, - SCRIPT: 2, - STYLE: 3, - ID: 4, - IDREF: 5, - IDREFS: 6, - GLOBAL_NAME: 7, - LOCAL_NAME: 8, - CLASSES: 9, - FRAME_TARGET: 10 -}; - - -/** - * A map of attributes to types it has. - * @enum {number} - */ -goog.string.html.HtmlSanitizer.Attributes = { - '*::class': goog.string.html.HtmlSanitizer.AttributeType.CLASSES, - '*::dir': 0, - '*::id': goog.string.html.HtmlSanitizer.AttributeType.ID, - '*::lang': 0, - '*::onclick': goog.string.html.HtmlSanitizer.AttributeType.SCRIPT, - '*::ondblclick': goog.string.html.HtmlSanitizer.AttributeType.SCRIPT, - '*::onkeydown': goog.string.html.HtmlSanitizer.AttributeType.SCRIPT, - '*::onkeypress': goog.string.html.HtmlSanitizer.AttributeType.SCRIPT, - '*::onkeyup': goog.string.html.HtmlSanitizer.AttributeType.SCRIPT, - '*::onload': goog.string.html.HtmlSanitizer.AttributeType.SCRIPT, - '*::onmousedown': goog.string.html.HtmlSanitizer.AttributeType.SCRIPT, - '*::onmousemove': goog.string.html.HtmlSanitizer.AttributeType.SCRIPT, - '*::onmouseout': goog.string.html.HtmlSanitizer.AttributeType.SCRIPT, - '*::onmouseover': goog.string.html.HtmlSanitizer.AttributeType.SCRIPT, - '*::onmouseup': goog.string.html.HtmlSanitizer.AttributeType.SCRIPT, - '*::style': goog.string.html.HtmlSanitizer.AttributeType.STYLE, - '*::title': 0, - '*::accesskey': 0, - '*::tabindex': 0, - '*::onfocus': goog.string.html.HtmlSanitizer.AttributeType.SCRIPT, - '*::onblur': goog.string.html.HtmlSanitizer.AttributeType.SCRIPT, - 'a::coords': 0, - 'a::href': goog.string.html.HtmlSanitizer.AttributeType.URI, - 'a::hreflang': 0, - 'a::name': goog.string.html.HtmlSanitizer.AttributeType.GLOBAL_NAME, - 'a::onblur': goog.string.html.HtmlSanitizer.AttributeType.SCRIPT, - 'a::rel': 0, - 'a::rev': 0, - 'a::shape': 0, - 'a::target': goog.string.html.HtmlSanitizer.AttributeType.FRAME_TARGET, - 'a::type': 0, - 'area::accesskey': 0, - 'area::alt': 0, - 'area::coords': 0, - 'area::href': goog.string.html.HtmlSanitizer.AttributeType.URI, - 'area::nohref': 0, - 'area::onfocus': goog.string.html.HtmlSanitizer.AttributeType.SCRIPT, - 'area::shape': 0, - 'area::tabindex': 0, - 'area::target': goog.string.html.HtmlSanitizer.AttributeType.FRAME_TARGET, - 'bdo::dir': 0, - 'blockquote::cite': goog.string.html.HtmlSanitizer.AttributeType.URI, - 'br::clear': 0, - 'button::accesskey': 0, - 'button::disabled': 0, - 'button::name': goog.string.html.HtmlSanitizer.AttributeType.LOCAL_NAME, - 'button::onblur': goog.string.html.HtmlSanitizer.AttributeType.SCRIPT, - 'button::onfocus': goog.string.html.HtmlSanitizer.AttributeType.SCRIPT, - 'button::tabindex': 0, - 'button::type': 0, - 'button::value': 0, - 'caption::align': 0, - 'col::align': 0, - 'col::char': 0, - 'col::charoff': 0, - 'col::span': 0, - 'col::valign': 0, - 'col::width': 0, - 'colgroup::align': 0, - 'colgroup::char': 0, - 'colgroup::charoff': 0, - 'colgroup::span': 0, - 'colgroup::valign': 0, - 'colgroup::width': 0, - 'del::cite': goog.string.html.HtmlSanitizer.AttributeType.URI, - 'del::datetime': 0, - 'dir::compact': 0, - 'div::align': 0, - 'dl::compact': 0, - 'font::color': 0, - 'font::face': 0, - 'font::size': 0, - 'form::accept': 0, - 'form::action': goog.string.html.HtmlSanitizer.AttributeType.URI, - 'form::autocomplete': 0, - 'form::enctype': 0, - 'form::method': 0, - 'form::name': goog.string.html.HtmlSanitizer.AttributeType.GLOBAL_NAME, - 'form::onreset': goog.string.html.HtmlSanitizer.AttributeType.SCRIPT, - 'form::onsubmit': goog.string.html.HtmlSanitizer.AttributeType.SCRIPT, - 'form::target': goog.string.html.HtmlSanitizer.AttributeType.FRAME_TARGET, - 'h1::align': 0, - 'h2::align': 0, - 'h3::align': 0, - 'h4::align': 0, - 'h5::align': 0, - 'h6::align': 0, - 'hr::align': 0, - 'hr::noshade': 0, - 'hr::size': 0, - 'hr::width': 0, - 'img::align': 0, - 'img::alt': 0, - 'img::border': 0, - 'img::height': 0, - 'img::hspace': 0, - 'img::ismap': 0, - 'img::longdesc': goog.string.html.HtmlSanitizer.AttributeType.URI, - 'img::name': goog.string.html.HtmlSanitizer.AttributeType.GLOBAL_NAME, - 'img::src': goog.string.html.HtmlSanitizer.AttributeType.URI, - 'img::usemap': goog.string.html.HtmlSanitizer.AttributeType.URI_FRAGMENT, - 'img::vspace': 0, - 'img::width': 0, - 'input::accept': 0, - 'input::accesskey': 0, - 'input::autocomplete': 0, - 'input::align': 0, - 'input::alt': 0, - 'input::checked': 0, - 'input::disabled': 0, - 'input::ismap': 0, - 'input::maxlength': 0, - 'input::name': goog.string.html.HtmlSanitizer.AttributeType.LOCAL_NAME, - 'input::onblur': goog.string.html.HtmlSanitizer.AttributeType.SCRIPT, - 'input::onchange': goog.string.html.HtmlSanitizer.AttributeType.SCRIPT, - 'input::onfocus': goog.string.html.HtmlSanitizer.AttributeType.SCRIPT, - 'input::onselect': goog.string.html.HtmlSanitizer.AttributeType.SCRIPT, - 'input::readonly': 0, - 'input::size': 0, - 'input::src': goog.string.html.HtmlSanitizer.AttributeType.URI, - 'input::tabindex': 0, - 'input::type': 0, - 'input::usemap': goog.string.html.HtmlSanitizer.AttributeType.URI_FRAGMENT, - 'input::value': 0, - 'ins::cite': goog.string.html.HtmlSanitizer.AttributeType.URI, - 'ins::datetime': 0, - 'label::accesskey': 0, - 'label::for': goog.string.html.HtmlSanitizer.AttributeType.IDREF, - 'label::onblur': goog.string.html.HtmlSanitizer.AttributeType.SCRIPT, - 'label::onfocus': goog.string.html.HtmlSanitizer.AttributeType.SCRIPT, - 'legend::accesskey': 0, - 'legend::align': 0, - 'li::type': 0, - 'li::value': 0, - 'map::name': goog.string.html.HtmlSanitizer.AttributeType.GLOBAL_NAME, - 'menu::compact': 0, - 'ol::compact': 0, - 'ol::start': 0, - 'ol::type': 0, - 'optgroup::disabled': 0, - 'optgroup::label': 0, - 'option::disabled': 0, - 'option::label': 0, - 'option::selected': 0, - 'option::value': 0, - 'p::align': 0, - 'pre::width': 0, - 'q::cite': goog.string.html.HtmlSanitizer.AttributeType.URI, - 'select::disabled': 0, - 'select::multiple': 0, - 'select::name': goog.string.html.HtmlSanitizer.AttributeType.LOCAL_NAME, - 'select::onblur': goog.string.html.HtmlSanitizer.AttributeType.SCRIPT, - 'select::onchange': goog.string.html.HtmlSanitizer.AttributeType.SCRIPT, - 'select::onfocus': goog.string.html.HtmlSanitizer.AttributeType.SCRIPT, - 'select::size': 0, - 'select::tabindex': 0, - 'table::align': 0, - 'table::bgcolor': 0, - 'table::border': 0, - 'table::cellpadding': 0, - 'table::cellspacing': 0, - 'table::frame': 0, - 'table::rules': 0, - 'table::summary': 0, - 'table::width': 0, - 'tbody::align': 0, - 'tbody::char': 0, - 'tbody::charoff': 0, - 'tbody::valign': 0, - 'td::abbr': 0, - 'td::align': 0, - 'td::axis': 0, - 'td::bgcolor': 0, - 'td::char': 0, - 'td::charoff': 0, - 'td::colspan': 0, - 'td::headers': goog.string.html.HtmlSanitizer.AttributeType.IDREFS, - 'td::height': 0, - 'td::nowrap': 0, - 'td::rowspan': 0, - 'td::scope': 0, - 'td::valign': 0, - 'td::width': 0, - 'textarea::accesskey': 0, - 'textarea::cols': 0, - 'textarea::disabled': 0, - 'textarea::name': goog.string.html.HtmlSanitizer.AttributeType.LOCAL_NAME, - 'textarea::onblur': goog.string.html.HtmlSanitizer.AttributeType.SCRIPT, - 'textarea::onchange': goog.string.html.HtmlSanitizer.AttributeType.SCRIPT, - 'textarea::onfocus': goog.string.html.HtmlSanitizer.AttributeType.SCRIPT, - 'textarea::onselect': goog.string.html.HtmlSanitizer.AttributeType.SCRIPT, - 'textarea::readonly': 0, - 'textarea::rows': 0, - 'textarea::tabindex': 0, - 'tfoot::align': 0, - 'tfoot::char': 0, - 'tfoot::charoff': 0, - 'tfoot::valign': 0, - 'th::abbr': 0, - 'th::align': 0, - 'th::axis': 0, - 'th::bgcolor': 0, - 'th::char': 0, - 'th::charoff': 0, - 'th::colspan': 0, - 'th::headers': goog.string.html.HtmlSanitizer.AttributeType.IDREFS, - 'th::height': 0, - 'th::nowrap': 0, - 'th::rowspan': 0, - 'th::scope': 0, - 'th::valign': 0, - 'th::width': 0, - 'thead::align': 0, - 'thead::char': 0, - 'thead::charoff': 0, - 'thead::valign': 0, - 'tr::align': 0, - 'tr::bgcolor': 0, - 'tr::char': 0, - 'tr::charoff': 0, - 'tr::valign': 0, - 'ul::compact': 0, - 'ul::type': 0 -}; - - -/** - * @inheritDoc - */ -goog.string.html.HtmlSanitizer.prototype.startTag = - function(tagName, attribs) { - if (this.ignoring_) { - return; - } - if (!goog.string.html.HtmlParser.Elements.hasOwnProperty(tagName)) { - return; - } - var eflags = goog.string.html.HtmlParser.Elements[tagName]; - if (eflags & goog.string.html.HtmlParser.EFlags.FOLDABLE) { - return; - } else if (eflags & goog.string.html.HtmlParser.EFlags.UNSAFE) { - this.ignoring_ = !(eflags & goog.string.html.HtmlParser.EFlags.EMPTY); - return; - } - attribs = this.sanitizeAttributes_(tagName, attribs); - if (attribs) { - if (!(eflags & goog.string.html.HtmlParser.EFlags.EMPTY)) { - this.stack_.push(tagName); - } - - this.stringBuffer_.append('<', tagName); - for (var i = 0, n = attribs.length; i < n; i += 2) { - var attribName = attribs[i], - value = attribs[i + 1]; - if (value !== null && value !== void 0) { - this.stringBuffer_.append(' ', attribName, '="', - this.escapeAttrib_(value), '"'); - } - } - this.stringBuffer_.append('>'); - } -}; - - -/** - * @inheritDoc - */ -goog.string.html.HtmlSanitizer.prototype.endTag = function(tagName) { - if (this.ignoring_) { - this.ignoring_ = false; - return; - } - if (!goog.string.html.HtmlParser.Elements.hasOwnProperty(tagName)) { - return; - } - var eflags = goog.string.html.HtmlParser.Elements[tagName]; - if (!(eflags & (goog.string.html.HtmlParser.EFlags.UNSAFE | - goog.string.html.HtmlParser.EFlags.EMPTY | - goog.string.html.HtmlParser.EFlags.FOLDABLE))) { - var index; - if (eflags & goog.string.html.HtmlParser.EFlags.OPTIONAL_ENDTAG) { - for (index = this.stack_.length; --index >= 0;) { - var stackEl = this.stack_[index]; - if (stackEl === tagName) { - break; - } - if (!(goog.string.html.HtmlParser.Elements[stackEl] & - goog.string.html.HtmlParser.EFlags.OPTIONAL_ENDTAG)) { - // Don't pop non optional end tags looking for a match. - return; - } - } - } else { - for (index = this.stack_.length; --index >= 0;) { - if (this.stack_[index] === tagName) { - break; - } - } - } - if (index < 0) { return; } // Not opened. - for (var i = this.stack_.length; --i > index;) { - var stackEl = this.stack_[i]; - if (!(goog.string.html.HtmlParser.Elements[stackEl] & - goog.string.html.HtmlParser.EFlags.OPTIONAL_ENDTAG)) { - this.stringBuffer_.append('</', stackEl, '>'); - } - } - this.stack_.length = index; - this.stringBuffer_.append('</', tagName, '>'); - } -}; - - -/** - * @inheritDoc - */ -goog.string.html.HtmlSanitizer.prototype.pcdata = function(text) { - if (!this.ignoring_) { - this.stringBuffer_.append(text); - } -}; - - -/** - * @inheritDoc - */ -goog.string.html.HtmlSanitizer.prototype.rcdata = function(text) { - if (!this.ignoring_) { - this.stringBuffer_.append(text); - } -}; - - -/** - * @inheritDoc - */ -goog.string.html.HtmlSanitizer.prototype.cdata = function(text) { - if (!this.ignoring_) { - this.stringBuffer_.append(text); - } -}; - - -/** - * @inheritDoc - */ -goog.string.html.HtmlSanitizer.prototype.startDoc = function() { - this.stack_ = []; - this.ignoring_ = false; -}; - - -/** - * @inheritDoc - */ -goog.string.html.HtmlSanitizer.prototype.endDoc = function() { - for (var i = this.stack_.length; --i >= 0;) { - this.stringBuffer_.append('</', this.stack_[i], '>'); - } - this.stack_.length = 0; -}; - - -/** - * Escapes HTML special characters in attribute values as HTML entities. - * - * TODO(user): use {@code goog.string.htmlEscape} instead ? - * @param {string} s The string to be escaped. - * @return {string} An escaped version of {@code s}. - * @private - */ -goog.string.html.HtmlSanitizer.prototype.escapeAttrib_ = function(s) { - // Escaping '=' defangs many UTF-7 and SGML short-tag attacks. - return s.replace(goog.string.html.HtmlParser.AMP_RE_, '&'). - replace(goog.string.html.HtmlParser.LT_RE_, '<'). - replace(goog.string.html.HtmlParser.GT_RE_, '>'). - replace(goog.string.html.HtmlParser.QUOTE_RE_, '"'). - replace(goog.string.html.HtmlParser.EQUALS_RE_, '='); -}; - - -/** - * Sanitizes attributes found on html entities. - * @param {string} tagName The name of the tag in which the {@code attribs} were - * found. - * @param {Array.<?string>} attribs An array of attributes. - * @return {Array.<?string>} A sanitized version of the {@code attribs}. - * @private - */ -goog.string.html.HtmlSanitizer.prototype.sanitizeAttributes_ = - function(tagName, attribs) { - for (var i = 0; i < attribs.length; i += 2) { - var attribName = attribs[i]; - var value = attribs[i + 1]; - var atype = null, attribKey; - if ((attribKey = tagName + '::' + attribName, - goog.string.html.HtmlSanitizer.Attributes.hasOwnProperty(attribKey)) || - (attribKey = '*::' + attribName, - goog.string.html.HtmlSanitizer.Attributes.hasOwnProperty(attribKey))) { - atype = goog.string.html.HtmlSanitizer.Attributes[attribKey]; - } - if (atype !== null) { - switch (atype) { - case 0: break; - case goog.string.html.HtmlSanitizer.AttributeType.SCRIPT: - case goog.string.html.HtmlSanitizer.AttributeType.STYLE: - value = null; - break; - case goog.string.html.HtmlSanitizer.AttributeType.ID: - case goog.string.html.HtmlSanitizer.AttributeType.IDREF: - case goog.string.html.HtmlSanitizer.AttributeType.IDREFS: - case goog.string.html.HtmlSanitizer.AttributeType.GLOBAL_NAME: - case goog.string.html.HtmlSanitizer.AttributeType.LOCAL_NAME: - case goog.string.html.HtmlSanitizer.AttributeType.CLASSES: - value = this.nmTokenPolicy_ ? - this.nmTokenPolicy_(/** @type {string} */ (value)) : value; - break; - case goog.string.html.HtmlSanitizer.AttributeType.URI: - value = this.urlPolicy_ && this.urlPolicy_( - /** @type {string} */ (value)); - break; - case goog.string.html.HtmlSanitizer.AttributeType.URI_FRAGMENT: - if (value && '#' === value.charAt(0)) { - value = this.nmTokenPolicy_ ? this.nmTokenPolicy_(value) : value; - if (value) { value = '#' + value; } - } else { - value = null; - } - break; - default: - value = null; - break; - } - } else { - value = null; - } - attribs[i + 1] = value; - } - return attribs; -}; diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/dojo/.svn/all-wcprops b/contexts/data/lib/closure-library/third_party/closure/goog/dojo/.svn/all-wcprops deleted file mode 100644 index f1b6e2e..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/dojo/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 54 -/svn/!svn/ver/1472/trunk/third_party/closure/goog/dojo -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/dojo/.svn/entries b/contexts/data/lib/closure-library/third_party/closure/goog/dojo/.svn/entries deleted file mode 100644 index 718d4cd..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/dojo/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -1494 -http://closure-library.googlecode.com/svn/trunk/third_party/closure/goog/dojo -http://closure-library.googlecode.com/svn - - - -2011-12-13T22:20:28.000000Z -1472 -ccalabro@google.com - - - - - - - - - - - - - - -0b95b8e8-c90f-11de-9d4f-f947ee5921c8 - -dom -dir - diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/dojo/dom/.svn/all-wcprops b/contexts/data/lib/closure-library/third_party/closure/goog/dojo/dom/.svn/all-wcprops deleted file mode 100644 index 77a6748..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/dojo/dom/.svn/all-wcprops +++ /dev/null @@ -1,23 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 58 -/svn/!svn/ver/1472/trunk/third_party/closure/goog/dojo/dom -END -query_test.js -K 25 -svn:wc:ra_dav:version-url -V 71 -/svn/!svn/ver/914/trunk/third_party/closure/goog/dojo/dom/query_test.js -END -query.js -K 25 -svn:wc:ra_dav:version-url -V 67 -/svn/!svn/ver/1472/trunk/third_party/closure/goog/dojo/dom/query.js -END -query_test.html -K 25 -svn:wc:ra_dav:version-url -V 74 -/svn/!svn/ver/1434/trunk/third_party/closure/goog/dojo/dom/query_test.html -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/dojo/dom/.svn/entries b/contexts/data/lib/closure-library/third_party/closure/goog/dojo/dom/.svn/entries deleted file mode 100644 index 4d63cac..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/dojo/dom/.svn/entries +++ /dev/null @@ -1,130 +0,0 @@ -10 - -dir -1494 -http://closure-library.googlecode.com/svn/trunk/third_party/closure/goog/dojo/dom -http://closure-library.googlecode.com/svn - - - -2011-12-13T22:20:28.000000Z -1472 -ccalabro@google.com - - - - - - - - - - - - - - -0b95b8e8-c90f-11de-9d4f-f947ee5921c8 - -query_test.js -file - - - - -2011-12-23T22:42:21.567244Z -61065a98b5e54cd562f6992a24228f8c -2011-05-10T23:18:51.000000Z -914 -nnaze@google.com -has-props - - - - - - - - - - - - - - - - - - - - -4770 - -query.js -file - - - - -2011-12-23T22:42:21.569244Z -7ef1eefa553622cfb11a71d6c0b4a87f -2011-12-13T22:20:28.000000Z -1472 -ccalabro@google.com -has-props - - - - - - - - - - - - - - - - - - - - -52864 - -query_test.html -file - - - - -2011-12-23T22:42:21.569244Z -5b506c4132da428167bbd526789df5e2 -2011-11-30T22:16:21.000000Z -1434 -chrishenry@google.com -has-props - - - - - - - - - - - - - - - - - - - - -1587 - diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/dojo/dom/.svn/prop-base/query.js.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/dojo/dom/.svn/prop-base/query.js.svn-base deleted file mode 100644 index 530636b..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/dojo/dom/.svn/prop-base/query.js.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 15 -text/javascript -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/dojo/dom/.svn/prop-base/query_test.html.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/dojo/dom/.svn/prop-base/query_test.html.svn-base deleted file mode 100644 index d356868..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/dojo/dom/.svn/prop-base/query_test.html.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 9 -text/html -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/dojo/dom/.svn/prop-base/query_test.js.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/dojo/dom/.svn/prop-base/query_test.js.svn-base deleted file mode 100644 index 530636b..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/dojo/dom/.svn/prop-base/query_test.js.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 15 -text/javascript -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/dojo/dom/.svn/text-base/query.js.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/dojo/dom/.svn/text-base/query.js.svn-base deleted file mode 100644 index d6406df..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/dojo/dom/.svn/text-base/query.js.svn-base +++ /dev/null @@ -1,1535 +0,0 @@ -// Copyright 2005-2009, The Dojo Foundation -// Modifications Copyright 2008 The Closure Library Authors. -// All Rights Reserved. - -/** - * @license Portions of this code are from the Dojo Toolkit, received by - * The Closure Library Authors under the BSD license. All other code is - * Copyright 2005-2009 The Closure Library Authors. All Rights Reserved. - -The "New" BSD License: - -Copyright (c) 2005-2009, The Dojo Foundation -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Dojo Foundation nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/** - * @fileoverview This code was ported from the Dojo Toolkit - http://dojotoolkit.org and modified slightly for Closure. - * - * goog.dom.query is a relatively full-featured CSS3 query function. It is - * designed to take any valid CSS3 selector and return the nodes matching - * the selector. To do this quickly, it processes queries in several - * steps, applying caching where profitable. - * The steps (roughly in reverse order of the way they appear in the code): - * 1.) check to see if we already have a "query dispatcher" - * - if so, use that with the given parameterization. Skip to step 4. - * 2.) attempt to determine which branch to dispatch the query to: - * - JS (optimized DOM iteration) - * - native (FF3.1, Safari 3.2+, Chrome, some IE 8 doctypes). If native, - * skip to step 4, using a stub dispatcher for QSA queries. - * 3.) tokenize and convert to executable "query dispatcher" - * assembled as a chain of "yes/no" test functions pertaining to - * a section of a simple query statement (".blah:nth-child(odd)" - * but not "div div", which is 2 simple statements). - * 4.) the resulting query dispatcher is called in the passed scope - * (by default the top-level document) - * - for DOM queries, this results in a recursive, top-down - * evaluation of nodes based on each simple query section - * - querySelectorAll is used instead of DOM where possible. If a query - * fails in this mode, it is re-run against the DOM evaluator and all - * future queries using the same selector evaluate against the DOM branch - * too. - * 5.) matched nodes are pruned to ensure they are unique - */ - -goog.provide('goog.dom.query'); - -goog.require('goog.array'); -goog.require('goog.dom'); -goog.require('goog.functions'); -goog.require('goog.string'); -goog.require('goog.userAgent'); - - /** - * Returns nodes which match the given CSS3 selector, searching the - * entire document by default but optionally taking a node to scope - * the search by. - * - * dojo.query() is the swiss army knife of DOM node manipulation in - * Dojo. Much like Prototype's "$$" (bling-bling) function or JQuery's - * "$" function, dojo.query provides robust, high-performance - * CSS-based node selector support with the option of scoping searches - * to a particular sub-tree of a document. - * - * Supported Selectors: - * -------------------- - * - * dojo.query() supports a rich set of CSS3 selectors, including: - * - * * class selectors (e.g., `.foo`) - * * node type selectors like `span` - * * ` ` descendant selectors - * * `>` child element selectors - * * `#foo` style ID selectors - * * `*` universal selector - * * `~`, the immediately preceeded-by sibling selector - * * `+`, the preceeded-by sibling selector - * * attribute queries: - * | * `[foo]` attribute presence selector - * | * `[foo='bar']` attribute value exact match - * | * `[foo~='bar']` attribute value list item match - * | * `[foo^='bar']` attribute start match - * | * `[foo$='bar']` attribute end match - * | * `[foo*='bar']` attribute substring match - * * `:first-child`, `:last-child` positional selectors - * * `:empty` content emtpy selector - * * `:empty` content emtpy selector - * * `:nth-child(n)`, `:nth-child(2n+1)` style positional calculations - * * `:nth-child(even)`, `:nth-child(odd)` positional selectors - * * `:not(...)` negation pseudo selectors - * - * Any legal combination of these selectors will work with - * `dojo.query()`, including compound selectors ("," delimited). - * Very complex and useful searches can be constructed with this - * palette of selectors. - * - * Unsupported Selectors: - * ---------------------- - * - * While dojo.query handles many CSS3 selectors, some fall outside of - * what's resaonable for a programmatic node querying engine to - * handle. Currently unsupported selectors include: - * - * * namespace-differentiated selectors of any form - * * all `::` pseduo-element selectors - * * certain pseudo-selectors which don't get a lot of day-to-day use: - * | * `:root`, `:lang()`, `:target`, `:focus` - * * all visual and state selectors: - * | * `:root`, `:active`, `:hover`, `:visisted`, `:link`, - * `:enabled`, `:disabled`, `:checked` - * * `:*-of-type` pseudo selectors - * - * dojo.query and XML Documents: - * ----------------------------- - * - * `dojo.query` currently only supports searching XML documents - * whose tags and attributes are 100% lower-case. This is a known - * limitation and will [be addressed soon] - * (http://trac.dojotoolkit.org/ticket/3866) - * - * Non-selector Queries: - * --------------------- - * - * If something other than a String is passed for the query, - * `dojo.query` will return a new array constructed from - * that parameter alone and all further processing will stop. This - * means that if you have a reference to a node or array or nodes, you - * can quickly construct a new array of nodes from the original by - * calling `dojo.query(node)` or `dojo.query(array)`. - * - * example: - * search the entire document for elements with the class "foo": - * | dojo.query(".foo"); - * these elements will match: - * | <span class="foo"></span> - * | <span class="foo bar"></span> - * | <p class="thud foo"></p> - * example: - * search the entire document for elements with the classes "foo" *and* - * "bar": - * | dojo.query(".foo.bar"); - * these elements will match: - * | <span class="foo bar"></span> - * while these will not: - * | <span class="foo"></span> - * | <p class="thud foo"></p> - * example: - * find `<span>` elements which are descendants of paragraphs and - * which have a "highlighted" class: - * | dojo.query("p span.highlighted"); - * the innermost span in this fragment matches: - * | <p class="foo"> - * | <span>... - * | <span class="highlighted foo bar">...</span> - * | </span> - * | </p> - * example: - * find all odd table rows inside of the table - * `#tabular_data`, using the `>` (direct child) selector to avoid - * affecting any nested tables: - * | dojo.query("#tabular_data > tbody > tr:nth-child(odd)"); - * - * @param {string|Array} query The CSS3 expression to match against. - * For details on the syntax of CSS3 selectors, see - * http://www.w3.org/TR/css3-selectors/#selectors. - * @param {(string|Node)=} opt_root A Node (or node id) to scope the search - * from (optional). - * @return { {length: number} } The elements that matched the query. - */ -goog.dom.query = (function() { - //////////////////////////////////////////////////////////////////////// - // Global utilities - //////////////////////////////////////////////////////////////////////// - - var cssCaseBug = (goog.userAgent.WEBKIT && - ((goog.dom.getDocument().compatMode) == 'BackCompat') - ); - - // On browsers that support the "children" collection we can avoid a lot of - // iteration on chaff (non-element) nodes. - var childNodesName = !!goog.dom.getDocument().firstChild['children'] ? - 'children' : - 'childNodes'; - - var specials = '>~+'; - - // Global thunk to determine whether we should treat the current query as - // case sensitive or not. This switch is flipped by the query evaluator based - // on the document passed as the context to search. - var caseSensitive = false; - - - //////////////////////////////////////////////////////////////////////// - // Tokenizer - //////////////////////////////////////////////////////////////////////// - - var getQueryParts = function(query) { - // summary: - // state machine for query tokenization - // description: - // instead of using a brittle and slow regex-based CSS parser, - // dojo.query implements an AST-style query representation. This - // representation is only generated once per query. For example, - // the same query run multiple times or under different root nodes - // does not re-parse the selector expression but instead uses the - // cached data structure. The state machine implemented here - // terminates on the last " " (space) charachter and returns an - // ordered array of query component structures (or "parts"). Each - // part represents an operator or a simple CSS filtering - // expression. The structure for parts is documented in the code - // below. - - - // NOTE: - // this code is designed to run fast and compress well. Sacrifices - // to readibility and maintainability have been made. - if (specials.indexOf(query.slice(-1)) >= 0) { - // If we end with a ">", "+", or "~", that means we're implicitly - // searching all children, so make it explicit. - query += ' * ' - } else { - // if you have not provided a terminator, one will be provided for - // you... - query += ' '; - } - - var ts = function(/*Integer*/ s, /*Integer*/ e) { - // trim and slice. - - // take an index to start a string slice from and an end position - // and return a trimmed copy of that sub-string - return goog.string.trim(query.slice(s, e)); - }; - - // The overall data graph of the full query, as represented by queryPart - // objects. - var queryParts = []; - - - // state keeping vars - var inBrackets = -1, - inParens = -1, - inMatchFor = -1, - inPseudo = -1, - inClass = -1, - inId = -1, - inTag = -1, - lc = '', - cc = '', - pStart; - - // iteration vars - var x = 0, // index in the query - ql = query.length, - currentPart = null, // data structure representing the entire clause - cp = null; // the current pseudo or attr matcher - - // several temporary variables are assigned to this structure durring a - // potential sub-expression match: - // attr: - // a string representing the current full attribute match in a - // bracket expression - // type: - // if there's an operator in a bracket expression, this is - // used to keep track of it - // value: - // the internals of parenthetical expression for a pseudo. for - // :nth-child(2n+1), value might be '2n+1' - - var endTag = function() { - // called when the tokenizer hits the end of a particular tag name. - // Re-sets state variables for tag matching and sets up the matcher - // to handle the next type of token (tag or operator). - if (inTag >= 0) { - var tv = (inTag == x) ? null : ts(inTag, x); - if (specials.indexOf(tv) < 0) { - currentPart.tag = tv; - } else { - currentPart.oper = tv; - } - inTag = -1; - } - }; - - var endId = function() { - // Called when the tokenizer might be at the end of an ID portion of a - // match. - if (inId >= 0) { - currentPart.id = ts(inId, x).replace(/\\/g, ''); - inId = -1; - } - }; - - var endClass = function() { - // Called when the tokenizer might be at the end of a class name - // match. CSS allows for multiple classes, so we augment the - // current item with another class in its list. - if (inClass >= 0) { - currentPart.classes.push(ts(inClass + 1, x).replace(/\\/g, '')); - inClass = -1; - } - }; - - var endAll = function() { - // at the end of a simple fragment, so wall off the matches - endId(); endTag(); endClass(); - }; - - var endPart = function() { - endAll(); - if (inPseudo >= 0) { - currentPart.pseudos.push({ name: ts(inPseudo + 1, x) }); - } - // Hint to the selector engine to tell it whether or not it - // needs to do any iteration. Many simple selectors don't, and - // we can avoid significant construction-time work by advising - // the system to skip them. - currentPart.loops = currentPart.pseudos.length || - currentPart.attrs.length || - currentPart.classes.length; - - // save the full expression as a string - currentPart.oquery = currentPart.query = ts(pStart, x); - - - // otag/tag are hints to suggest to the system whether or not - // it's an operator or a tag. We save a copy of otag since the - // tag name is cast to upper-case in regular HTML matches. The - // system has a global switch to figure out if the current - // expression needs to be case sensitive or not and it will use - // otag or tag accordingly - currentPart.otag = currentPart.tag = (currentPart.oper) ? - null : - (currentPart.tag || '*'); - - if (currentPart.tag) { - // if we're in a case-insensitive HTML doc, we likely want - // the toUpperCase when matching on element.tagName. If we - // do it here, we can skip the string op per node - // comparison - currentPart.tag = currentPart.tag.toUpperCase(); - } - - // add the part to the list - if (queryParts.length && (queryParts[queryParts.length - 1].oper)) { - // operators are always infix, so we remove them from the - // list and attach them to the next match. The evaluator is - // responsible for sorting out how to handle them. - currentPart.infixOper = queryParts.pop(); - currentPart.query = currentPart.infixOper.query + ' ' + - currentPart.query; - } - queryParts.push(currentPart); - - currentPart = null; - } - - // iterate over the query, charachter by charachter, building up a - // list of query part objects - for (; lc = cc, cc = query.charAt(x), x < ql; x++) { - // cc: the current character in the match - // lc: the last charachter (if any) - - // someone is trying to escape something, so don't try to match any - // fragments. We assume we're inside a literal. - if (lc == '\\') { - continue; - } - if (!currentPart) { // a part was just ended or none has yet been created - // NOTE: I hate all this alloc, but it's shorter than writing tons of - // if's - pStart = x; - // rules describe full CSS sub-expressions, like: - // #someId - // .className:first-child - // but not: - // thinger > div.howdy[type=thinger] - // the indidual components of the previous query would be - // split into 3 parts that would be represented a structure - // like: - // [ - // { - // query: 'thinger', - // tag: 'thinger', - // }, - // { - // query: 'div.howdy[type=thinger]', - // classes: ['howdy'], - // infixOper: { - // query: '>', - // oper: '>', - // } - // }, - // ] - currentPart = { - query: null, // the full text of the part's rule - pseudos: [], // CSS supports multiple pseud-class matches in a single - // rule - attrs: [], // CSS supports multi-attribute match, so we need an array - classes: [], // class matches may be additive, - // e.g.: .thinger.blah.howdy - tag: null, // only one tag... - oper: null, // ...or operator per component. Note that these wind up - // being exclusive. - id: null, // the id component of a rule - getTag: function() { - return (caseSensitive) ? this.otag : this.tag; - } - }; - - // if we don't have a part, we assume we're going to start at - // the beginning of a match, which should be a tag name. This - // might fault a little later on, but we detect that and this - // iteration will still be fine. - inTag = x; - } - - if (inBrackets >= 0) { - // look for a the close first - if (cc == ']') { // if we're in a [...] clause and we end, do assignment - if (!cp.attr) { - // no attribute match was previously begun, so we - // assume this is an attribute existance match in the - // form of [someAttributeName] - cp.attr = ts(inBrackets + 1, x); - } else { - // we had an attribute already, so we know that we're - // matching some sort of value, as in [attrName=howdy] - cp.matchFor = ts((inMatchFor || inBrackets + 1), x); - } - var cmf = cp.matchFor; - if (cmf) { - // try to strip quotes from the matchFor value. We want - // [attrName=howdy] to match the same - // as [attrName = 'howdy' ] - if ((cmf.charAt(0) == '"') || (cmf.charAt(0) == "'")) { - cp.matchFor = cmf.slice(1, -1); - } - } - // end the attribute by adding it to the list of attributes. - currentPart.attrs.push(cp); - cp = null; // necessary? - inBrackets = inMatchFor = -1; - } else if (cc == '=') { - // if the last char was an operator prefix, make sure we - // record it along with the '=' operator. - var addToCc = ('|~^$*'.indexOf(lc) >= 0) ? lc : ''; - cp.type = addToCc + cc; - cp.attr = ts(inBrackets + 1, x - addToCc.length); - inMatchFor = x + 1; - } - // now look for other clause parts - } else if (inParens >= 0) { - // if we're in a parenthetical expression, we need to figure - // out if it's attached to a pseduo-selector rule like - // :nth-child(1) - if (cc == ')') { - if (inPseudo >= 0) { - cp.value = ts(inParens + 1, x); - } - inPseudo = inParens = -1; - } - } else if (cc == '#') { - // start of an ID match - endAll(); - inId = x + 1; - } else if (cc == '.') { - // start of a class match - endAll(); - inClass = x; - } else if (cc == ':') { - // start of a pseudo-selector match - endAll(); - inPseudo = x; - } else if (cc == '[') { - // start of an attribute match. - endAll(); - inBrackets = x; - // provide a new structure for the attribute match to fill-in - cp = { - /*===== - attr: null, type: null, matchFor: null - =====*/ - }; - } else if (cc == '(') { - // we really only care if we've entered a parenthetical - // expression if we're already inside a pseudo-selector match - if (inPseudo >= 0) { - // provide a new structure for the pseudo match to fill-in - cp = { - name: ts(inPseudo + 1, x), - value: null - } - currentPart.pseudos.push(cp); - } - inParens = x; - } else if ( - (cc == ' ') && - // if it's a space char and the last char is too, consume the - // current one without doing more work - (lc != cc) - ) { - endPart(); - } - } - return queryParts; - }; - - - //////////////////////////////////////////////////////////////////////// - // DOM query infrastructure - //////////////////////////////////////////////////////////////////////// - - var agree = function(first, second) { - // the basic building block of the yes/no chaining system. agree(f1, - // f2) generates a new function which returns the boolean results of - // both of the passed functions to a single logical-anded result. If - // either are not possed, the other is used exclusively. - if (!first) { - return second; - } - if (!second) { - return first; - } - - return function() { - return first.apply(window, arguments) && second.apply(window, arguments); - } - }; - - /** - * @param {Array=} opt_arr - */ - function getArr(i, opt_arr) { - // helps us avoid array alloc when we don't need it - var r = opt_arr || []; - if (i) { - r.push(i); - } - return r; - }; - - var isElement = function(n) { - return (1 == n.nodeType); - }; - - // FIXME: need to coalesce getAttr with defaultGetter - var blank = ''; - var getAttr = function(elem, attr) { - if (!elem) { - return blank; - } - if (attr == 'class') { - return elem.className || blank; - } - if (attr == 'for') { - return elem.htmlFor || blank; - } - if (attr == 'style') { - return elem.style.cssText || blank; - } - return (caseSensitive ? elem.getAttribute(attr) : - elem.getAttribute(attr, 2)) || blank; - }; - - var attrs = { - '*=': function(attr, value) { - return function(elem) { - // E[foo*="bar"] - // an E element whose "foo" attribute value contains - // the substring "bar" - return (getAttr(elem, attr).indexOf(value) >= 0); - } - }, - '^=': function(attr, value) { - // E[foo^="bar"] - // an E element whose "foo" attribute value begins exactly - // with the string "bar" - return function(elem) { - return (getAttr(elem, attr).indexOf(value) == 0); - } - }, - '$=': function(attr, value) { - // E[foo$="bar"] - // an E element whose "foo" attribute value ends exactly - // with the string "bar" - var tval = ' ' + value; - return function(elem) { - var ea = ' ' + getAttr(elem, attr); - return (ea.lastIndexOf(value) == (ea.length - value.length)); - } - }, - '~=': function(attr, value) { - // E[foo~="bar"] - // an E element whose "foo" attribute value is a list of - // space-separated values, one of which is exactly equal - // to "bar" - - var tval = ' ' + value + ' '; - return function(elem) { - var ea = ' ' + getAttr(elem, attr) + ' '; - return (ea.indexOf(tval) >= 0); - } - }, - '|=': function(attr, value) { - // E[hreflang|="en"] - // an E element whose "hreflang" attribute has a - // hyphen-separated list of values beginning (from the - // left) with "en" - value = ' ' + value; - return function(elem) { - var ea = ' ' + getAttr(elem, attr); - return ( - (ea == value) || - (ea.indexOf(value + '-') == 0) - ); - } - }, - '=': function(attr, value) { - return function(elem) { - return (getAttr(elem, attr) == value); - } - } - }; - - // avoid testing for node type if we can. Defining this in the negative - // here to avoid negation in the fast path. - var noNextElementSibling = ( - typeof goog.dom.getDocument().firstChild.nextElementSibling == 'undefined' - ); - var nSibling = !noNextElementSibling ? 'nextElementSibling' : 'nextSibling'; - var pSibling = !noNextElementSibling ? - 'previousElementSibling' : - 'previousSibling'; - var simpleNodeTest = (noNextElementSibling ? isElement : goog.functions.TRUE); - - var _lookLeft = function(node) { - while (node = node[pSibling]) { - if (simpleNodeTest(node)) { - return false; - } - } - return true; - }; - - var _lookRight = function(node) { - while (node = node[nSibling]) { - if (simpleNodeTest(node)) { - return false; - } - } - return true; - }; - - var getNodeIndex = function(node) { - var root = node.parentNode; - var i = 0, - tret = root[childNodesName], - ci = (node['_i'] || -1), - cl = (root['_l'] || -1); - - if (!tret) { - return -1; - } - var l = tret.length; - - // we calcuate the parent length as a cheap way to invalidate the - // cache. It's not 100% accurate, but it's much more honest than what - // other libraries do - if (cl == l && ci >= 0 && cl >= 0) { - // if it's legit, tag and release - return ci; - } - - // else re-key things - root['_l'] = l; - ci = -1; - var te = root['firstElementChild'] || root['firstChild']; - for (; te; te = te[nSibling]) { - if (simpleNodeTest(te)) { - te['_i'] = ++i; - if (node === te) { - // NOTE: - // shortcuting the return at this step in indexing works - // very well for benchmarking but we avoid it here since - // it leads to potential O(n^2) behavior in sequential - // getNodexIndex operations on a previously un-indexed - // parent. We may revisit this at a later time, but for - // now we just want to get the right answer more often - // than not. - ci = i; - } - } - } - return ci; - }; - - var isEven = function(elem) { - return !((getNodeIndex(elem)) % 2); - }; - - var isOdd = function(elem) { - return (getNodeIndex(elem)) % 2; - }; - - var pseudos = { - 'checked': function(name, condition) { - return function(elem) { - return elem.checked || elem.attributes['checked']; - } - }, - 'first-child': function() { - return _lookLeft; - }, - 'last-child': function() { - return _lookRight; - }, - 'only-child': function(name, condition) { - return function(node) { - if (!_lookLeft(node)) { - return false; - } - if (!_lookRight(node)) { - return false; - } - return true; - }; - }, - 'empty': function(name, condition) { - return function(elem) { - // DomQuery and jQuery get this wrong, oddly enough. - // The CSS 3 selectors spec is pretty explicit about it, too. - var cn = elem.childNodes; - var cnl = elem.childNodes.length; - // if(!cnl) { return true; } - for (var x = cnl - 1; x >= 0; x--) { - var nt = cn[x].nodeType; - if ((nt === 1) || (nt == 3)) { - return false; - } - } - return true; - } - }, - 'contains': function(name, condition) { - var cz = condition.charAt(0); - if (cz == '"' || cz == "'") { // Remove quotes. - condition = condition.slice(1, -1); - } - return function(elem) { - return (elem.innerHTML.indexOf(condition) >= 0); - } - }, - 'not': function(name, condition) { - var p = getQueryParts(condition)[0]; - var ignores = { el: 1 }; - if (p.tag != '*') { - ignores.tag = 1; - } - if (!p.classes.length) { - ignores.classes = 1; - } - var ntf = getSimpleFilterFunc(p, ignores); - return function(elem) { - return !ntf(elem); - } - }, - 'nth-child': function(name, condition) { - function pi(n) { - return parseInt(n, 10); - } - // avoid re-defining function objects if we can - if (condition == 'odd') { - return isOdd; - } else if (condition == 'even') { - return isEven; - } - // FIXME: can we shorten this? - if (condition.indexOf('n') != -1) { - var tparts = condition.split('n', 2); - var pred = tparts[0] ? ((tparts[0] == '-') ? -1 : pi(tparts[0])) : 1; - var idx = tparts[1] ? pi(tparts[1]) : 0; - var lb = 0, ub = -1; - if (pred > 0) { - if (idx < 0) { - idx = (idx % pred) && (pred + (idx % pred)); - } else if (idx > 0) { - if (idx >= pred) { - lb = idx - idx % pred; - } - idx = idx % pred; - } - } else if (pred < 0) { - pred *= -1; - // idx has to be greater than 0 when pred is negative; - // shall we throw an error here? - if (idx > 0) { - ub = idx; - idx = idx % pred; - } - } - if (pred > 0) { - return function(elem) { - var i = getNodeIndex(elem); - return (i >= lb) && (ub < 0 || i <= ub) && ((i % pred) == idx); - } - } else { - condition = idx; - } - } - var ncount = pi(condition); - return function(elem) { - return (getNodeIndex(elem) == ncount); - } - } - }; - - var defaultGetter = (goog.userAgent.IE) ? function(cond) { - var clc = cond.toLowerCase(); - if (clc == 'class') { - cond = 'className'; - } - return function(elem) { - return caseSensitive ? elem.getAttribute(cond) : elem[cond] || elem[clc]; - } - } : function(cond) { - return function(elem) { - return elem && elem.getAttribute && elem.hasAttribute(cond); - } - }; - - var getSimpleFilterFunc = function(query, ignores) { - // Generates a node tester function based on the passed query part. The - // query part is one of the structures generatd by the query parser when it - // creates the query AST. The 'ignores' object specifies which (if any) - // tests to skip, allowing the system to avoid duplicating work where it - // may have already been taken into account by other factors such as how - // the nodes to test were fetched in the first place. - if (!query) { - return goog.functions.TRUE; - } - ignores = ignores || {}; - - var ff = null; - - if (!ignores.el) { - ff = agree(ff, isElement); - } - - if (!ignores.tag) { - if (query.tag != '*') { - ff = agree(ff, function(elem) { - return (elem && (elem.tagName == query.getTag())); - }); - } - } - - if (!ignores.classes) { - goog.array.forEach(query.classes, function(cname, idx, arr) { - // Get the class name. - var re = new RegExp('(?:^|\\s)' + cname + '(?:\\s|$)'); - ff = agree(ff, function(elem) { - return re.test(elem.className); - }); - ff.count = idx; - }); - } - - if (!ignores.pseudos) { - goog.array.forEach(query.pseudos, function(pseudo) { - var pn = pseudo.name; - if (pseudos[pn]) { - ff = agree(ff, pseudos[pn](pn, pseudo.value)); - } - }); - } - - if (!ignores.attrs) { - goog.array.forEach(query.attrs, function(attr) { - var matcher; - var a = attr.attr; - // type, attr, matchFor - if (attr.type && attrs[attr.type]) { - matcher = attrs[attr.type](a, attr.matchFor); - } else if (a.length) { - matcher = defaultGetter(a); - } - if (matcher) { - ff = agree(ff, matcher); - } - }); - } - - if (!ignores.id) { - if (query.id) { - ff = agree(ff, function(elem) { - return (!!elem && (elem.id == query.id)); - }); - } - } - - if (!ff) { - if (!('default' in ignores)) { - ff = goog.functions.TRUE; - } - } - return ff; - }; - - var nextSiblingIterator = function(filterFunc) { - return function(node, ret, bag) { - while (node = node[nSibling]) { - if (noNextElementSibling && (!isElement(node))) { - continue; - } - if ( - (!bag || _isUnique(node, bag)) && - filterFunc(node) - ) { - ret.push(node); - } - break; - } - return ret; - }; - }; - - var nextSiblingsIterator = function(filterFunc) { - return function(root, ret, bag) { - var te = root[nSibling]; - while (te) { - if (simpleNodeTest(te)) { - if (bag && !_isUnique(te, bag)) { - break; - } - if (filterFunc(te)) { - ret.push(te); - } - } - te = te[nSibling]; - } - return ret; - }; - }; - - // Get an array of child *elements*, skipping text and comment nodes - var _childElements = function(filterFunc) { - filterFunc = filterFunc || goog.functions.TRUE; - return function(root, ret, bag) { - var te, x = 0, tret = root[childNodesName]; - while (te = tret[x++]) { - if ( - simpleNodeTest(te) && - (!bag || _isUnique(te, bag)) && - (filterFunc(te, x)) - ) { - ret.push(te); - } - } - return ret; - }; - }; - - // test to see if node is below root - var _isDescendant = function(node, root) { - var pn = node.parentNode; - while (pn) { - if (pn == root) { - break; - } - pn = pn.parentNode; - } - return !!pn; - }; - - var _getElementsFuncCache = {}; - - var getElementsFunc = function(query) { - var retFunc = _getElementsFuncCache[query.query]; - // If we've got a cached dispatcher, just use that. - if (retFunc) { - return retFunc; - } - // Else, generate a new one. - - // NOTE: - // This function returns a function that searches for nodes and - // filters them. The search may be specialized by infix operators - // (">", "~", or "+") else it will default to searching all - // descendants (the " " selector). Once a group of children is - // founde, a test function is applied to weed out the ones we - // don't want. Many common cases can be fast-pathed. We spend a - // lot of cycles to create a dispatcher that doesn't do more work - // than necessary at any point since, unlike this function, the - // dispatchers will be called every time. The logic of generating - // efficient dispatchers looks like this in pseudo code: - // - // # if it's a purely descendant query (no ">", "+", or "~" modifiers) - // if infixOperator == " ": - // if only(id): - // return def(root): - // return d.byId(id, root); - // - // elif id: - // return def(root): - // return filter(d.byId(id, root)); - // - // elif cssClass && getElementsByClassName: - // return def(root): - // return filter(root.getElementsByClassName(cssClass)); - // - // elif only(tag): - // return def(root): - // return root.getElementsByTagName(tagName); - // - // else: - // # search by tag name, then filter - // return def(root): - // return filter(root.getElementsByTagName(tagName||"*")); - // - // elif infixOperator == ">": - // # search direct children - // return def(root): - // return filter(root.children); - // - // elif infixOperator == "+": - // # search next sibling - // return def(root): - // return filter(root.nextElementSibling); - // - // elif infixOperator == "~": - // # search rightward siblings - // return def(root): - // return filter(nextSiblings(root)); - - var io = query.infixOper; - var oper = (io ? io.oper : ''); - // The default filter func which tests for all conditions in the query - // part. This is potentially inefficient, so some optimized paths may - // re-define it to test fewer things. - var filterFunc = getSimpleFilterFunc(query, { el: 1 }); - var qt = query.tag; - var wildcardTag = ('*' == qt); - var ecs = goog.dom.getDocument()['getElementsByClassName']; - - if (!oper) { - // If there's no infix operator, then it's a descendant query. ID - // and "elements by class name" variants can be accelerated so we - // call them out explicitly: - if (query.id) { - // Testing shows that the overhead of goog.functions.TRUE() is - // acceptable and can save us some bytes vs. re-defining the function - // everywhere. - filterFunc = (!query.loops && wildcardTag) ? - goog.functions.TRUE : - getSimpleFilterFunc(query, { el: 1, id: 1 }); - - retFunc = function(root, arr) { - var te = goog.dom.getDomHelper(root).getElement(query.id); - if (!te || !filterFunc(te)) { - return; - } - if (9 == root.nodeType) { // If root's a doc, we just return directly. - return getArr(te, arr); - } else { // otherwise check ancestry - if (_isDescendant(te, root)) { - return getArr(te, arr); - } - } - } - } else if ( - ecs && - // isAlien check. Workaround for Prototype.js being totally evil/dumb. - /\{\s*\[native code\]\s*\}/.test(String(ecs)) && - query.classes.length && - // WebKit bug where quirks-mode docs select by class w/o case - // sensitivity. - !cssCaseBug - ) { - // it's a class-based query and we've got a fast way to run it. - - // ignore class and ID filters since we will have handled both - filterFunc = getSimpleFilterFunc(query, { el: 1, classes: 1, id: 1 }); - var classesString = query.classes.join(' '); - retFunc = function(root, arr) { - var ret = getArr(0, arr), te, x = 0; - var tret = root.getElementsByClassName(classesString); - while ((te = tret[x++])) { - if (filterFunc(te, root)) { - ret.push(te); - } - } - return ret; - }; - - } else if (!wildcardTag && !query.loops) { - // it's tag only. Fast-path it. - retFunc = function(root, arr) { - var ret = getArr(0, arr), te, x = 0; - var tret = root.getElementsByTagName(query.getTag()); - while ((te = tret[x++])) { - ret.push(te); - } - return ret; - }; - } else { - // the common case: - // a descendant selector without a fast path. By now it's got - // to have a tag selector, even if it's just "*" so we query - // by that and filter - filterFunc = getSimpleFilterFunc(query, { el: 1, tag: 1, id: 1 }); - retFunc = function(root, arr) { - var ret = getArr(0, arr), te, x = 0; - // we use getTag() to avoid case sensitivity issues - var tret = root.getElementsByTagName(query.getTag()); - while (te = tret[x++]) { - if (filterFunc(te, root)) { - ret.push(te); - } - } - return ret; - }; - } - } else { - // the query is scoped in some way. Instead of querying by tag we - // use some other collection to find candidate nodes - var skipFilters = { el: 1 }; - if (wildcardTag) { - skipFilters.tag = 1; - } - filterFunc = getSimpleFilterFunc(query, skipFilters); - if ('+' == oper) { - retFunc = nextSiblingIterator(filterFunc); - } else if ('~' == oper) { - retFunc = nextSiblingsIterator(filterFunc); - } else if ('>' == oper) { - retFunc = _childElements(filterFunc); - } - } - // cache it and return - return _getElementsFuncCache[query.query] = retFunc; - }; - - var filterDown = function(root, queryParts) { - // NOTE: - // this is the guts of the DOM query system. It takes a list of - // parsed query parts and a root and finds children which match - // the selector represented by the parts - var candidates = getArr(root), qp, x, te, qpl = queryParts.length, bag, ret; - - for (var i = 0; i < qpl; i++) { - ret = []; - qp = queryParts[i]; - x = candidates.length - 1; - if (x > 0) { - // if we have more than one root at this level, provide a new - // hash to use for checking group membership but tell the - // system not to post-filter us since we will already have been - // gauranteed to be unique - bag = {}; - ret.nozip = true; - } - var gef = getElementsFunc(qp); - for (var j = 0; te = candidates[j]; j++) { - // for every root, get the elements that match the descendant - // selector, adding them to the 'ret' array and filtering them - // via membership in this level's bag. If there are more query - // parts, then this level's return will be used as the next - // level's candidates - gef(te, ret, bag); - } - if (!ret.length) { break; } - candidates = ret; - } - return ret; - }; - - //////////////////////////////////////////////////////////////////////// - // the query runner - //////////////////////////////////////////////////////////////////////// - - // these are the primary caches for full-query results. The query - // dispatcher functions are generated then stored here for hash lookup in - // the future - var _queryFuncCacheDOM = {}, - _queryFuncCacheQSA = {}; - - // this is the second level of spliting, from full-length queries (e.g., - // 'div.foo .bar') into simple query expressions (e.g., ['div.foo', - // '.bar']) - var getStepQueryFunc = function(query) { - var qparts = getQueryParts(goog.string.trim(query)); - - // if it's trivial, avoid iteration and zipping costs - if (qparts.length == 1) { - // We optimize this case here to prevent dispatch further down the - // chain, potentially slowing things down. We could more elegantly - // handle this in filterDown(), but it's slower for simple things - // that need to be fast (e.g., '#someId'). - var tef = getElementsFunc(qparts[0]); - return function(root) { - var r = tef(root, []); - if (r) { r.nozip = true; } - return r; - } - } - - // otherwise, break it up and return a runner that iterates over the parts - // recursively - return function(root) { - return filterDown(root, qparts); - } - }; - - // NOTES: - // * we can't trust QSA for anything but document-rooted queries, so - // caching is split into DOM query evaluators and QSA query evaluators - // * caching query results is dirty and leak-prone (or, at a minimum, - // prone to unbounded growth). Other toolkits may go this route, but - // they totally destroy their own ability to manage their memory - // footprint. If we implement it, it should only ever be with a fixed - // total element reference # limit and an LRU-style algorithm since JS - // has no weakref support. Caching compiled query evaluators is also - // potentially problematic, but even on large documents the size of the - // query evaluators is often < 100 function objects per evaluator (and - // LRU can be applied if it's ever shown to be an issue). - // * since IE's QSA support is currently only for HTML documents and even - // then only in IE 8's 'standards mode', we have to detect our dispatch - // route at query time and keep 2 separate caches. Ugg. - - var qsa = 'querySelectorAll'; - - // some versions of Safari provided QSA, but it was buggy and crash-prone. - // We need te detect the right 'internal' webkit version to make this work. - var qsaAvail = ( - !!goog.dom.getDocument()[qsa] && - // see #5832 - (!goog.userAgent.WEBKIT || goog.userAgent.isVersion('526')) - ); - - /** @param {boolean=} opt_forceDOM */ - var getQueryFunc = function(query, opt_forceDOM) { - - if (qsaAvail) { - // if we've got a cached variant and we think we can do it, run it! - var qsaCached = _queryFuncCacheQSA[query]; - if (qsaCached && !opt_forceDOM) { - return qsaCached; - } - } - - // else if we've got a DOM cached variant, assume that we already know - // all we need to and use it - var domCached = _queryFuncCacheDOM[query]; - if (domCached) { - return domCached; - } - - // TODO: - // today we're caching DOM and QSA branches separately so we - // recalc useQSA every time. If we had a way to tag root+query - // efficiently, we'd be in good shape to do a global cache. - - var qcz = query.charAt(0); - var nospace = (-1 == query.indexOf(' ')); - - // byId searches are wicked fast compared to QSA, even when filtering - // is required - if ((query.indexOf('#') >= 0) && (nospace)) { - opt_forceDOM = true; - } - - var useQSA = ( - qsaAvail && (!opt_forceDOM) && - // as per CSS 3, we can't currently start w/ combinator: - // http://www.w3.org/TR/css3-selectors/#w3cselgrammar - (specials.indexOf(qcz) == -1) && - // IE's QSA impl sucks on pseudos - (!goog.userAgent.IE || (query.indexOf(':') == -1)) && - - (!(cssCaseBug && (query.indexOf('.') >= 0))) && - - // FIXME: - // need to tighten up browser rules on ':contains' and '|=' to - // figure out which aren't good - (query.indexOf(':contains') == -1) && - (query.indexOf('|=') == -1) - ); - - // TODO: - // if we've got a descendant query (e.g., '> .thinger' instead of - // just '.thinger') in a QSA-able doc, but are passed a child as a - // root, it should be possible to give the item a synthetic ID and - // trivially rewrite the query to the form '#synid > .thinger' to - // use the QSA branch - - - if (useQSA) { - var tq = (specials.indexOf(query.charAt(query.length - 1)) >= 0) ? - (query + ' *') : query; - return _queryFuncCacheQSA[query] = function(root) { - try { - // the QSA system contains an egregious spec bug which - // limits us, effectively, to only running QSA queries over - // entire documents. See: - // http://ejohn.org/blog/thoughts-on-queryselectorall/ - // despite this, we can also handle QSA runs on simple - // selectors, but we don't want detection to be expensive - // so we're just checking for the presence of a space char - // right now. Not elegant, but it's cheaper than running - // the query parser when we might not need to - if (!((9 == root.nodeType) || nospace)) { - throw ''; - } - var r = root[qsa](tq); - // IE QSA queries may incorrectly include comment nodes, so we throw - // the zipping function into 'remove' comments mode instead of the - // normal 'skip it' which every other QSA-clued browser enjoys - // skip expensive duplication checks and just wrap in an array. - if (goog.userAgent.IE) { - r.commentStrip = true; - } else { - r.nozip = true; - } - return r; - } catch (e) { - // else run the DOM branch on this query, ensuring that we - // default that way in the future - return getQueryFunc(query, true)(root); - } - } - } else { - // DOM branch - var parts = query.split(/\s*,\s*/); - return _queryFuncCacheDOM[query] = ((parts.length < 2) ? - // if not a compound query (e.g., '.foo, .bar'), cache and return a - // dispatcher - getStepQueryFunc(query) : - // if it *is* a complex query, break it up into its - // constituent parts and return a dispatcher that will - // merge the parts when run - function(root) { - var pindex = 0, // avoid array alloc for every invocation - ret = [], - tp; - while (tp = parts[pindex++]) { - ret = ret.concat(getStepQueryFunc(tp)(root)); - } - return ret; - } - ); - } - }; - - var _zipIdx = 0; - - // NOTE: - // this function is Moo inspired, but our own impl to deal correctly - // with XML in IE - var _nodeUID = goog.userAgent.IE ? function(node) { - if (caseSensitive) { - // XML docs don't have uniqueID on their nodes - return node.getAttribute('_uid') || - node.setAttribute('_uid', ++_zipIdx) || _zipIdx; - - } else { - return node.uniqueID; - } - } : - function(node) { - return (node['_uid'] || (node['_uid'] = ++_zipIdx)); - }; - - // determine if a node in is unique in a 'bag'. In this case we don't want - // to flatten a list of unique items, but rather just tell if the item in - // question is already in the bag. Normally we'd just use hash lookup to do - // this for us but IE's DOM is busted so we can't really count on that. On - // the upside, it gives us a built in unique ID function. - var _isUnique = function(node, bag) { - if (!bag) { - return 1; - } - var id = _nodeUID(node); - if (!bag[id]) { - return bag[id] = 1; - } - return 0; - }; - - // attempt to efficiently determine if an item in a list is a dupe, - // returning a list of 'uniques', hopefully in doucment order - var _zipIdxName = '_zipIdx'; - var _zip = function(arr) { - if (arr && arr.nozip) { - return arr; - } - var ret = []; - if (!arr || !arr.length) { - return ret; - } - if (arr[0]) { - ret.push(arr[0]); - } - if (arr.length < 2) { - return ret; - } - - _zipIdx++; - - // we have to fork here for IE and XML docs because we can't set - // expandos on their nodes (apparently). *sigh* - if (goog.userAgent.IE && caseSensitive) { - var szidx = _zipIdx + ''; - arr[0].setAttribute(_zipIdxName, szidx); - for (var x = 1, te; te = arr[x]; x++) { - if (arr[x].getAttribute(_zipIdxName) != szidx) { - ret.push(te); - } - te.setAttribute(_zipIdxName, szidx); - } - } else if (goog.userAgent.IE && arr.commentStrip) { - try { - for (var x = 1, te; te = arr[x]; x++) { - if (isElement(te)) { - ret.push(te); - } - } - } catch (e) { /* squelch */ } - } else { - if (arr[0]) { - arr[0][_zipIdxName] = _zipIdx; - } - for (var x = 1, te; te = arr[x]; x++) { - if (arr[x][_zipIdxName] != _zipIdx) { - ret.push(te); - } - te[_zipIdxName] = _zipIdx; - } - } - return ret; - }; - - /** - * The main executor. Type specification from above. - * @param {string|Array} query The query. - * @param {(string|Node)=} root The root. - * @return {!Array} The elements that matched the query. - */ - var query = function(query, root) { - // NOTE: elementsById is not currently supported - // NOTE: ignores xpath-ish queries for now - - //Set list constructor to desired value. This can change - //between calls, so always re-assign here. - - if (!query) { - return []; - } - - if (query.constructor == Array) { - return /** @type {!Array} */ (query); - } - - if (!goog.isString(query)) { - return [query]; - } - - if (goog.isString(root)) { - root = goog.dom.getElement(root); - if (!root) { - return []; - } - } - - root = root || goog.dom.getDocument(); - var od = root.ownerDocument || root.documentElement; - - // throw the big case sensitivity switch - - // NOTE: - // Opera in XHTML mode doesn't detect case-sensitivity correctly - // and it's not clear that there's any way to test for it - caseSensitive = - root.contentType && root.contentType == 'application/xml' || - goog.userAgent.OPERA && - (root.doctype || od.toString() == '[object XMLDocument]') || - !!od && - (goog.userAgent.IE ? od.xml : (root.xmlVersion || od.xmlVersion)); - - // NOTE: - // adding 'true' as the 2nd argument to getQueryFunc is useful for - // testing the DOM branch without worrying about the - // behavior/performance of the QSA branch. - var r = getQueryFunc(query)(root); - - // FIXME(slightlyoff): - // need to investigate this branch WRT dojo:#8074 and dojo:#8075 - if (r && r.nozip) { - return r; - } - return _zip(r); - } - - // FIXME: need to add infrastructure for post-filtering pseudos, ala :last - query.pseudos = pseudos; - - return query; -})(); - -// TODO(arv): Please don't export here since it clobbers dead code elimination. -goog.exportSymbol('goog.dom.query', goog.dom.query); -goog.exportSymbol('goog.dom.query.pseudos', goog.dom.query.pseudos); diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/dojo/dom/.svn/text-base/query_test.html.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/dojo/dom/.svn/text-base/query_test.html.svn-base deleted file mode 100644 index b7fcfa6..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/dojo/dom/.svn/text-base/query_test.html.svn-base +++ /dev/null @@ -1,62 +0,0 @@ -<!DOCTYPE html> -<!-- -Copyright 2005-2008, The Dojo Foundation -Modifications Copyright 2008 The Closure Library Authors. All Rights Reserved. -All Rights Reserved ---> -<html> -<head> - <title>Closure Unit Tests - goog.dom</title> - <script src="../../../../../closure/goog/base.js"></script> - <script> - goog.require('goog.testing.jsunit'); - </script> - <script src="query_test.js"></script> -</head> -<body> - <h1>testing goog.dom.query()</h1> - <div id="t"> - <h3>h3 <span>span</span> endh3 </h3> - <!-- comment to throw things off --> - <div class="foo bar" id="_foo"> - <h3>h3</h3> - <span id="foo"></span> - <span></span> - </div> - <h3>h3</h3> - <h3 class="baz" title="thud">h3</h3> - <span class="foobar baz foo"></span> - <span foo="bar"></span> - <span foo="baz bar thud"></span> - <!-- FIXME: should foo="bar-baz-thud" match? [foo$=thud] ??? --> - <span foo="bar-baz-thudish" id="silly:id::with:colons"></span> - <div id="container"> - <div id="child1" qux="true"></div> - <div id="child2"></div> - <div id="child3" qux="true"></div> - </div> - <div qux="true"></div> - <input id="notbug" name="bug" type="hidden" value="failed"> - <input id="bug" type="hidden" value="passed"> - </div> - - <div class="myupperclass"> - <span class="myclass"> - <input id="myid1"> - </span> - <span class="myclass"> - <input id="myid2"> - </span> - </div> - - <iframe name=ifr></iframe> - <div id=iframe-test> - <div id=if1> - <div class=if2> - <div id=if3></div> - </div> - </div> - </div> - -</body> -</html> diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/dojo/dom/.svn/text-base/query_test.js.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/dojo/dom/.svn/text-base/query_test.js.svn-base deleted file mode 100644 index 6dd664e..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/dojo/dom/.svn/text-base/query_test.js.svn-base +++ /dev/null @@ -1,162 +0,0 @@ -goog.require('goog.dom'); -goog.require('goog.dom.query'); -goog.require('goog.testing.asserts'); // assertThrows - -goog.setTestOnly('query_test'); - -function testBasicSelectors() { - assertQuery(4, 'h3'); - assertQuery(1, 'h1:first-child'); - assertQuery(2, 'h3:first-child'); - assertQuery(1, '#t'); - assertQuery(1, '#bug'); - assertQuery(4, '#t h3'); - assertQuery(1, 'div#t'); - assertQuery(4, 'div#t h3'); - assertQuery(0, 'span#t'); - assertQuery(1, '#t div > h3'); - assertQuery(2, '.foo'); - assertQuery(1, '.foo.bar'); - assertQuery(2, '.baz'); - assertQuery(3, '#t > h3'); -} - -function testSyntacticEquivalents() { - // syntactic equivalents - assertQuery(12, '#t > *'); - assertQuery(12, '#t >'); - assertQuery(3, '.foo > *'); - assertQuery(3, '.foo >'); -} - -function testWithARootById() { - // with a root, by ID - assertQuery(3, '> *', 'container'); - assertQuery(3, '> h3', 't'); -} - -function testCompoundQueries() { - // compound queries - assertQuery(2, '.foo, .bar'); - assertQuery(2, '.foo,.bar'); -} - -function testMultipleClassAttributes() { - // multiple class attribute - assertQuery(1, '.foo.bar'); - assertQuery(2, '.foo'); - assertQuery(2, '.baz'); -} - -function testCaseSensitivity() { - // case sensitivity - assertQuery(1, 'span.baz'); - assertQuery(1, 'sPaN.baz'); - assertQuery(1, 'SPAN.baz'); - assertQuery(1, '[class = \"foo bar\"]'); - assertQuery(2, '[foo~=\"bar\"]'); - assertQuery(2, '[ foo ~= \"bar\" ]'); -} - -function testAttributes() { - assertQuery(3, '[foo]'); - assertQuery(1, '[foo$=\"thud\"]'); - assertQuery(1, '[foo$=thud]'); - assertQuery(1, '[foo$=\"thudish\"]'); - assertQuery(1, '#t [foo$=thud]'); - assertQuery(1, '#t [ title $= thud ]'); - assertQuery(0, '#t span[ title $= thud ]'); - assertQuery(2, '[foo|=\"bar\"]'); - assertQuery(1, '[foo|=\"bar-baz\"]'); - assertQuery(0, '[foo|=\"baz\"]'); -} - -function testDescendantSelectors() { - assertQuery(3, '>', 'container'); - assertQuery(3, '> *', 'container'); - assertQuery(2, '> [qux]', 'container'); - assertEquals('child1', goog.dom.query('> [qux]', 'container')[0].id); - assertEquals('child3', goog.dom.query('> [qux]', 'container')[1].id); - assertQuery(3, '>', 'container'); - assertQuery(3, '> *', 'container'); -} - -function testSiblingSelectors() { - assertQuery(1, '+', 'container'); - assertQuery(3, '~', 'container'); - assertQuery(1, '.foo + span'); - assertQuery(4, '.foo ~ span'); - assertQuery(1, '#foo ~ *'); - assertQuery(1, '#foo ~'); -} - -function testSubSelectors() { - // sub-selector parsing - assertQuery(1, '#t span.foo:not(span:first-child)'); - assertQuery(1, '#t span.foo:not(:first-child)'); -} - -function testNthChild() { - assertEquals(goog.dom.$('_foo'), goog.dom.query('.foo:nth-child(2)')[0]); - assertQuery(2, '#t > h3:nth-child(odd)'); - assertQuery(3, '#t h3:nth-child(odd)'); - assertQuery(3, '#t h3:nth-child(2n+1)'); - assertQuery(1, '#t h3:nth-child(even)'); - assertQuery(1, '#t h3:nth-child(2n)'); - assertQuery(1, '#t h3:nth-child(2n+3)'); - assertQuery(2, '#t h3:nth-child(1)'); - assertQuery(1, '#t > h3:nth-child(1)'); - assertQuery(3, '#t :nth-child(3)'); - assertQuery(0, '#t > div:nth-child(1)'); - assertQuery(7, '#t span'); - assertQuery(3, '#t > *:nth-child(n+10)'); - assertQuery(1, '#t > *:nth-child(n+12)'); - assertQuery(10, '#t > *:nth-child(-n+10)'); - assertQuery(5, '#t > *:nth-child(-2n+10)'); - assertQuery(6, '#t > *:nth-child(2n+2)'); - assertQuery(5, '#t > *:nth-child(2n+4)'); - assertQuery(5, '#t > *:nth-child(2n+4)'); - assertQuery(12, '#t > *:nth-child(n-5)'); - assertQuery(6, '#t > *:nth-child(2n-5)'); -} - -function testEmptyPseudoSelector() { - assertQuery(4, '#t > span:empty'); - assertQuery(6, '#t span:empty'); - assertQuery(0, 'h3 span:empty'); - assertQuery(1, 'h3 :not(:empty)'); -} - -function testIdsWithColons(){ - assertQuery(1, "#silly\\:id\\:\\:with\\:colons"); -} - -function testOrder() { - var els = goog.dom.query('.myupperclass .myclass input'); - assertEquals('myid1', els[0].id); - assertEquals('myid2', els[1].id); -} - -function testCorrectDocumentInFrame() { - var frameDocument = window.frames['ifr'].document; - frameDocument.body.innerHTML = - document.getElementById('iframe-test').innerHTML; - - var els = goog.dom.query('#if1 .if2 div', document); - var frameEls = goog.dom.query('#if1 .if2 div', frameDocument); - - assertEquals(els.length, frameEls.length); - assertEquals(1, frameEls.length); - assertNotEquals(document.getElementById('if3'), - frameDocument.getElementById('if3')); -} - -/** - * @param {number} expectedNumberOfNodes - * @param {...*} var_args - */ -function assertQuery(expectedNumberOfNodes, var_args) { - var args = Array.prototype.slice.call(arguments, 1); - assertEquals(expectedNumberOfNodes, - goog.dom.query.apply(null, args).length); -} diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/dojo/dom/query.js b/contexts/data/lib/closure-library/third_party/closure/goog/dojo/dom/query.js index d6406df..ec4cc7a 100644 --- a/contexts/data/lib/closure-library/third_party/closure/goog/dojo/dom/query.js +++ b/contexts/data/lib/closure-library/third_party/closure/goog/dojo/dom/query.js @@ -96,8 +96,8 @@ goog.require('goog.userAgent'); * * `>` child element selectors * * `#foo` style ID selectors * * `*` universal selector - * * `~`, the immediately preceeded-by sibling selector - * * `+`, the preceeded-by sibling selector + * * `~`, the immediately preceded-by sibling selector + * * `+`, the preceded-by sibling selector * * attribute queries: * | * `[foo]` attribute presence selector * | * `[foo='bar']` attribute value exact match @@ -106,8 +106,8 @@ goog.require('goog.userAgent'); * | * `[foo$='bar']` attribute end match * | * `[foo*='bar']` attribute substring match * * `:first-child`, `:last-child` positional selectors - * * `:empty` content emtpy selector - * * `:empty` content emtpy selector + * * `:empty` content empty selector + * * `:empty` content empty selector * * `:nth-child(n)`, `:nth-child(2n+1)` style positional calculations * * `:nth-child(even)`, `:nth-child(odd)` positional selectors * * `:not(...)` negation pseudo selectors @@ -121,15 +121,15 @@ goog.require('goog.userAgent'); * ---------------------- * * While dojo.query handles many CSS3 selectors, some fall outside of - * what's resaonable for a programmatic node querying engine to + * what's reasonable for a programmatic node querying engine to * handle. Currently unsupported selectors include: * * * namespace-differentiated selectors of any form - * * all `::` pseduo-element selectors + * * all `::` pseudo-element selectors * * certain pseudo-selectors which don't get a lot of day-to-day use: * | * `:root`, `:lang()`, `:target`, `:focus` * * all visual and state selectors: - * | * `:root`, `:active`, `:hover`, `:visisted`, `:link`, + * | * `:root`, `:active`, `:hover`, `:visited`, `:link`, * `:enabled`, `:disabled`, `:checked` * * `:*-of-type` pseudo selectors * @@ -227,7 +227,7 @@ goog.dom.query = (function() { // the same query run multiple times or under different root nodes // does not re-parse the selector expression but instead uses the // cached data structure. The state machine implemented here - // terminates on the last " " (space) charachter and returns an + // terminates on the last " " (space) character and returns an // ordered array of query component structures (or "parts"). Each // part represents an operator or a simple CSS filtering // expression. The structure for parts is documented in the code @@ -236,7 +236,7 @@ goog.dom.query = (function() { // NOTE: // this code is designed to run fast and compress well. Sacrifices - // to readibility and maintainability have been made. + // to readability and maintainability have been made. if (specials.indexOf(query.slice(-1)) >= 0) { // If we end with a ">", "+", or "~", that means we're implicitly // searching all children, so make it explicit. @@ -278,7 +278,7 @@ goog.dom.query = (function() { currentPart = null, // data structure representing the entire clause cp = null; // the current pseudo or attr matcher - // several temporary variables are assigned to this structure durring a + // several temporary variables are assigned to this structure during a // potential sub-expression match: // attr: // a string representing the current full attribute match in a @@ -378,11 +378,11 @@ goog.dom.query = (function() { currentPart = null; } - // iterate over the query, charachter by charachter, building up a + // iterate over the query, character by character, building up a // list of query part objects for (; lc = cc, cc = query.charAt(x), x < ql; x++) { // cc: the current character in the match - // lc: the last charachter (if any) + // lc: the last character (if any) // someone is trying to escape something, so don't try to match any // fragments. We assume we're inside a literal. @@ -398,7 +398,7 @@ goog.dom.query = (function() { // .className:first-child // but not: // thinger > div.howdy[type=thinger] - // the indidual components of the previous query would be + // the individual components of the previous query would be // split into 3 parts that would be represented a structure // like: // [ @@ -417,7 +417,7 @@ goog.dom.query = (function() { // ] currentPart = { query: null, // the full text of the part's rule - pseudos: [], // CSS supports multiple pseud-class matches in a single + pseudos: [], // CSS supports multiple pseudo-class matches in a single // rule attrs: [], // CSS supports multi-attribute match, so we need an array classes: [], // class matches may be additive, @@ -443,7 +443,7 @@ goog.dom.query = (function() { if (cc == ']') { // if we're in a [...] clause and we end, do assignment if (!cp.attr) { // no attribute match was previously begun, so we - // assume this is an attribute existance match in the + // assume this is an attribute existence match in the // form of [someAttributeName] cp.attr = ts(inBrackets + 1, x); } else { @@ -475,7 +475,7 @@ goog.dom.query = (function() { // now look for other clause parts } else if (inParens >= 0) { // if we're in a parenthetical expression, we need to figure - // out if it's attached to a pseduo-selector rule like + // out if it's attached to a pseudo-selector rule like // :nth-child(1) if (cc == ')') { if (inPseudo >= 0) { @@ -538,7 +538,7 @@ goog.dom.query = (function() { // the basic building block of the yes/no chaining system. agree(f1, // f2) generates a new function which returns the boolean results of // both of the passed functions to a single logical-anded result. If - // either are not possed, the other is used exclusively. + // either are not passed, the other is used exclusively. if (!first) { return second; } @@ -687,7 +687,7 @@ goog.dom.query = (function() { } var l = tret.length; - // we calcuate the parent length as a cheap way to invalidate the + // we calculate the parent length as a cheap way to invalidate the // cache. It's not 100% accurate, but it's much more honest than what // other libraries do if (cl == l && ci >= 0 && cl >= 0) { @@ -704,7 +704,7 @@ goog.dom.query = (function() { te['_i'] = ++i; if (node === te) { // NOTE: - // shortcuting the return at this step in indexing works + // shortcutting the return at this step in indexing works // very well for benchmarking but we avoid it here since // it leads to potential O(n^2) behavior in sequential // getNodexIndex operations on a previously un-indexed @@ -854,7 +854,7 @@ goog.dom.query = (function() { var getSimpleFilterFunc = function(query, ignores) { // Generates a node tester function based on the passed query part. The - // query part is one of the structures generatd by the query parser when it + // query part is one of the structures generated by the query parser when it // creates the query AST. The 'ignores' object specifies which (if any) // tests to skip, allowing the system to avoid duplicating work where it // may have already been taken into account by other factors such as how @@ -1011,7 +1011,7 @@ goog.dom.query = (function() { // filters them. The search may be specialized by infix operators // (">", "~", or "+") else it will default to searching all // descendants (the " " selector). Once a group of children is - // founde, a test function is applied to weed out the ones we + // found, a test function is applied to weed out the ones we // don't want. Many common cases can be fast-pathed. We spend a // lot of cycles to create a dispatcher that doesn't do more work // than necessary at any point since, unlike this function, the @@ -1179,7 +1179,7 @@ goog.dom.query = (function() { // if we have more than one root at this level, provide a new // hash to use for checking group membership but tell the // system not to post-filter us since we will already have been - // gauranteed to be unique + // guaranteed to be unique bag = {}; ret.nozip = true; } @@ -1208,7 +1208,7 @@ goog.dom.query = (function() { var _queryFuncCacheDOM = {}, _queryFuncCacheQSA = {}; - // this is the second level of spliting, from full-length queries (e.g., + // this is the second level of splitting, from full-length queries (e.g., // 'div.foo .bar') into simple query expressions (e.g., ['div.foo', // '.bar']) var getStepQueryFunc = function(query) { @@ -1254,7 +1254,7 @@ goog.dom.query = (function() { var qsa = 'querySelectorAll'; // some versions of Safari provided QSA, but it was buggy and crash-prone. - // We need te detect the right 'internal' webkit version to make this work. + // We need to detect the right 'internal' webkit version to make this work. var qsaAvail = ( !!goog.dom.getDocument()[qsa] && // see #5832 @@ -1411,7 +1411,7 @@ goog.dom.query = (function() { }; // attempt to efficiently determine if an item in a list is a dupe, - // returning a list of 'uniques', hopefully in doucment order + // returning a list of 'uniques', hopefully in document order var _zipIdxName = '_zipIdx'; var _zip = function(arr) { if (arr && arr.nozip) { diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/jpeg_encoder/.svn/all-wcprops b/contexts/data/lib/closure-library/third_party/closure/goog/jpeg_encoder/.svn/all-wcprops deleted file mode 100644 index c280ab2..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/jpeg_encoder/.svn/all-wcprops +++ /dev/null @@ -1,11 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 61 -/svn/!svn/ver/850/trunk/third_party/closure/goog/jpeg_encoder -END -jpeg_encoder_basic.js -K 25 -svn:wc:ra_dav:version-url -V 83 -/svn/!svn/ver/850/trunk/third_party/closure/goog/jpeg_encoder/jpeg_encoder_basic.js -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/jpeg_encoder/.svn/entries b/contexts/data/lib/closure-library/third_party/closure/goog/jpeg_encoder/.svn/entries deleted file mode 100644 index 12fdac5..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/jpeg_encoder/.svn/entries +++ /dev/null @@ -1,62 +0,0 @@ -10 - -dir -1494 -http://closure-library.googlecode.com/svn/trunk/third_party/closure/goog/jpeg_encoder -http://closure-library.googlecode.com/svn - - - -2011-04-12T20:35:47.000000Z -850 -diegosalas@google.com - - - - - - - - - - - - - - -0b95b8e8-c90f-11de-9d4f-f947ee5921c8 - -jpeg_encoder_basic.js -file - - - - -2011-12-23T22:42:21.424242Z -9c2a52e755148e260fe7f6baab80057c -2011-04-12T20:35:47.000000Z -850 -diegosalas@google.com -has-props - - - - - - - - - - - - - - - - - - - - -21928 - diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/jpeg_encoder/.svn/prop-base/jpeg_encoder_basic.js.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/jpeg_encoder/.svn/prop-base/jpeg_encoder_basic.js.svn-base deleted file mode 100644 index 7febff5..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/jpeg_encoder/.svn/prop-base/jpeg_encoder_basic.js.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 22 -application/javascript -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/jpeg_encoder/.svn/text-base/jpeg_encoder_basic.js.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/jpeg_encoder/.svn/text-base/jpeg_encoder_basic.js.svn-base deleted file mode 100644 index aadccfb..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/jpeg_encoder/.svn/text-base/jpeg_encoder_basic.js.svn-base +++ /dev/null @@ -1,751 +0,0 @@ -/** - * @license - Copyright (c) 2008, Adobe Systems Incorporated - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Adobe Systems Incorporated nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS - IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -/** - * @license -JPEG encoder ported to JavaScript and optimized by Andreas Ritter, www.bytestrom.eu, 11/2009 - -Basic GUI blocking jpeg encoder - -v 0.9 -*/ - -/** - * @fileoverview This code was ported from - * http://www.bytestrom.eu/blog/2009/1120a_jpeg_encoder_for_javascript and - * modified slightly for Closure. - */ - -goog.provide('goog.crypt.JpegEncoder'); - -goog.require('goog.crypt.base64'); - -/** - * Initializes the JpegEncoder. - * - * @constructor - * @param {number=} opt_quality The compression quality. Default 50. - */ -goog.crypt.JpegEncoder = function(opt_quality) { - var self = this; - var fround = Math.round; - var ffloor = Math.floor; - var YTable = new Array(64); - var UVTable = new Array(64); - var fdtbl_Y = new Array(64); - var fdtbl_UV = new Array(64); - var YDC_HT; - var UVDC_HT; - var YAC_HT; - var UVAC_HT; - - var bitcode = new Array(65535); - var category = new Array(65535); - var outputfDCTQuant = new Array(64); - var DU = new Array(64); - var byteout = []; - var bytenew = 0; - var bytepos = 7; - - var YDU = new Array(64); - var UDU = new Array(64); - var VDU = new Array(64); - var clt = new Array(256); - var RGB_YUV_TABLE = new Array(2048); - var currentQuality; - - var ZigZag = [ - 0, 1, 5, 6,14,15,27,28, - 2, 4, 7,13,16,26,29,42, - 3, 8,12,17,25,30,41,43, - 9,11,18,24,31,40,44,53, - 10,19,23,32,39,45,52,54, - 20,22,33,38,46,51,55,60, - 21,34,37,47,50,56,59,61, - 35,36,48,49,57,58,62,63 - ]; - - var std_dc_luminance_nrcodes = [0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0]; - var std_dc_luminance_values = [0,1,2,3,4,5,6,7,8,9,10,11]; - var std_ac_luminance_nrcodes = [0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,0x7d]; - var std_ac_luminance_values = [ - 0x01,0x02,0x03,0x00,0x04,0x11,0x05,0x12, - 0x21,0x31,0x41,0x06,0x13,0x51,0x61,0x07, - 0x22,0x71,0x14,0x32,0x81,0x91,0xa1,0x08, - 0x23,0x42,0xb1,0xc1,0x15,0x52,0xd1,0xf0, - 0x24,0x33,0x62,0x72,0x82,0x09,0x0a,0x16, - 0x17,0x18,0x19,0x1a,0x25,0x26,0x27,0x28, - 0x29,0x2a,0x34,0x35,0x36,0x37,0x38,0x39, - 0x3a,0x43,0x44,0x45,0x46,0x47,0x48,0x49, - 0x4a,0x53,0x54,0x55,0x56,0x57,0x58,0x59, - 0x5a,0x63,0x64,0x65,0x66,0x67,0x68,0x69, - 0x6a,0x73,0x74,0x75,0x76,0x77,0x78,0x79, - 0x7a,0x83,0x84,0x85,0x86,0x87,0x88,0x89, - 0x8a,0x92,0x93,0x94,0x95,0x96,0x97,0x98, - 0x99,0x9a,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7, - 0xa8,0xa9,0xaa,0xb2,0xb3,0xb4,0xb5,0xb6, - 0xb7,0xb8,0xb9,0xba,0xc2,0xc3,0xc4,0xc5, - 0xc6,0xc7,0xc8,0xc9,0xca,0xd2,0xd3,0xd4, - 0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xe1,0xe2, - 0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea, - 0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8, - 0xf9,0xfa - ]; - - var std_dc_chrominance_nrcodes = [0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0]; - var std_dc_chrominance_values = [0,1,2,3,4,5,6,7,8,9,10,11]; - var std_ac_chrominance_nrcodes = [0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,0x77]; - var std_ac_chrominance_values = [ - 0x00,0x01,0x02,0x03,0x11,0x04,0x05,0x21, - 0x31,0x06,0x12,0x41,0x51,0x07,0x61,0x71, - 0x13,0x22,0x32,0x81,0x08,0x14,0x42,0x91, - 0xa1,0xb1,0xc1,0x09,0x23,0x33,0x52,0xf0, - 0x15,0x62,0x72,0xd1,0x0a,0x16,0x24,0x34, - 0xe1,0x25,0xf1,0x17,0x18,0x19,0x1a,0x26, - 0x27,0x28,0x29,0x2a,0x35,0x36,0x37,0x38, - 0x39,0x3a,0x43,0x44,0x45,0x46,0x47,0x48, - 0x49,0x4a,0x53,0x54,0x55,0x56,0x57,0x58, - 0x59,0x5a,0x63,0x64,0x65,0x66,0x67,0x68, - 0x69,0x6a,0x73,0x74,0x75,0x76,0x77,0x78, - 0x79,0x7a,0x82,0x83,0x84,0x85,0x86,0x87, - 0x88,0x89,0x8a,0x92,0x93,0x94,0x95,0x96, - 0x97,0x98,0x99,0x9a,0xa2,0xa3,0xa4,0xa5, - 0xa6,0xa7,0xa8,0xa9,0xaa,0xb2,0xb3,0xb4, - 0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xc2,0xc3, - 0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xd2, - 0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda, - 0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9, - 0xea,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8, - 0xf9,0xfa - ]; - - function initQuantTables(sf){ - var YQT = [ - 16, 11, 10, 16, 24, 40, 51, 61, - 12, 12, 14, 19, 26, 58, 60, 55, - 14, 13, 16, 24, 40, 57, 69, 56, - 14, 17, 22, 29, 51, 87, 80, 62, - 18, 22, 37, 56, 68,109,103, 77, - 24, 35, 55, 64, 81,104,113, 92, - 49, 64, 78, 87,103,121,120,101, - 72, 92, 95, 98,112,100,103, 99 - ]; - - for (var i = 0; i < 64; i++) { - var t = ffloor((YQT[i]*sf+50)/100); - if (t < 1) { - t = 1; - } else if (t > 255) { - t = 255; - } - YTable[ZigZag[i]] = t; - } - var UVQT = [ - 17, 18, 24, 47, 99, 99, 99, 99, - 18, 21, 26, 66, 99, 99, 99, 99, - 24, 26, 56, 99, 99, 99, 99, 99, - 47, 66, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 99 - ]; - for (var j = 0; j < 64; j++) { - var u = ffloor((UVQT[j]*sf+50)/100); - if (u < 1) { - u = 1; - } else if (u > 255) { - u = 255; - } - UVTable[ZigZag[j]] = u; - } - var aasf = [ - 1.0, 1.387039845, 1.306562965, 1.175875602, - 1.0, 0.785694958, 0.541196100, 0.275899379 - ]; - var k = 0; - for (var row = 0; row < 8; row++) - { - for (var col = 0; col < 8; col++) - { - fdtbl_Y[k] = (1.0 / (YTable [ZigZag[k]] * aasf[row] * aasf[col] * 8.0)); - fdtbl_UV[k] = (1.0 / (UVTable[ZigZag[k]] * aasf[row] * aasf[col] * 8.0)); - k++; - } - } - } - - function computeHuffmanTbl(nrcodes, std_table){ - var codevalue = 0; - var pos_in_table = 0; - var HT = new Array(); - for (var k = 1; k <= 16; k++) { - for (var j = 1; j <= nrcodes[k]; j++) { - HT[std_table[pos_in_table]] = []; - HT[std_table[pos_in_table]][0] = codevalue; - HT[std_table[pos_in_table]][1] = k; - pos_in_table++; - codevalue++; - } - codevalue*=2; - } - return HT; - } - - function initHuffmanTbl() - { - YDC_HT = computeHuffmanTbl(std_dc_luminance_nrcodes,std_dc_luminance_values); - UVDC_HT = computeHuffmanTbl(std_dc_chrominance_nrcodes,std_dc_chrominance_values); - YAC_HT = computeHuffmanTbl(std_ac_luminance_nrcodes,std_ac_luminance_values); - UVAC_HT = computeHuffmanTbl(std_ac_chrominance_nrcodes,std_ac_chrominance_values); - } - - function initCategoryNumber() - { - var nrlower = 1; - var nrupper = 2; - for (var cat = 1; cat <= 15; cat++) { - //Positive numbers - for (var nr = nrlower; nr<nrupper; nr++) { - category[32767+nr] = cat; - bitcode[32767+nr] = []; - bitcode[32767+nr][1] = cat; - bitcode[32767+nr][0] = nr; - } - //Negative numbers - for (var nrneg =-(nrupper-1); nrneg<=-nrlower; nrneg++) { - category[32767+nrneg] = cat; - bitcode[32767+nrneg] = []; - bitcode[32767+nrneg][1] = cat; - bitcode[32767+nrneg][0] = nrupper-1+nrneg; - } - nrlower <<= 1; - nrupper <<= 1; - } - } - - function initRGBYUVTable() { - for(var i = 0; i < 256;i++) { - RGB_YUV_TABLE[i] = 19595 * i; - RGB_YUV_TABLE[(i+ 256)>>0] = 38470 * i; - RGB_YUV_TABLE[(i+ 512)>>0] = 7471 * i + 0x8000; - RGB_YUV_TABLE[(i+ 768)>>0] = -11059 * i; - RGB_YUV_TABLE[(i+1024)>>0] = -21709 * i; - RGB_YUV_TABLE[(i+1280)>>0] = 32768 * i + 0x807FFF; - RGB_YUV_TABLE[(i+1536)>>0] = -27439 * i; - RGB_YUV_TABLE[(i+1792)>>0] = - 5329 * i; - } - } - - // IO functions - function writeBits(bs) - { - var value = bs[0]; - var posval = bs[1]-1; - while ( posval >= 0 ) { - if (value & (1 << posval) ) { - bytenew |= (1 << bytepos); - } - posval--; - bytepos--; - if (bytepos < 0) { - if (bytenew == 0xFF) { - writeByte(0xFF); - writeByte(0); - } - else { - writeByte(bytenew); - } - bytepos=7; - bytenew=0; - } - } - } - - function writeByte(value) - { - byteout.push(clt[value]); // write char directly instead of converting later - } - - function writeWord(value) - { - writeByte((value>>8)&0xFF); - writeByte((value )&0xFF); - } - - // DCT & quantization core - function fDCTQuant(data, fdtbl) - { - var d0, d1, d2, d3, d4, d5, d6, d7; - /* Pass 1: process rows. */ - var dataOff=0; - var i; - var I8 = 8; - var I64 = 64; - for (i=0; i<I8; ++i) - { - d0 = data[dataOff]; - d1 = data[dataOff+1]; - d2 = data[dataOff+2]; - d3 = data[dataOff+3]; - d4 = data[dataOff+4]; - d5 = data[dataOff+5]; - d6 = data[dataOff+6]; - d7 = data[dataOff+7]; - - var tmp0 = d0 + d7; - var tmp7 = d0 - d7; - var tmp1 = d1 + d6; - var tmp6 = d1 - d6; - var tmp2 = d2 + d5; - var tmp5 = d2 - d5; - var tmp3 = d3 + d4; - var tmp4 = d3 - d4; - - /* Even part */ - var tmp10 = tmp0 + tmp3; /* phase 2 */ - var tmp13 = tmp0 - tmp3; - var tmp11 = tmp1 + tmp2; - var tmp12 = tmp1 - tmp2; - - data[dataOff] = tmp10 + tmp11; /* phase 3 */ - data[dataOff+4] = tmp10 - tmp11; - - var z1 = (tmp12 + tmp13) * 0.707106781; /* c4 */ - data[dataOff+2] = tmp13 + z1; /* phase 5 */ - data[dataOff+6] = tmp13 - z1; - - /* Odd part */ - tmp10 = tmp4 + tmp5; /* phase 2 */ - tmp11 = tmp5 + tmp6; - tmp12 = tmp6 + tmp7; - - /* The rotator is modified from fig 4-8 to avoid extra negations. */ - var z5 = (tmp10 - tmp12) * 0.382683433; /* c6 */ - var z2 = 0.541196100 * tmp10 + z5; /* c2-c6 */ - var z4 = 1.306562965 * tmp12 + z5; /* c2+c6 */ - var z3 = tmp11 * 0.707106781; /* c4 */ - - var z11 = tmp7 + z3; /* phase 5 */ - var z13 = tmp7 - z3; - - data[dataOff+5] = z13 + z2; /* phase 6 */ - data[dataOff+3] = z13 - z2; - data[dataOff+1] = z11 + z4; - data[dataOff+7] = z11 - z4; - - dataOff += 8; /* advance pointer to next row */ - } - - /* Pass 2: process columns. */ - dataOff = 0; - for (i=0; i<I8; ++i) - { - d0 = data[dataOff]; - d1 = data[dataOff + 8]; - d2 = data[dataOff + 16]; - d3 = data[dataOff + 24]; - d4 = data[dataOff + 32]; - d5 = data[dataOff + 40]; - d6 = data[dataOff + 48]; - d7 = data[dataOff + 56]; - - var tmp0p2 = d0 + d7; - var tmp7p2 = d0 - d7; - var tmp1p2 = d1 + d6; - var tmp6p2 = d1 - d6; - var tmp2p2 = d2 + d5; - var tmp5p2 = d2 - d5; - var tmp3p2 = d3 + d4; - var tmp4p2 = d3 - d4; - - /* Even part */ - var tmp10p2 = tmp0p2 + tmp3p2; /* phase 2 */ - var tmp13p2 = tmp0p2 - tmp3p2; - var tmp11p2 = tmp1p2 + tmp2p2; - var tmp12p2 = tmp1p2 - tmp2p2; - - data[dataOff] = tmp10p2 + tmp11p2; /* phase 3 */ - data[dataOff+32] = tmp10p2 - tmp11p2; - - var z1p2 = (tmp12p2 + tmp13p2) * 0.707106781; /* c4 */ - data[dataOff+16] = tmp13p2 + z1p2; /* phase 5 */ - data[dataOff+48] = tmp13p2 - z1p2; - - /* Odd part */ - tmp10p2 = tmp4p2 + tmp5p2; /* phase 2 */ - tmp11p2 = tmp5p2 + tmp6p2; - tmp12p2 = tmp6p2 + tmp7p2; - - /* The rotator is modified from fig 4-8 to avoid extra negations. */ - var z5p2 = (tmp10p2 - tmp12p2) * 0.382683433; /* c6 */ - var z2p2 = 0.541196100 * tmp10p2 + z5p2; /* c2-c6 */ - var z4p2 = 1.306562965 * tmp12p2 + z5p2; /* c2+c6 */ - var z3p2 = tmp11p2 * 0.707106781; /* c4 */ - - var z11p2 = tmp7p2 + z3p2; /* phase 5 */ - var z13p2 = tmp7p2 - z3p2; - - data[dataOff+40] = z13p2 + z2p2; /* phase 6 */ - data[dataOff+24] = z13p2 - z2p2; - data[dataOff+ 8] = z11p2 + z4p2; - data[dataOff+56] = z11p2 - z4p2; - - dataOff++; /* advance pointer to next column */ - } - - // Quantize/descale the coefficients - var fDCTQuant; - for (i=0; i<I64; ++i) - { - // Apply the quantization and scaling factor & Round to nearest integer - fDCTQuant = data[i]*fdtbl[i]; - outputfDCTQuant[i] = (fDCTQuant > 0.0) ? ((fDCTQuant + 0.5)|0) : ((fDCTQuant - 0.5)|0); - //outputfDCTQuant[i] = fround(fDCTQuant); - - } - return outputfDCTQuant; - } - - function writeAPP0() - { - writeWord(0xFFE0); // marker - writeWord(16); // length - writeByte(0x4A); // J - writeByte(0x46); // F - writeByte(0x49); // I - writeByte(0x46); // F - writeByte(0); // = "JFIF",'\0' - writeByte(1); // versionhi - writeByte(1); // versionlo - writeByte(0); // xyunits - writeWord(1); // xdensity - writeWord(1); // ydensity - writeByte(0); // thumbnwidth - writeByte(0); // thumbnheight - } - - function writeSOF0(width, height) - { - writeWord(0xFFC0); // marker - writeWord(17); // length, truecolor YUV JPG - writeByte(8); // precision - writeWord(height); - writeWord(width); - writeByte(3); // nrofcomponents - writeByte(1); // IdY - writeByte(0x11); // HVY - writeByte(0); // QTY - writeByte(2); // IdU - writeByte(0x11); // HVU - writeByte(1); // QTU - writeByte(3); // IdV - writeByte(0x11); // HVV - writeByte(1); // QTV - } - - function writeDQT() - { - writeWord(0xFFDB); // marker - writeWord(132); // length - writeByte(0); - for (var i=0; i<64; i++) { - writeByte(YTable[i]); - } - writeByte(1); - for (var j=0; j<64; j++) { - writeByte(UVTable[j]); - } - } - - function writeDHT() - { - writeWord(0xFFC4); // marker - writeWord(0x01A2); // length - - writeByte(0); // HTYDCinfo - for (var i=0; i<16; i++) { - writeByte(std_dc_luminance_nrcodes[i+1]); - } - for (var j=0; j<=11; j++) { - writeByte(std_dc_luminance_values[j]); - } - - writeByte(0x10); // HTYACinfo - for (var k=0; k<16; k++) { - writeByte(std_ac_luminance_nrcodes[k+1]); - } - for (var l=0; l<=161; l++) { - writeByte(std_ac_luminance_values[l]); - } - - writeByte(1); // HTUDCinfo - for (var m=0; m<16; m++) { - writeByte(std_dc_chrominance_nrcodes[m+1]); - } - for (var n=0; n<=11; n++) { - writeByte(std_dc_chrominance_values[n]); - } - - writeByte(0x11); // HTUACinfo - for (var o=0; o<16; o++) { - writeByte(std_ac_chrominance_nrcodes[o+1]); - } - for (var p=0; p<=161; p++) { - writeByte(std_ac_chrominance_values[p]); - } - } - - function writeSOS() - { - writeWord(0xFFDA); // marker - writeWord(12); // length - writeByte(3); // nrofcomponents - writeByte(1); // IdY - writeByte(0); // HTY - writeByte(2); // IdU - writeByte(0x11); // HTU - writeByte(3); // IdV - writeByte(0x11); // HTV - writeByte(0); // Ss - writeByte(0x3f); // Se - writeByte(0); // Bf - } - - function processDU(CDU, fdtbl, DC, HTDC, HTAC){ - var EOB = HTAC[0x00]; - var M16zeroes = HTAC[0xF0]; - var pos; - var I16 = 16; - var I63 = 63; - var I64 = 64; - var DU_DCT = fDCTQuant(CDU, fdtbl); - //ZigZag reorder - for (var j=0;j<I64;++j) { - DU[ZigZag[j]]=DU_DCT[j]; - } - var Diff = DU[0] - DC; DC = DU[0]; - //Encode DC - if (Diff==0) { - writeBits(HTDC[0]); // Diff might be 0 - } else { - pos = 32767+Diff; - writeBits(HTDC[category[pos]]); - writeBits(bitcode[pos]); - } - //Encode ACs - var end0pos = 63; // was const... which is crazy - for (; (end0pos>0)&&(DU[end0pos]==0); end0pos--) {}; - //end0pos = first element in reverse order !=0 - if ( end0pos == 0) { - writeBits(EOB); - return DC; - } - var i = 1; - var lng; - while ( i <= end0pos ) { - var startpos = i; - for (; (DU[i]==0) && (i<=end0pos); ++i) {} - var nrzeroes = i-startpos; - if ( nrzeroes >= I16 ) { - lng = nrzeroes>>4; - for (var nrmarker=1; nrmarker <= lng; ++nrmarker) - writeBits(M16zeroes); - nrzeroes = nrzeroes&0xF; - } - pos = 32767+DU[i]; - writeBits(HTAC[(nrzeroes<<4)+category[pos]]); - writeBits(bitcode[pos]); - i++; - } - if ( end0pos != I63 ) { - writeBits(EOB); - } - return DC; - } - - function initCharLookupTable(){ - var sfcc = String.fromCharCode; - for(var i=0; i < 256; i++){ ///// ACHTUNG // 255 - clt[i] = sfcc(i); - } - } - -/** - * Encodes ImageData to JPEG. - * - * @param {ImageData} image - * @param {number=} opt_quality The compression quality. - * @return {string} base64-encoded JPEG data. - */ - this.encode = function(image,opt_quality) // image data object - { - if(opt_quality) setQuality(opt_quality); - - // Initialize bit writer - byteout = new Array(); - bytenew=0; - bytepos=7; - - // Add JPEG headers - writeWord(0xFFD8); // SOI - writeAPP0(); - writeDQT(); - writeSOF0(image.width,image.height); - writeDHT(); - writeSOS(); - - - // Encode 8x8 macroblocks - var _DCY=0; - var _DCU=0; - var _DCV=0; - - bytenew=0; - bytepos=7; - - - this.encode.displayName = "_encode_"; - - var imageData = image.data; - var width = image.width; - var height = image.height; - - var quadWidth = width*4; - var tripleWidth = width*3; - - var x, y = 0; - var r, g, b; - var start,p, col,row,pos; - while(y < height){ - x = 0; - while(x < quadWidth){ - start = quadWidth * y + x; - p = start; - col = -1; - row = 0; - - for(pos=0; pos < 64; pos++){ - row = pos >> 3;// /8 - col = ( pos & 7 ) * 4; // %8 - p = start + ( row * quadWidth ) + col; - - if(y+row >= height){ // padding bottom - p-= (quadWidth*(y+1+row-height)); - } - - if(x+col >= quadWidth){ // padding right - p-= ((x+col) - quadWidth +4) - } - - r = imageData[ p++ ]; - g = imageData[ p++ ]; - b = imageData[ p++ ]; - - - /* // calculate YUV values dynamically - YDU[pos]=((( 0.29900)*r+( 0.58700)*g+( 0.11400)*b))-128; //-0x80 - UDU[pos]=(((-0.16874)*r+(-0.33126)*g+( 0.50000)*b)); - VDU[pos]=((( 0.50000)*r+(-0.41869)*g+(-0.08131)*b)); - */ - - // use lookup table (slightly faster) - YDU[pos] = ((RGB_YUV_TABLE[r] + RGB_YUV_TABLE[(g + 256)>>0] + RGB_YUV_TABLE[(b + 512)>>0]) >> 16)-128; - UDU[pos] = ((RGB_YUV_TABLE[(r + 768)>>0] + RGB_YUV_TABLE[(g + 1024)>>0] + RGB_YUV_TABLE[(b + 1280)>>0]) >> 16)-128; - VDU[pos] = ((RGB_YUV_TABLE[(r + 1280)>>0] + RGB_YUV_TABLE[(g + 1536)>>0] + RGB_YUV_TABLE[(b + 1792)>>0]) >> 16)-128; - - } - - _DCY = processDU(YDU, fdtbl_Y, _DCY, YDC_HT, YAC_HT); - _DCU = processDU(UDU, fdtbl_UV, _DCU, UVDC_HT, UVAC_HT); - _DCV = processDU(VDU, fdtbl_UV, _DCV, UVDC_HT, UVAC_HT); - x+=32; - } - y+=8; - } - - - //////////////////////////////////////////////////////////////// - - // Do the bit alignment of the EOI marker - if ( bytepos >= 0 ) { - var fillbits = []; - fillbits[1] = bytepos+1; - fillbits[0] = (1<<(bytepos+1))-1; - writeBits(fillbits); - } - - writeWord(0xFFD9); //EOI - - var jpegDataUri = 'data:image/jpeg;base64,' - + goog.crypt.base64.encodeString(byteout.join('')); - - byteout = []; - - return jpegDataUri - } - - function setQuality(quality){ - if (quality <= 0) { - quality = 1; - } - if (quality > 100) { - quality = 100; - } - - if(currentQuality == quality) return // don't recalc if unchanged - - var sf = 0; - if (quality < 50) { - sf = Math.floor(5000 / quality); - } else { - sf = Math.floor(200 - quality*2); - } - - initQuantTables(sf); - currentQuality = quality; - } - - function init(){ - if(!opt_quality) opt_quality = 50; - // Create tables - initCharLookupTable() - initHuffmanTbl(); - initCategoryNumber(); - initRGBYUVTable(); - - setQuality(opt_quality); - } - - init(); - -}; diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/loremipsum/.svn/all-wcprops b/contexts/data/lib/closure-library/third_party/closure/goog/loremipsum/.svn/all-wcprops deleted file mode 100644 index c0175ac..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/loremipsum/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 60 -/svn/!svn/ver/1434/trunk/third_party/closure/goog/loremipsum -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/loremipsum/.svn/entries b/contexts/data/lib/closure-library/third_party/closure/goog/loremipsum/.svn/entries deleted file mode 100644 index 72d726f..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/loremipsum/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -1494 -http://closure-library.googlecode.com/svn/trunk/third_party/closure/goog/loremipsum -http://closure-library.googlecode.com/svn - - - -2011-11-30T22:16:21.000000Z -1434 -chrishenry@google.com - - - - - - - - - - - - - - -0b95b8e8-c90f-11de-9d4f-f947ee5921c8 - -text -dir - diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/loremipsum/text/.svn/all-wcprops b/contexts/data/lib/closure-library/third_party/closure/goog/loremipsum/text/.svn/all-wcprops deleted file mode 100644 index 05d40a5..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/loremipsum/text/.svn/all-wcprops +++ /dev/null @@ -1,17 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 65 -/svn/!svn/ver/1434/trunk/third_party/closure/goog/loremipsum/text -END -loremipsum.js -K 25 -svn:wc:ra_dav:version-url -V 78 -/svn/!svn/ver/850/trunk/third_party/closure/goog/loremipsum/text/loremipsum.js -END -loremipsum_test.html -K 25 -svn:wc:ra_dav:version-url -V 86 -/svn/!svn/ver/1434/trunk/third_party/closure/goog/loremipsum/text/loremipsum_test.html -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/loremipsum/text/.svn/entries b/contexts/data/lib/closure-library/third_party/closure/goog/loremipsum/text/.svn/entries deleted file mode 100644 index 49b4991..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/loremipsum/text/.svn/entries +++ /dev/null @@ -1,96 +0,0 @@ -10 - -dir -1494 -http://closure-library.googlecode.com/svn/trunk/third_party/closure/goog/loremipsum/text -http://closure-library.googlecode.com/svn - - - -2011-11-30T22:16:21.000000Z -1434 -chrishenry@google.com - - - - - - - - - - - - - - -0b95b8e8-c90f-11de-9d4f-f947ee5921c8 - -loremipsum.js -file - - - - -2011-12-23T22:42:21.596244Z -24fe3e450f08d12a9372fa45c82c9286 -2011-04-12T20:35:47.000000Z -850 -diegosalas@google.com -has-props - - - - - - - - - - - - - - - - - - - - -26915 - -loremipsum_test.html -file - - - - -2011-12-23T22:42:21.596244Z -73013f8a5ebacb1695c2f6037c9119e3 -2011-11-30T22:16:21.000000Z -1434 -chrishenry@google.com -has-props - - - - - - - - - - - - - - - - - - - - -2239 - diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/loremipsum/text/.svn/prop-base/loremipsum.js.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/loremipsum/text/.svn/prop-base/loremipsum.js.svn-base deleted file mode 100644 index 530636b..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/loremipsum/text/.svn/prop-base/loremipsum.js.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 15 -text/javascript -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/loremipsum/text/.svn/prop-base/loremipsum_test.html.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/loremipsum/text/.svn/prop-base/loremipsum_test.html.svn-base deleted file mode 100644 index d356868..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/loremipsum/text/.svn/prop-base/loremipsum_test.html.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 9 -text/html -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/loremipsum/text/.svn/text-base/loremipsum.js.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/loremipsum/text/.svn/text-base/loremipsum.js.svn-base deleted file mode 100644 index 903bfea..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/loremipsum/text/.svn/text-base/loremipsum.js.svn-base +++ /dev/null @@ -1,712 +0,0 @@ -// Copyright 2009 The Closure Library Authors. All Rights Reserved. - -/** - * @fileoverview A generator of lorem ipsum text based on the python - * implementation at http://code.google.com/p/lorem-ipsum-generator/. - * - */ - -goog.provide('goog.text.LoremIpsum'); - -goog.require('goog.array'); -goog.require('goog.math'); -goog.require('goog.string'); -goog.require('goog.structs.Map'); -goog.require('goog.structs.Set'); - - -/** - * Generates random strings of "lorem ipsum" text, based on the word - * distribution of a sample text, using the words in a dictionary. - * @constructor - */ -goog.text.LoremIpsum = function() { - this.generateChains_(this.sample_); - this.generateStatistics_(this.sample_); - - this.initializeDictionary_(this.dictionary_); -}; - - -/** - * Delimiters that end sentences. - * @type {Array.<string>} - * @private - */ -goog.text.LoremIpsum.DELIMITERS_SENTENCES_ = ['.', '?', '!']; - - -/** - * Regular expression for spliting a text into sentences. - * @type {RegExp} - * @private - */ -goog.text.LoremIpsum.SENTENCE_SPLIT_REGEX_ = /[\.\?\!]/; - - -/** - * Delimiters that end words. - * @type {Array.<string>} - * @private - */ -goog.text.LoremIpsum.DELIMITERS_WORDS_ = [',', '.', '?', '!']; - - -/** - * Regular expression for spliting text into words. - * @type {RegExp} - * @private - */ -goog.text.LoremIpsum.WORD_SPLIT_REGEX_ = /\s/; - - -/** - * Words that can be used in the generated output. - * Maps a word-length to a list of words of that length. - * @type {goog.structs.Map} - * @private - */ -goog.text.LoremIpsum.prototype.words_; - - -/** - * Chains of three words that appear in the sample text - * Maps a pair of word-lengths to a third word-length and an optional - * piece of trailing punctuation (for example, a period, comma, etc.). - * @type {goog.structs.Map} - * @private - */ -goog.text.LoremIpsum.prototype.chains_; - - -/** - * Pairs of word-lengths that can appear at the beginning of sentences. - * @type {Array} - */ -goog.text.LoremIpsum.prototype.starts_; - - -/** - * Averange sentence length in words. - * @type {number} - * @private - */ -goog.text.LoremIpsum.prototype.sentenceMean_; - - -/** - * Sigma (sqrt of variance) for the sentence length in words. - * @type {number} - * @private - */ -goog.text.LoremIpsum.prototype.sentenceSigma_; - - -/** - * Averange paragraph length in sentences. - * @type {number} - * @private - */ -goog.text.LoremIpsum.prototype.paragraphMean_; - - -/** - * Sigma (sqrt of variance) for the paragraph length in sentences. - * @type {number} - * @private - */ -goog.text.LoremIpsum.prototype.paragraphSigma_; - - -/** - * Generates the chains and starts values required for sentence generation. - * @param {string} sample The same text. - * @private - */ -goog.text.LoremIpsum.prototype.generateChains_ = function(sample) { - var words = goog.text.LoremIpsum.splitWords_(sample); - var wordInfo = goog.array.map(words, goog.text.LoremIpsum.getWordInfo_); - - var previous = [0, 0]; - var previousKey = previous.join('-'); - var chains = new goog.structs.Map(); - var starts = [previousKey]; - var chainKeys = {}; - - goog.array.forEach(wordInfo, function(pair) { - var chain = chains.get(previousKey); - if (chain) { - chain.push(pair); - } else { - chain = [pair]; - chains.set(previousKey, chain); - } - - if (goog.array.contains( - goog.text.LoremIpsum.DELIMITERS_SENTENCES_, pair[1])) { - starts.push(previousKey); - } - chainKeys[previousKey] = previous; - previous = [previous[1], pair[0]]; - previousKey = previous.join('-'); - }); - - if (chains.getCount() > 0) { - this.chains_ = chains; - this.starts_ = starts; - this.chainKeys_ = chainKeys; - } else { - throw Error('Could not generate chains from sample text.'); - } -}; - - -/** - * Calculates the mean and standard deviation of sentence and paragraph lengths. - * @param {string} sample The same text. - * @private - */ -goog.text.LoremIpsum.prototype.generateStatistics_ = function(sample) { - this.generateSentenceStatistics_(sample); - this.generateParagraphStatistics_(sample); -}; - - -/** - * Calculates the mean and standard deviation of the lengths of sentences - * (in words) in a sample text. - * @param {string} sample The same text. - * @private - */ -goog.text.LoremIpsum.prototype.generateSentenceStatistics_ = function(sample) { - var sentences = goog.array.filter( - goog.text.LoremIpsum.splitSentences_(sample), - goog.text.LoremIpsum.isNotEmptyOrWhitepace_); - - var sentenceLengths = goog.array.map( - goog.array.map(sentences, goog.text.LoremIpsum.splitWords_), - goog.text.LoremIpsum.arrayLength_); - this.sentenceMean_ = goog.math.average.apply(null, sentenceLengths); - this.sentenceSigma_ = goog.math.standardDeviation.apply( - null, sentenceLengths); -}; - - -/** - * Calculates the mean and standard deviation of the lengths of paragraphs - * (in sentences) in a sample text. - * @param {string} sample The same text. - * @private - */ -goog.text.LoremIpsum.prototype.generateParagraphStatistics_ = function(sample) { - var paragraphs = goog.array.filter( - goog.text.LoremIpsum.splitParagraphs_(sample), - goog.text.LoremIpsum.isNotEmptyOrWhitepace_); - - var paragraphLengths = goog.array.map( - goog.array.map(paragraphs, goog.text.LoremIpsum.splitSentences_), - goog.text.LoremIpsum.arrayLength_); - - this.paragraphMean_ = goog.math.average.apply(null, paragraphLengths); - this.paragraphSigma_ = goog.math.standardDeviation.apply( - null, paragraphLengths); -}; - - -/** - * Sets the generator to use a given selection of words for generating - * sentences with. - * @param {string} dictionary The dictionary to use. - */ -goog.text.LoremIpsum.prototype.initializeDictionary_ = function(dictionary) { - var dictionaryWords = goog.text.LoremIpsum.splitWords_(dictionary); - - var words = new goog.structs.Map(); - goog.array.forEach(dictionaryWords, function(word) { - var set = words.get(word.length); - if (!set) { - set = new goog.structs.Set(); - words.set(word.length, set); - } - set.add(word); - }); - - this.words_ = words; -}; - - -/** - * Picks a random starting chain. - * @return {Array.<string>} The starting key. - * @private - */ -goog.text.LoremIpsum.prototype.chooseRandomStart_ = function() { - var key = goog.text.LoremIpsum.randomChoice_(this.starts_); - return this.chainKeys_[key]; -}; - - -/** - * Generates a single sentence, of random length. - * @param {boolean} opt_startWithLorem Whether to start the setnence with the - * standard "Lorem ipsum..." first sentence. - * @return {string} The generated sentence. - */ -goog.text.LoremIpsum.prototype.generateSentence = function(opt_startWithLorem) { - if (this.chains_.getCount() == 0 || this.starts_.length == 0) { - throw Error('No chains created'); - } - - if (this.words_.getCount() == 0) { - throw Error('No dictionary'); - } - - // The length of the sentence is a normally distributed random variable. - var sentenceLength = goog.text.LoremIpsum.randomNormal_( - this.sentenceMean_, this.sentenceSigma_) - sentenceLength = Math.max(Math.floor(sentenceLength), 1); - - var wordDelimiter = ''; // Defined here in case while loop doesn't run - - // Start the sentence with "Lorem ipsum...", if desired - var sentence; - if (opt_startWithLorem) { - var lorem = 'lorem ipsum dolor sit amet, consecteteur adipiscing elit'; - sentence = goog.text.LoremIpsum.splitWords_(lorem); - if (sentence.length > sentenceLength) { - sentence.length = sentenceLength; - } - var lastWord = sentence[sentence.length - 1]; - var lastChar = lastWord.substring(lastWord.length - 1); - if (goog.array.contains(goog.text.LoremIpsum.DELIMITERS_WORDS_, lastChar)) { - wordDelimiter = lastChar; - } - } else { - sentence = []; - } - - var previous = []; - var previousKey = ''; - // Generate a sentence from the "chains" - while (sentence.length < sentenceLength) { - // If the current starting point is invalid, choose another randomly - if (!this.chains_.containsKey(previousKey)) { - previous = this.chooseRandomStart_(); - previousKey = previous.join('-'); - } - - // Choose the next "chain" to go to. This determines the next word - // length we'll use, and whether there is e.g. a comma at the end of - // the word. - var chain = /** @type {Array} */ (goog.text.LoremIpsum.randomChoice_( - /** @type {Array} */ (this.chains_.get(previousKey)))); - var wordLength = chain[0]; - - // If the word delimiter contained in the chain is also a sentence - // delimiter, then we don't include it because we don't want the - // sentence to end prematurely (we want the length to match the - // sentence_length value). - //debugger; - if (goog.array.contains(goog.text.LoremIpsum.DELIMITERS_SENTENCES_, - chain[1])) { - wordDelimiter = ''; - } else { - wordDelimiter = chain[1]; - } - - // Choose a word randomly that matches (or closely matches) the - // length we're after. - var closestLength = goog.text.LoremIpsum.chooseClosest( - this.words_.getKeys(), wordLength); - var word = goog.text.LoremIpsum.randomChoice_( - this.words_.get(closestLength).getValues()); - - sentence.push(word + wordDelimiter); - previous = [previous[1], wordLength]; - previousKey = previous.join('-'); - } - - // Finish the sentence off with capitalisation, a period and - // form it into a string - sentence = sentence.join(' '); - sentence = sentence.slice(0, 1).toUpperCase() + sentence.slice(1); - if (sentence.substring(sentence.length - 1) == wordDelimiter) { - sentence = sentence.slice(0, sentence.length - 1); - } - return sentence + '.'; -}; - -/** - * Generates a single lorem ipsum paragraph, of random length. - * @param {boolean} opt_startWithLorem Whether to start the sentence with the - * standard "Lorem ipsum..." first sentence. - * @return {string} The generated sentence. - */ -goog.text.LoremIpsum.prototype.generateParagraph = function( - opt_startWithLorem) { - // The length of the paragraph is a normally distributed random variable. - var paragraphLength = goog.text.LoremIpsum.randomNormal_( - this.paragraphMean_, this.paragraphSigma_); - paragraphLength = Math.max(Math.floor(paragraphLength), 1); - - // Construct a paragraph from a number of sentences. - var paragraph = [] - var startWithLorem = opt_startWithLorem; - while (paragraph.length < paragraphLength) { - var sentence = this.generateSentence(startWithLorem); - paragraph.push(sentence); - startWithLorem = false; - } - - // Form the paragraph into a string. - paragraph = paragraph.join(' ') - return paragraph -}; - - -/** - * Splits a piece of text into paragraphs. - * @param {string} text The text to split. - * @return {Array.<string>} An array of paragraphs. - * @private - */ -goog.text.LoremIpsum.splitParagraphs_ = function(text) { - return text.split('\n') -}; - - -/** - * Splits a piece of text into sentences. - * @param {string} text The text to split. - * @return {Array.<string>} An array of sentences. - * @private - */ -goog.text.LoremIpsum.splitSentences_ = function(text) { - return goog.array.filter( - text.split(goog.text.LoremIpsum.SENTENCE_SPLIT_REGEX_), - goog.text.LoremIpsum.isNotEmptyOrWhitepace_); -}; - - -/** - * Splits a piece of text into words.. - * @param {string} text The text to split. - * @return {Array.<string>} An array of words. - * @private - */ -goog.text.LoremIpsum.splitWords_ = function(text) { - return goog.array.filter( - text.split(goog.text.LoremIpsum.WORD_SPLIT_REGEX_), - goog.text.LoremIpsum.isNotEmptyOrWhitepace_); -}; - - -/** - * Returns the text is not empty or just whitespace. - * @param {string} text The text to check. - * @return {boolean} Whether the text is nether empty nor whitespace. - * @private - */ -goog.text.LoremIpsum.isNotEmptyOrWhitepace_ = function(text) { - return goog.string.trim(text).length > 0; -}; - - -/** - * Returns the length of an array. Written as a function so it can be used - * as a function parameter. - * @param {Array} array The array to check. - * @return {number} The length of the array. - */ -goog.text.LoremIpsum.arrayLength_ = function(array) { - return array.length; -}; - - -/** - * Find the number in the list of values that is closest to the target. - * @param {Array.<number>} values The values. - * @param {number} target The target value. - * @return {number} The closest value. - */ -goog.text.LoremIpsum.chooseClosest = function(values, target) { - var closest = values[0]; - goog.array.forEach(values, function(value) { - if (Math.abs(target - value) < Math.abs(target - closest)) { - closest = value; - } - }); - - return closest; -}; - -/** - * Gets info about a word used as part of the lorem ipsum algorithm. - * @param {string} word The word to check. - * @return {Array} A two element array. The first element is the size of the - * word. The second element is the delimter used in the word. - * @private - */ -goog.text.LoremIpsum.getWordInfo_ = function(word) { - var ret; - goog.array.some(goog.text.LoremIpsum.DELIMITERS_WORDS_, - function (delimiter) { - if (goog.string.endsWith(word, delimiter)) { - ret = [word.length - delimiter.length, delimiter]; - return true; - } - return false; - } - ); - return ret || [word.length, '']; -}; - - -/** - * Constant used for {@link #randomNormal_}. - * @type {number} - * @private - */ -goog.text.LoremIpsum.NV_MAGICCONST_ = 4 * Math.exp(-0.5) / Math.sqrt(2.0); - - -/** - * Generates a random number for a normal distribution with the specified - * mean and sigma. - * @param {number} mu The mean of the distribution. - * @param {number} sigma The sigma of the distribution. - * @private - */ -goog.text.LoremIpsum.randomNormal_ = function(mu, sigma) { - while (true) { - var u1 = Math.random(); - var u2 = 1.0 - Math.random(); - var z = goog.text.LoremIpsum.NV_MAGICCONST_ * (u1 - 0.5) / u2; - var zz = z * z / 4.0; - if (zz <= -Math.log(u2)) { - break; - } - } - return mu + z * sigma; -}; - - -/** - * Picks a random element of the array. - * @param {Array} array The array to pick from. - * @return {*} An element from the array. - */ -goog.text.LoremIpsum.randomChoice_ = function(array) { - return array[goog.math.randomInt(array.length)]; -}; - - -/** - * Dictionary of words for lorem ipsum. - * @type {string} - * @private - */ -goog.text.LoremIpsum.DICT_ = - 'a ac accumsan ad adipiscing aenean aliquam aliquet amet ante ' + - 'aptent arcu at auctor augue bibendum blandit class commodo ' + - 'condimentum congue consectetuer consequat conubia convallis cras ' + - 'cubilia cum curabitur curae cursus dapibus diam dictum dictumst ' + - 'dignissim dis dolor donec dui duis egestas eget eleifend elementum ' + - 'elit eni enim erat eros est et etiam eu euismod facilisi facilisis ' + - 'fames faucibus felis fermentum feugiat fringilla fusce gravida ' + - 'habitant habitasse hac hendrerit hymenaeos iaculis id imperdiet ' + - 'in inceptos integer interdum ipsum justo lacinia lacus laoreet ' + - 'lectus leo libero ligula litora lobortis lorem luctus maecenas ' + - 'magna magnis malesuada massa mattis mauris metus mi molestie ' + - 'mollis montes morbi mus nam nascetur natoque nec neque netus ' + - 'nibh nisi nisl non nonummy nostra nulla nullam nunc odio orci ' + - 'ornare parturient pede pellentesque penatibus per pharetra ' + - 'phasellus placerat platea porta porttitor posuere potenti praesent ' + - 'pretium primis proin pulvinar purus quam quis quisque rhoncus ' + - 'ridiculus risus rutrum sagittis sapien scelerisque sed sem semper ' + - 'senectus sit sociis sociosqu sodales sollicitudin suscipit ' + - 'suspendisse taciti tellus tempor tempus tincidunt torquent tortor ' + - 'tristique turpis ullamcorper ultrices ultricies urna ut varius ve ' + - 'vehicula vel velit venenatis vestibulum vitae vivamus viverra ' + - 'volutpat vulputate'; - - -/** - * A sample to use for generating the distribution of word and sentence lengths - * in lorem ipsum. - * @type {string} - * @private - */ -goog.text.LoremIpsum.SAMPLE_ = - 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean ' + - 'commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus ' + - 'et magnis dis parturient montes, nascetur ridiculus mus. Donec quam ' + - 'felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla ' + - 'consequat massa quis enim. Donec pede justo, fringilla vel, aliquet ' + - 'nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, ' + - 'venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. ' + - 'Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean ' + - 'vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat ' + - 'vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra ' + - 'quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius ' + - 'laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel ' + - 'augue. Curabitur ullamcorper ultricies nisi. Nam eget dui.\n\n' + - - 'Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem ' + - 'quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam ' + - 'nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec ' + - 'odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis ' + - 'faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus ' + - 'tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales ' + - 'sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit ' + - 'cursus nunc, quis gravida magna mi a libero. Fusce vulputate eleifend ' + - 'sapien. Vestibulum purus quam, scelerisque ut, mollis sed, nonummy id, ' + - 'metus. Nullam accumsan lorem in dui. Cras ultricies mi eu turpis ' + - 'hendrerit fringilla. Vestibulum ante ipsum primis in faucibus orci ' + - 'luctus et ultrices posuere cubilia Curae; In ac dui quis mi ' + - 'consectetuer lacinia.\n\n' + - - 'Nam pretium turpis et arcu. Duis arcu tortor, suscipit eget, imperdiet ' + - 'nec, imperdiet iaculis, ipsum. Sed aliquam ultrices mauris. Integer ' + - 'ante arcu, accumsan a, consectetuer eget, posuere ut, mauris. Praesent ' + - 'adipiscing. Phasellus ullamcorper ipsum rutrum nunc. Nunc nonummy ' + - 'metus. Vestibulum volutpat pretium libero. Cras id dui. Aenean ut eros ' + - 'et nisl sagittis vestibulum. Nullam nulla eros, ultricies sit amet, ' + - 'nonummy id, imperdiet feugiat, pede. Sed lectus. Donec mollis hendrerit ' + - 'risus. Phasellus nec sem in justo pellentesque facilisis. Etiam ' + - 'imperdiet imperdiet orci. Nunc nec neque. Phasellus leo dolor, tempus ' + - 'non, auctor et, hendrerit quis, nisi.\n\n' + - - 'Curabitur ligula sapien, tincidunt non, euismod vitae, posuere ' + - 'imperdiet, leo. Maecenas malesuada. Praesent congue erat at massa. Sed ' + - 'cursus turpis vitae tortor. Donec posuere vulputate arcu. Phasellus ' + - 'accumsan cursus velit. Vestibulum ante ipsum primis in faucibus orci ' + - 'luctus et ultrices posuere cubilia Curae; Sed aliquam, nisi quis ' + - 'porttitor congue, elit erat euismod orci, ac placerat dolor lectus quis ' + - 'orci. Phasellus consectetuer vestibulum elit. Aenean tellus metus, ' + - 'bibendum sed, posuere ac, mattis non, nunc. Vestibulum fringilla pede ' + - 'sit amet augue. In turpis. Pellentesque posuere. Praesent turpis.\n\n' + - - 'Aenean posuere, tortor sed cursus feugiat, nunc augue blandit nunc, eu ' + - 'sollicitudin urna dolor sagittis lacus. Donec elit libero, sodales ' + - 'nec, volutpat a, suscipit non, turpis. Nullam sagittis. Suspendisse ' + - 'pulvinar, augue ac venenatis condimentum, sem libero volutpat nibh, ' + - 'nec pellentesque velit pede quis nunc. Vestibulum ante ipsum primis in ' + - 'faucibus orci luctus et ultrices posuere cubilia Curae; Fusce id ' + - 'purus. Ut varius tincidunt libero. Phasellus dolor. Maecenas vestibulum ' + - 'mollis diam. Pellentesque ut neque. Pellentesque habitant morbi ' + - 'tristique senectus et netus et malesuada fames ac turpis egestas.\n\n' + - - 'In dui magna, posuere eget, vestibulum et, tempor auctor, justo. In ac ' + - 'felis quis tortor malesuada pretium. Pellentesque auctor neque nec ' + - 'urna. Proin sapien ipsum, porta a, auctor quis, euismod ut, mi. Aenean ' + - 'viverra rhoncus pede. Pellentesque habitant morbi tristique senectus et ' + - 'netus et malesuada fames ac turpis egestas. Ut non enim eleifend felis ' + - 'pretium feugiat. Vivamus quis mi. Phasellus a est. Phasellus magna.\n\n' + - - 'In hac habitasse platea dictumst. Curabitur at lacus ac velit ornare ' + - 'lobortis. Curabitur a felis in nunc fringilla tristique. Morbi mattis ' + - 'ullamcorper velit. Phasellus gravida semper nisi. Nullam vel sem. ' + - 'Pellentesque libero tortor, tincidunt et, tincidunt eget, semper nec, ' + - 'quam. Sed hendrerit. Morbi ac felis. Nunc egestas, augue at ' + - 'pellentesque laoreet, felis eros vehicula leo, at malesuada velit leo ' + - 'quis pede. Donec interdum, metus et hendrerit aliquet, dolor diam ' + - 'sagittis ligula, eget egestas libero turpis vel mi. Nunc nulla. Fusce ' + - 'risus nisl, viverra et, tempor et, pretium in, sapien. Donec venenatis ' + - 'vulputate lorem.\n\n' + - - 'Morbi nec metus. Phasellus blandit leo ut odio. Maecenas ullamcorper, ' + - 'dui et placerat feugiat, eros pede varius nisi, condimentum viverra ' + - 'felis nunc et lorem. Sed magna purus, fermentum eu, tincidunt eu, ' + - 'varius ut, felis. In auctor lobortis lacus. Quisque libero metus, ' + - 'condimentum nec, tempor a, commodo mollis, magna. Vestibulum ' + - 'ullamcorper mauris at ligula. Fusce fermentum. Nullam cursus lacinia ' + - 'erat. Praesent blandit laoreet nibh.\n\n' + - - 'Fusce convallis metus id felis luctus adipiscing. Pellentesque egestas, ' + - 'neque sit amet convallis pulvinar, justo nulla eleifend augue, ac ' + - 'auctor orci leo non est. Quisque id mi. Ut tincidunt tincidunt erat. ' + - 'Etiam feugiat lorem non metus. Vestibulum dapibus nunc ac augue. ' + - 'Curabitur vestibulum aliquam leo. Praesent egestas neque eu enim. In ' + - 'hac habitasse platea dictumst. Fusce a quam. Etiam ut purus mattis ' + - 'mauris sodales aliquam. Curabitur nisi. Quisque malesuada placerat ' + - 'nisl. Nam ipsum risus, rutrum vitae, vestibulum eu, molestie vel, ' + - 'lacus.\n\n' + - - 'Sed augue ipsum, egestas nec, vestibulum et, malesuada adipiscing, ' + - 'dui. Vestibulum facilisis, purus nec pulvinar iaculis, ligula mi ' + - 'congue nunc, vitae euismod ligula urna in dolor. Mauris sollicitudin ' + - 'fermentum libero. Praesent nonummy mi in odio. Nunc interdum lacus sit ' + - 'amet orci. Vestibulum rutrum, mi nec elementum vehicula, eros quam ' + - 'gravida nisl, id fringilla neque ante vel mi. Morbi mollis tellus ac ' + - 'sapien. Phasellus volutpat, metus eget egestas mollis, lacus lacus ' + - 'blandit dui, id egestas quam mauris ut lacus. Fusce vel dui. Sed in ' + - 'libero ut nibh placerat accumsan. Proin faucibus arcu quis ante. In ' + - 'consectetuer turpis ut velit. Nulla sit amet est. Praesent metus ' + - 'tellus, elementum eu, semper a, adipiscing nec, purus. Cras risus ' + - 'ipsum, faucibus ut, ullamcorper id, varius ac, leo. Suspendisse ' + - 'feugiat. Suspendisse enim turpis, dictum sed, iaculis a, condimentum ' + - 'nec, nisi. Praesent nec nisl a purus blandit viverra. Praesent ac ' + - 'massa at ligula laoreet iaculis. Nulla neque dolor, sagittis eget, ' + - 'iaculis quis, molestie non, velit.\n\n' + - - 'Mauris turpis nunc, blandit et, volutpat molestie, porta ut, ligula. ' + - 'Fusce pharetra convallis urna. Quisque ut nisi. Donec mi odio, faucibus ' + - 'at, scelerisque quis, convallis in, nisi. Suspendisse non nisl sit amet ' + - 'velit hendrerit rutrum. Ut leo. Ut a nisl id ante tempus hendrerit. ' + - 'Proin pretium, leo ac pellentesque mollis, felis nunc ultrices eros, ' + - 'sed gravida augue augue mollis justo. Suspendisse eu ligula. Nulla ' + - 'facilisi. Donec id justo. Praesent porttitor, nulla vitae posuere ' + - 'iaculis, arcu nisl dignissim dolor, a pretium mi sem ut ipsum. ' + - 'Curabitur suscipit suscipit tellus.\n\n' + - - 'Praesent vestibulum dapibus nibh. Etiam iaculis nunc ac metus. Ut id ' + - 'nisl quis enim dignissim sagittis. Etiam sollicitudin, ipsum eu ' + - 'pulvinar rutrum, tellus ipsum laoreet sapien, quis venenatis ante ' + - 'odio sit amet eros. Proin magna. Duis vel nibh at velit scelerisque ' + - 'suscipit. Curabitur turpis. Vestibulum suscipit nulla quis orci. Fusce ' + - 'ac felis sit amet ligula pharetra condimentum. Maecenas egestas arcu ' + - 'quis ligula mattis placerat. Duis lobortis massa imperdiet quam. ' + - 'Suspendisse potenti.\n\n' + - - 'Pellentesque commodo eros a enim. Vestibulum turpis sem, aliquet eget, ' + - 'lobortis pellentesque, rutrum eu, nisl. Sed libero. Aliquam erat ' + - 'volutpat. Etiam vitae tortor. Morbi vestibulum volutpat enim. Aliquam ' + - 'eu nunc. Nunc sed turpis. Sed mollis, eros et ultrices tempus, mauris ' + - 'ipsum aliquam libero, non adipiscing dolor urna a orci. Nulla porta ' + - 'dolor. Class aptent taciti sociosqu ad litora torquent per conubia ' + - 'nostra, per inceptos hymenaeos.\n\n' + - - 'Pellentesque dapibus hendrerit tortor. Praesent egestas tristique nibh. ' + - 'Sed a libero. Cras varius. Donec vitae orci sed dolor rutrum auctor. ' + - 'Fusce egestas elit eget lorem. Suspendisse nisl elit, rhoncus eget, ' + - 'elementum ac, condimentum eget, diam. Nam at tortor in tellus interdum ' + - 'sagittis. Aliquam lobortis. Donec orci lectus, aliquam ut, faucibus ' + - 'non, euismod id, nulla. Curabitur blandit mollis lacus. Nam adipiscing. ' + - 'Vestibulum eu odio.\n\n' + - - 'Vivamus laoreet. Nullam tincidunt adipiscing enim. Phasellus tempus. ' + - 'Proin viverra, ligula sit amet ultrices semper, ligula arcu tristique ' + - 'sapien, a accumsan nisi mauris ac eros. Fusce neque. Suspendisse ' + - 'faucibus, nunc et pellentesque egestas, lacus ante convallis tellus, ' + - 'vitae iaculis lacus elit id tortor. Vivamus aliquet elit ac nisl. Fusce ' + - 'fermentum odio nec arcu. Vivamus euismod mauris. In ut quam vitae ' + - 'odio lacinia tincidunt. Praesent ut ligula non mi varius sagittis. ' + - 'Cras sagittis. Praesent ac sem eget est egestas volutpat. Vivamus ' + - 'consectetuer hendrerit lacus. Cras non dolor. Vivamus in erat ut urna ' + - 'cursus vestibulum. Fusce commodo aliquam arcu. Nam commodo suscipit ' + - 'quam. Quisque id odio. Praesent venenatis metus at tortor pulvinar ' + - 'varius.\n\n'; - -/** - * Sample that the generated text is based on . - * @type {string} - */ -goog.text.LoremIpsum.prototype.sample_ = goog.text.LoremIpsum.SAMPLE_; - - -/** - * Dictionary of words. - * @type {string} - */ -goog.text.LoremIpsum.prototype.dictionary_ = goog.text.LoremIpsum.DICT_; diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/loremipsum/text/.svn/text-base/loremipsum_test.html.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/loremipsum/text/.svn/text-base/loremipsum_test.html.svn-base deleted file mode 100644 index edc0a16..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/loremipsum/text/.svn/text-base/loremipsum_test.html.svn-base +++ /dev/null @@ -1,60 +0,0 @@ -<!DOCTYPE html> -<html> -<!-- - Copyright 2009 The Closure Library Authors. All Rights Reserved. - Author: dgajda@google.com (Damian Gajda) ---> -<head> -<title>Closure Unit Tests - goog.text.LorumIpsum</title> - <script src="../../../../../closure/goog/base.js"></script> -<script> - goog.require('goog.testing.jsunit'); - goog.require('goog.testing.PseudoRandom'); - goog.require('goog.text.LoremIpsum'); -</script> -</head> -<body> -<script> - - var pseudoRandom; - - function setUp() { - pseudoRandom = new goog.testing.PseudoRandom(100); - pseudoRandom.install(); - } - - function tearDown() { - pseudoRandom.uninstall(); - } - - function testLoremIpsum() { - var generator = new goog.text.LoremIpsum(); - assertEquals( - 'Lorem ipsum dolor sit amet, consecteteur. Elementum adipiscing ' + - 'nisl. Nisi egestas a, taciti enim, scelerisque. Vestibulum ' + - 'facilisis, quis vel faucibus a, pellentesque enim, nonummy vivamus ' + - 'sodales. Montes. Donec eu, risus luctus ligula ante tempor euismod. ' + - 'Porta nostra. Tincidunt in tincidunt eros, sit ante volutpat ' + - 'molestie semper parturient. Vestibulum. Nisi elit elit habitant ' + - 'torquent. A, pellentesque quis, aliquam a, varius enim, amet est ' + - 'hendrerit.', - generator.generateParagraph(true)); - - assertEquals( - 'Non elit adipiscing libero quis rhoncus a, condimentum per, eget ' + - 'faucibus. Duis ac consectetuer sodales. Lectus euismod sed, in a ' + - 'nostra felis vitae molestie imperdiet. Interdum mi, aptent nonummy ' + - 'dui, ve. Quisque auctor ut torquent congue, torquent erat primis ' + - 'ornare. Nunc at. Risus leo integer mattis enim quis nisi laoreet ' + - 'quisque. Eleifend gravida lacinia varius quam ullamcorper iaculis. ' + - 'Vivamus. Suscipit suscipit, libero parturient justo feugiat sapien, ' + - 'ad pharetra. Rutrum, viverra potenti tempor nisi in amet dictumst ' + - 'vitae. Fermentum lacus venenatis parturient vel risus. Congue ac, ' + - 'pharetra diam cum massa curae, vel leo elementum tempus platea, sit ' + - 'aliquam ve, ac.', - generator.generateParagraph(false)); - } - -</script> -</body> -</html> diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/.svn/all-wcprops b/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/.svn/all-wcprops deleted file mode 100644 index a6a354d..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 58 -/svn/!svn/ver/1472/trunk/third_party/closure/goog/mochikit -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/.svn/entries b/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/.svn/entries deleted file mode 100644 index a60244e..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -10 - -dir -1494 -http://closure-library.googlecode.com/svn/trunk/third_party/closure/goog/mochikit -http://closure-library.googlecode.com/svn - - - -2011-12-13T22:20:28.000000Z -1472 -ccalabro@google.com - - - - - - - - - - - - - - -0b95b8e8-c90f-11de-9d4f-f947ee5921c8 - -async -dir - diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/.svn/all-wcprops b/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/.svn/all-wcprops deleted file mode 100644 index 5e2f597..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/.svn/all-wcprops +++ /dev/null @@ -1,29 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 64 -/svn/!svn/ver/1472/trunk/third_party/closure/goog/mochikit/async -END -deferred_test.html -K 25 -svn:wc:ra_dav:version-url -V 83 -/svn/!svn/ver/1472/trunk/third_party/closure/goog/mochikit/async/deferred_test.html -END -deferredlist.js -K 25 -svn:wc:ra_dav:version-url -V 79 -/svn/!svn/ver/850/trunk/third_party/closure/goog/mochikit/async/deferredlist.js -END -deferred.js -K 25 -svn:wc:ra_dav:version-url -V 76 -/svn/!svn/ver/1472/trunk/third_party/closure/goog/mochikit/async/deferred.js -END -deferredlist_test.html -K 25 -svn:wc:ra_dav:version-url -V 87 -/svn/!svn/ver/1434/trunk/third_party/closure/goog/mochikit/async/deferredlist_test.html -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/.svn/entries b/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/.svn/entries deleted file mode 100644 index 9ef9562..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/.svn/entries +++ /dev/null @@ -1,164 +0,0 @@ -10 - -dir -1494 -http://closure-library.googlecode.com/svn/trunk/third_party/closure/goog/mochikit/async -http://closure-library.googlecode.com/svn - - - -2011-12-13T22:20:28.000000Z -1472 -ccalabro@google.com - - - - - - - - - - - - - - -0b95b8e8-c90f-11de-9d4f-f947ee5921c8 - -deferred_test.html -file - - - - -2011-12-23T22:42:21.504243Z -59e855ef3be8f735630cfe11eac3ec8a -2011-12-13T22:20:28.000000Z -1472 -ccalabro@google.com -has-props - - - - - - - - - - - - - - - - - - - - -20271 - -deferredlist.js -file - - - - -2011-12-23T22:42:21.505243Z -9d792ad29dbbf05dbd8477589cf874f5 -2011-04-12T20:35:47.000000Z -850 -diegosalas@google.com -has-props - - - - - - - - - - - - - - - - - - - - -6908 - -deferred.js -file - - - - -2011-12-23T22:42:21.506243Z -97cd5ab57c2d917611e7488352dea588 -2011-12-13T22:20:28.000000Z -1472 -ccalabro@google.com -has-props - - - - - - - - - - - - - - - - - - - - -18876 - -deferredlist_test.html -file - - - - -2011-12-23T22:42:21.507243Z -fc81c5c0bb4948447b1c93b8e98e04d5 -2011-11-30T22:16:21.000000Z -1434 -chrishenry@google.com -has-props - - - - - - - - - - - - - - - - - - - - -8584 - diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/.svn/prop-base/deferred.js.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/.svn/prop-base/deferred.js.svn-base deleted file mode 100644 index 530636b..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/.svn/prop-base/deferred.js.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 15 -text/javascript -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/.svn/prop-base/deferred_test.html.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/.svn/prop-base/deferred_test.html.svn-base deleted file mode 100644 index d356868..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/.svn/prop-base/deferred_test.html.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 9 -text/html -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/.svn/prop-base/deferredlist.js.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/.svn/prop-base/deferredlist.js.svn-base deleted file mode 100644 index 530636b..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/.svn/prop-base/deferredlist.js.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 15 -text/javascript -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/.svn/prop-base/deferredlist_test.html.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/.svn/prop-base/deferredlist_test.html.svn-base deleted file mode 100644 index d356868..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/.svn/prop-base/deferredlist_test.html.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 9 -text/html -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/.svn/text-base/deferred.js.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/.svn/text-base/deferred.js.svn-base deleted file mode 100644 index f89df16..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/.svn/text-base/deferred.js.svn-base +++ /dev/null @@ -1,655 +0,0 @@ -// Copyright 2007 Bob Ippolito. All Rights Reserved. -// Modifications Copyright 2009 The Closure Library Authors. All Rights -// Reserved. - -/** - * @license Portions of this code are from MochiKit, received by - * The Closure Authors under the MIT license. All other code is Copyright - * 2005-2009 The Closure Authors. All Rights Reserved. - */ - -/** - * @fileoverview Classes for tracking asynchronous operations and handling the - * results. The Deferred object here is patterned after the Deferred object in - * the Twisted python networking framework. - * - * See: http://twistedmatrix.com/projects/core/documentation/howto/defer.html - * - * Based on the Dojo code which in turn is based on the MochiKit code. - * - */ - -goog.provide('goog.async.Deferred'); -goog.provide('goog.async.Deferred.AlreadyCalledError'); -goog.provide('goog.async.Deferred.CancelledError'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('goog.debug.Error'); - - - -/** - * Represents the results of an asynchronous operation. A Deferred object - * starts with no result, and then gets a result at some point in the future. - * @param {Function=} opt_canceller A function that will be called if the - * deferred is cancelled. - * @param {Object=} opt_defaultScope The default scope to call callbacks with. - * @constructor - */ -goog.async.Deferred = function(opt_canceller, opt_defaultScope) { - /** - * Entries in the chain are arrays containing a callback, errback, and - * optional scope. Callbacks or errbacks may be null. - * @type {!Array.<!Array>} - * @private - */ - this.chain_ = []; - - /** - * If provided, this is the function to call when the deferred is cancelled. - * @type {Function|undefined} - * @private - */ - this.canceller_ = opt_canceller; - - /** - * The default scope to execute callbacks in. - * @type {Object} - * @private - */ - this.defaultScope_ = opt_defaultScope || null; -}; - - -/** - * Whether the deferred has been fired. - * @type {boolean} - * @private - */ -goog.async.Deferred.prototype.fired_ = false; - - -/** - * Whether the last result in the callback chain was an error. - * @type {boolean} - * @private - */ -goog.async.Deferred.prototype.hadError_ = false; - - -/** - * The current Deferred result, updated by registered callbacks and errbacks. - * @type {*} - * @private - */ -goog.async.Deferred.prototype.result_; - - -/** - * The number of times this deferred has been paused. - * @type {number} - * @private - */ -goog.async.Deferred.prototype.paused_ = 0; - - -/** - * If the deferred was cancelled but it did not have a canceller then this gets - * set to true. - * @type {boolean} - * @private - */ -goog.async.Deferred.prototype.silentlyCancelled_ = false; - -/** - * If a callback returns a deferred then this deferred is considered a chained - * deferred and once it is chained we cannot add more callbacks. - * @type {boolean} - * @private - */ -goog.async.Deferred.prototype.chained_ = false; - - -/** - * If an error is thrown during Deferred execution with no errback to catch it, - * the error is rethrown after a timeout. Reporting the error after a timeout - * allows execution to continue in the calling context. - * @type {number} - * @private - */ -goog.async.Deferred.prototype.unhandledExceptionTimeoutId_; - - -/** - * If this Deferred was created by branch(), this will be the "parent" Deferred. - * @type {goog.async.Deferred} - * @private - */ -goog.async.Deferred.prototype.parent_; - - -/** - * The number of Deferred objects that have been branched off this one. This - * will be decremented whenever a branch is fired or cancelled. - * @type {number} - * @private - */ -goog.async.Deferred.prototype.branches_ = 0; - - -/** - * Cancels a deferred that has not yet received a value. If this Deferred is - * paused waiting for a chained Deferred to fire, the chained Deferred will also - * be cancelled. - * - * If this Deferred was created by calling branch() on a parent Deferred with - * opt_propagateCancel set to true, the parent may also be cancelled. If - * opt_deepCancel is set, cancel() will be called on the parent (as well as any - * other ancestors if the parent is also a branch). If one or more branches were - * created with opt_propagateCancel set to true, the parent will be cancelled if - * cancel() is called on all of those branches. - * - * @param {boolean=} opt_deepCancel If true, cancels this Deferred's parent even - * if cancel() hasn't been called on some of the parent's branches. Has no - * effect on a branch without opt_propagateCancel set to true. - */ -goog.async.Deferred.prototype.cancel = function(opt_deepCancel) { - if (!this.hasFired()) { - if (this.parent_) { - // Get rid of the parent reference before potentially running the parent's - // canceller callback to ensure that this cancellation doesn't get - // double-counted in any way. - var parent = this.parent_; - delete this.parent_; - if (opt_deepCancel) { - parent.cancel(opt_deepCancel); - } else { - parent.branchCancel_(); - } - } - - if (this.canceller_) { - // Call in user-specified scope. - this.canceller_.call(this.defaultScope_, this); - } else { - this.silentlyCancelled_ = true; - } - if (!this.hasFired()) { - this.errback(new goog.async.Deferred.CancelledError(this)); - } - } else if (this.result_ instanceof goog.async.Deferred) { - this.result_.cancel(); - } -}; - - -/** - * Handle a single branch being cancelled. Once all branches are cancelled, this - * Deferred will be cancelled as well. - * @private - */ -goog.async.Deferred.prototype.branchCancel_ = function() { - this.branches_--; - if (this.branches_ <= 0) { - this.cancel(); - } -}; - - -/** - * Pauses the deferred. - * @private - */ -goog.async.Deferred.prototype.pause_ = function() { - this.paused_++; -}; - - -/** - * Resumes a paused deferred. - * @private - */ -goog.async.Deferred.prototype.unpause_ = function() { - // TODO(arv): Rename - this.paused_--; - if (this.paused_ == 0 && this.hasFired()) { - this.fire_(); - } -}; - - -/** - * Called when a dependent deferred fires. - * @param {boolean} isSuccess Whether the result is a success or an error. - * @param {*} res The result of the dependent deferred. - * @private - */ -goog.async.Deferred.prototype.continue_ = function(isSuccess, res) { - this.resback_(isSuccess, res); - this.unpause_(); -}; - - -/** - * Called when either a success or a failure happens. - * @param {boolean} isSuccess Whether the result is a success or an error. - * @param {*} res The result. - * @private - */ -goog.async.Deferred.prototype.resback_ = function(isSuccess, res) { - this.fired_ = true; - this.result_ = res; - this.hadError_ = !isSuccess; - this.fire_(); -}; - - -/** - * Verifies that the deferred has not yet been fired. - * @private - * @throws {Error} If this has already been fired. - */ -goog.async.Deferred.prototype.check_ = function() { - if (this.hasFired()) { - if (!this.silentlyCancelled_) { - throw new goog.async.Deferred.AlreadyCalledError(this); - } - this.silentlyCancelled_ = false; - } -}; - - -/** - * Record a successful result for this operation, and send the result - * to all registered callback functions. - * @param {*} result The result of the operation. - */ -goog.async.Deferred.prototype.callback = function(result) { - this.check_(); - this.assertNotDeferred_(result); - this.resback_(true /* isSuccess */, result); -}; - - -/** - * Record that this operation failed with an error, and send the error - * to all registered errback functions. - * @param {*} result The error result of the operation. - */ -goog.async.Deferred.prototype.errback = function(result) { - this.check_(); - this.assertNotDeferred_(result); - this.resback_(false /* isSuccess */, result); -}; - - -/** - * Asserts that an object is not a Deferred. - * @param {*} obj The object to test. - * @throws {Error} Throws an exception if the object is a Deferred. - * @private - */ -goog.async.Deferred.prototype.assertNotDeferred_ = function(obj) { - goog.asserts.assert( - !(obj instanceof goog.async.Deferred), - 'Deferred instances can only be chained if they are the result of a ' + - 'callback'); -}; - - -/** - * Register a callback function, to be called when a successful result - * is available. - * @param {!Function} cb The function to be called on a successful result. - * @param {Object=} opt_scope An optional scope to call the callback in. - * @return {!goog.async.Deferred} The deferred object for chaining. - */ -goog.async.Deferred.prototype.addCallback = function(cb, opt_scope) { - return this.addCallbacks(cb, null, opt_scope); -}; - - -/** - * Register a callback function, to be called if this operation fails. - * @param {!Function} eb The function to be called on an unsuccessful result. - * @param {Object=} opt_scope An optional scope to call the errback in. - * @return {!goog.async.Deferred} The deferred object for chaining. - */ -goog.async.Deferred.prototype.addErrback = function(eb, opt_scope) { - return this.addCallbacks(null, eb, opt_scope); -}; - - -/** - * Registers a callback function and errback function. - * @param {Function} cb The function to be called on a successful result. - * @param {Function} eb The function to be called on an unsuccessful result. - * @param {Object=} opt_scope An optional scope to call the callbacks in. - * @return {!goog.async.Deferred} The deferred object for chaining. - */ -goog.async.Deferred.prototype.addCallbacks = function(cb, eb, opt_scope) { - goog.asserts.assert(!this.chained_, 'Chained Deferreds can not be re-used'); - this.chain_.push([cb, eb, opt_scope]); - if (this.hasFired()) { - this.fire_(); - } - return this; -}; - - -/** - * Adds another deferred to the end of this deferred's processing chain. - * - * Use this when you want otherDeferred to be called at the end of - * thisDeferred's previous callbacks. - * - * @param {!goog.async.Deferred} otherDeferred The Deferred to chain. - * @return {!goog.async.Deferred} The deferred object for chaining. - */ -goog.async.Deferred.prototype.chainDeferred = function(otherDeferred) { - this.addCallbacks( - otherDeferred.callback, otherDeferred.errback, otherDeferred); - return this; -}; - - -/** - * Makes this Deferred wait for otherDeferred to be called, and its preceding - * callbacks to be executed, before continuing with the callback sequence. - * - * This is equivalent to adding a callback that returns otherDeferred, but - * doesn't prevent additional callbacks from being added to otherDeferred. - * - * @param {!goog.async.Deferred} otherDeferred The Deferred to wait for. - * @return {!goog.async.Deferred} The deferred object for chaining. - */ -goog.async.Deferred.prototype.awaitDeferred = function(otherDeferred) { - return this.addCallback(goog.bind(otherDeferred.branch, otherDeferred)); -}; - - -/** - * Create a branch off this Deferred's callback chain, and return it as a new - * Deferred. This means that the return value will have the value at the current - * point in the callback chain, regardless of any further callbacks added to - * this Deferred. - * - * Additional callbacks added to the original Deferred will not affect the value - * of any branches. All branches at the same stage in the callback chain will - * receive the same starting value. - * - * @param {boolean=} opt_propagateCancel If cancel() is called on every child - * branch created with opt_propagateCancel, the parent will be cancelled as - * well. - * @return {!goog.async.Deferred} The deferred value at this point in the - * callback chain. - */ -goog.async.Deferred.prototype.branch = function(opt_propagateCancel) { - var d = new goog.async.Deferred(); - this.chainDeferred(d); - if (opt_propagateCancel) { - d.parent_ = this; - this.branches_++; - } - return d; -}; - - -/** - * Registers a function as both callback and errback. - * @param {!Function} f The function to be called on any result. - * @param {Object=} opt_scope An optional scope to call the callbacks in. - * @return {!goog.async.Deferred} The deferred object for chaining. - */ -goog.async.Deferred.prototype.addBoth = function(f, opt_scope) { - return this.addCallbacks(f, f, opt_scope); -}; - - -/** - * @return {boolean} Whether callback or errback has been called on this - * deferred. - */ -goog.async.Deferred.prototype.hasFired = function() { - return this.fired_; -}; - - -/** - * @param {*} res The current callback result. - * @return {boolean} Whether the current result is an error that should cause - * registered errbacks to fire. May be overridden by subclasses to handle - * special error types. - * @protected - */ -goog.async.Deferred.prototype.isError = function(res) { - return res instanceof Error; -}; - - -/** - * @return {boolean} Whether an errback has been registered. - * @private - */ -goog.async.Deferred.prototype.hasErrback_ = function() { - return goog.array.some(this.chain_, function(chainRow) { - // The errback is the second element in the array. - return goog.isFunction(chainRow[1]); - }); -}; - - -/** - * Exhausts the callback sequence once a result is available. - * @private - */ -goog.async.Deferred.prototype.fire_ = function() { - if (this.unhandledExceptionTimeoutId_ && this.hasFired() && - this.hasErrback_()) { - // It is possible to add errbacks after the Deferred has fired. If a new - // errback is added immediately after the Deferred encountered an unhandled - // error, but before that error is rethrown, cancel the rethrow. - goog.global.clearTimeout(this.unhandledExceptionTimeoutId_); - delete this.unhandledExceptionTimeoutId_; - } - - if (this.parent_) { - this.parent_.branches_--; - delete this.parent_; - } - - var res = this.result_; - var unhandledException = false; - var isChained = false; - - while (this.chain_.length && this.paused_ == 0) { - var chainEntry = this.chain_.shift(); - - var callback = chainEntry[0]; - var errback = chainEntry[1]; - var scope = chainEntry[2]; - - var f = this.hadError_ ? errback : callback; - if (f) { - try { - var ret = f.call(scope || this.defaultScope_, res); - - // If no result, then use previous result. - if (goog.isDef(ret)) { - // Bubble up the error as long as the return value hasn't changed. - this.hadError_ = this.hadError_ && (ret == res || this.isError(ret)); - this.result_ = res = ret; - } - - if (res instanceof goog.async.Deferred) { - isChained = true; - this.pause_(); - } - - } catch (ex) { - res = ex; - this.hadError_ = true; - - if (!this.hasErrback_()) { - // If an error is thrown with no additional errbacks in the queue, - // prepare to rethrow the error. - unhandledException = true; - } - } - } - } - - this.result_ = res; - - if (isChained && this.paused_) { - res.addCallbacks( - goog.bind(this.continue_, this, true /* isSuccess */), - goog.bind(this.continue_, this, false /* isSuccess */)); - res.chained_ = true; - } - - if (unhandledException) { - // Rethrow the unhandled error after a timeout. Execution will continue, but - // the error will be seen by global handlers and the user. The rethrow will - // be canceled if another errback is appended before the timeout executes. - this.unhandledExceptionTimeoutId_ = goog.global.setTimeout(function() { - // The stack trace is clobbered when the error is rethrown. Append the - // stack trace to the message if available. Since no one is capturing this - // error, the stack trace will be printed to the debug console. - if (goog.DEBUG && goog.isDef(res.message) && res.stack) { - res.message += '\n' + res.stack; - } - throw res; - }, 0); - } -}; - - -/** - * Creates a deferred that always succeeds. - * @param {*} res The result. - * @return {!goog.async.Deferred} The deferred object. - */ -goog.async.Deferred.succeed = function(res) { - var d = new goog.async.Deferred(); - d.callback(res); - return d; -}; - - -/** - * Creates a deferred that always fails. - * @param {*} res The error result. - * @return {!goog.async.Deferred} The deferred object. - */ -goog.async.Deferred.fail = function(res) { - var d = new goog.async.Deferred(); - d.errback(res); - return d; -}; - - -/** - * Creates a deferred that has already been cancelled. - * @return {!goog.async.Deferred} The deferred object. - */ -goog.async.Deferred.cancelled = function() { - var d = new goog.async.Deferred(); - d.cancel(); - return d; -}; - - -/** - * Applies a callback to both deferred and non-deferred values, providing a - * mechanism to normalize synchronous and asynchronous behavior. - * - * If the value is non-deferred, the callback will be executed immediately and - * an already committed deferred returned. - * - * If the object is a deferred, it is branched (so the callback doesn't affect - * the previous chain) and the callback is added to the new deferred. The - * branched deferred is then returned. - * - * In the following (contrived) example, if <code>isImmediate</code> is true - * then 3 is alerted immediately, otherwise 6 is alerted after a 2-second delay. - * - * <pre> - * var value; - * if (isImmediate) { - * value = 3; - * } else { - * value = new goog.async.Deferred(); - * setTimeout(function() { value.callback(6); }, 2000); - * } - * - * var d = goog.async.Deferred.when(value, alert); - * </pre> - * - * @param {*} value Deferred or non-deferred value to pass to the callback. - * @param {!Function} callback The callback to execute. - * @param {Object=} opt_scope An optional scope to call the callback in. - * @return {!goog.async.Deferred} - */ -goog.async.Deferred.when = function(value, callback, opt_scope) { - if (value instanceof goog.async.Deferred) { - return value.branch(true).addCallback(callback, opt_scope); - } else { - return goog.async.Deferred.succeed(value).addCallback(callback, opt_scope); - } -}; - - - -/** - * An error sub class that is used when a deferred has already been called. - * @param {!goog.async.Deferred} deferred The deferred object. - * @constructor - * @extends {goog.debug.Error} - */ -goog.async.Deferred.AlreadyCalledError = function(deferred) { - goog.debug.Error.call(this); - - /** - * The deferred that raised this error. - * @type {goog.async.Deferred} - */ - this.deferred = deferred; -}; -goog.inherits(goog.async.Deferred.AlreadyCalledError, goog.debug.Error); - - -/** - * Message text. - * @type {string} - * @override - */ -goog.async.Deferred.AlreadyCalledError.prototype.message = 'Already called'; - - - -/** - * An error sub class that is used when a deferred is cancelled. - * @param {!goog.async.Deferred} deferred The deferred object. - * @constructor - * @extends {goog.debug.Error} - */ -goog.async.Deferred.CancelledError = function(deferred) { - goog.debug.Error.call(this); - - /** - * The deferred that raised this error. - * @type {goog.async.Deferred} - */ - this.deferred = deferred; -}; -goog.inherits(goog.async.Deferred.CancelledError, goog.debug.Error); - - -/** - * Message text. - * @type {string} - * @override - */ -goog.async.Deferred.CancelledError.prototype.message = 'Deferred was cancelled'; diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/.svn/text-base/deferred_test.html.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/.svn/text-base/deferred_test.html.svn-base deleted file mode 100644 index 4cb3c10..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/.svn/text-base/deferred_test.html.svn-base +++ /dev/null @@ -1,831 +0,0 @@ -<!DOCTYPE html> -<html> -<!-- - Copyright 2009 The Closure Library Authors. All Rights Reserved. - Author: arv@google.com (Erik Arvidsson) ---> -<head> -<title>Closure Unit Tests - goog.async.Deferred</title> -<script src="../../../../../closure/goog/base.js"></script> -<script> - -goog.require('goog.array'); -goog.require('goog.async.Deferred'); -goog.require('goog.string'); -goog.require('goog.testing.MockClock'); -goog.require('goog.testing.jsunit'); - -</script> -</head> -<body> -<script> - -var Deferred = goog.async.Deferred; -var AlreadyCalledError = goog.async.Deferred.AlreadyCalledError; -var CancelledError = goog.async.Deferred.CancelledError; - -// Unhandled errors may be sent to the browser on a timeout. -var mockClock = new goog.testing.MockClock(); - -function setUp() { - mockClock.install(); -} - -function tearDown() { - // Advance the mockClock to fire any unhandled exception timeouts. - mockClock.tick(); - mockClock.uninstall(); -} - -function assertEqualsCallback(msg, expected) { - return function(res) { - assertEquals(msg, expected, res); - // Since the assertion is an exception that will be caught inside the - // Deferred object, we must advance the clock to see if it has failed. - mockClock.tick(); - return res; - }; -} - -function increment(res) { - return res + 1; -} - -function throwStuff(res) { - throw res; -} - -function catchStuff(res) { - return res; -} - -function returnError(res) { - return Error(res); -} - -function neverHappen(res) { - fail('This should not happen'); -} - -function testNormal() { - var d = new Deferred(); - d.addCallback(assertEqualsCallback('pre-deferred callback', 1)); - d.callback(1); - d.addCallback(increment); - d.addCallback(assertEqualsCallback('post-deferred callback', 2)); - d.addCallback(throwStuff); - d.addCallback(neverHappen); - d.addErrback(catchStuff); - d.addCallback(assertEqualsCallback('throw -> err, catch -> success', 2)); - d.addCallback(returnError); - d.addCallback(neverHappen); - d.addErrback(catchStuff); - d.addCallback(assertEqualsCallback('return -> err, catch -> succcess', 2)); -} - -function testCancel() { - var count = 0; - function cancelled(d) { - count++; - } - - function cancelledError(res) { - assertTrue(res instanceof CancelledError); - } - - var d = new Deferred(cancelled); - d.addCallback(neverHappen); - d.addErrback(cancelledError); - d.cancel(); - - assertEquals(1, count); -} - -function testSucceedFail() { - var count = 0; - - var d = Deferred.succeed(1).addCallback(assertEqualsCallback('succeed', 1)); - - // default error - d = Deferred.fail().addCallback(neverHappen); - d = d.addErrback(function(res) { - count++; - return res; - }); - - // default wrapped error - d = Deferred.fail('web taco').addCallback(neverHappen).addErrback(catchStuff); - d = d.addCallback(assertEqualsCallback('wrapped fail', 'web taco')); - - // default unwrapped error - d = Deferred.fail(Error('ugh')).addCallback(neverHappen).addErrback( - catchStuff); - d = d.addCallback(assertEqualsCallback('unwrapped fail', 'ugh')); - - assertEquals(1, count); -} - -function testDeferredDependencies() { - function deferredIncrement(res) { - var rval = Deferred.succeed(res); - rval.addCallback(increment); - return rval; - } - - var d = Deferred.succeed(1).addCallback(deferredIncrement); - d = d.addCallback(assertEqualsCallback('dependent deferred succeed', 2)); - - function deferredFailure(res) { - return Deferred.fail(res); - } - - d = Deferred.succeed('ugh').addCallback(deferredFailure).addErrback( - catchStuff); - d = d.addCallback(assertEqualsCallback('dependent deferred fail', 'ugh')); -} - -// Test double-calling, double-failing, etc. -function testDoubleCalling() { - try { - Deferred.succeed(1).callback(2); - neverHappen(); - } catch (ex) { - assertTrue('double call', ex instanceof AlreadyCalledError); - } -} - -function testDoubleCalling2() { - try { - Deferred.fail(1).errback(2); - neverHappen(); - } catch (ex) { - assertTrue('double-fail', ex instanceof AlreadyCalledError); - } -} - -function testDoubleCalling3() { - try { - var d = Deferred.succeed(1); - d.cancel(); - d = d.callback(2); - assertTrue('swallowed one callback, no canceller', true); - d.callback(3); - neverHappen(); - } catch (ex) { - assertTrue('swallow cancel', ex instanceof AlreadyCalledError); - } -} - -function testDoubleCalling4() { - var count = 0; - function cancelled(d) { - count++; - } - - try { - var d = new Deferred(cancelled); - d.cancel(); - d = d.callback(1); - neverHappen(); - } catch (ex) { - assertTrue('non-swallowed cancel', ex instanceof AlreadyCalledError); - } - assertEquals(1, count); -} - -// Test incorrect Deferred usage -function testIncorrectUsage() { - var d = new Deferred(); - try { - d.callback(new Deferred()); - neverHappen(); - } catch (ex) { - assertTrue('deferred not allowed for callback', ex instanceof Error); - } -} - -function testIncorrectUsage2() { - var d = new Deferred(); - try { - d.errback(new Deferred()); - neverHappen(); - } catch (ex) { - assertTrue('deferred not allowed for errback', ex instanceof Error); - } -} - -function testIncorrectUsage3() { - var d = new Deferred(); - (new Deferred()).addCallback(function() {return d;}).callback(1); - try { - d.addCallback(function() {}); - neverHappen(); - } catch (ex) { - assertTrue('chained deferred not allowed to be re-used', - ex instanceof Error); - } -} - -function testCallbackScope1() { - var c1 = {}, c2 = {}; - var callbackScope = null; - var errbackScope = null; - - var d = new Deferred(); - d.addCallback(function() { - callbackScope = this; - throw Error('Foo'); - }, c1); - d.addErrback(function() { - errbackScope = this; - }, c2); - d.callback(); - assertEquals('Incorrect callback scope', c1, callbackScope); - assertEquals('Incorrect errback scope', c2, errbackScope); -} - -function testCallbackScope2() { - var callbackScope = null; - var errbackScope = null; - - var d = new Deferred(); - d.addCallback(function() { - callbackScope = this; - throw Error('Foo'); - }); - d.addErrback(function() { - errbackScope = this; - }); - d.callback(); - assertEquals('Incorrect callback scope', window, callbackScope); - assertEquals('Incorrect errback scope', window, errbackScope); -} - -function testCallbackScope3() { - var c = {}; - var callbackScope = null; - var errbackScope = null; - - var d = new Deferred(null, c); - d.addCallback(function() { - callbackScope = this; - throw Error('Foo'); - }); - d.addErrback(function() { - errbackScope = this; - }); - d.callback(); - assertEquals('Incorrect callback scope', c, callbackScope); - assertEquals('Incorrect errback scope', c, errbackScope); -} - -function testChainedDeferred1() { - var calls = []; - - var d2 = new Deferred(); - d2.addCallback(function() {calls.push('B1');}); - d2.addCallback(function() {calls.push('B2');}); - - var d1 = new Deferred(); - d1.addCallback(function() {calls.push('A1');}); - d1.addCallback(function() {calls.push('A2');}); - d1.chainDeferred(d2); - d1.addCallback(function() {calls.push('A3');}); - - d1.callback(); - assertEquals('A1,A2,B1,B2,A3', calls.join(',')); -} - -function testChainedDeferred2() { - var calls = []; - - var d2 = new Deferred(); - d2.addCallback(function() {calls.push('B1');}); - d2.addErrback(function(err) {calls.push('B2'); throw Error('x');}); - - var d1 = new Deferred(); - d1.addCallback(function(err) {throw Error('foo');}); - d1.chainDeferred(d2); - d1.addCallback(function() {calls.push('A1');}); - d1.addErrback(function() {calls.push('A2');}); - - d1.callback(); - assertEquals('B2,A2', calls.join(',')); - - try { - mockClock.tick(); - neverHappen(); - } catch (ex) { - assertTrue('In debug mode, should catch unhandled throw from d2. ' + - 'Error message may include stack trace in some browsers.', - goog.string.startsWith(ex.message, 'x')); - } -} - -function testUndefinedResultAndCallbackSequence() { - var results = []; - var d = new Deferred(); - d.addCallback(function(res) {return 'foo';}); - d.addCallback(function(res) {results.push(res); return 'bar';}); - d.addCallback(function(res) {results.push(res);}); - d.addCallback(function(res) {results.push(res);}); - d.callback(); - assertEquals('foo,bar,bar', results.join(',')); -} - -function testUndefinedResultAndErrbackSequence() { - var results = []; - var d = new Deferred(); - d.addCallback(function(res) {throw Error('uh oh');}); - d.addErrback(function(res) {results.push('A');}); - d.addCallback(function(res) {results.push('B');}); - d.addErrback(function(res) {results.push('C');}); - d.callback(); - assertEquals('A,C', results.join(',')); -} - -function testHasFired() { - var d1 = new Deferred(); - var d2 = new Deferred(); - - assertFalse(d1.hasFired()); - assertFalse(d2.hasFired()); - - d1.callback(); - d2.errback(); - assertTrue(d1.hasFired()); - assertTrue(d2.hasFired()); -} - -function testUnhandledErrors() { - var d = new Deferred(); - d.addCallback(throwStuff); - - try { - d.callback(1); - mockClock.tick(); - neverHappen(); - } catch (ex) { - assertEquals('In debug mode, unhandled exceptions should hit the browser.', - 1, ex); - } - - try { - d.addErrback(catchStuff); - mockClock.tick(); - } catch (ex) { - fail('Errbacks added after a failure should resume.'); - } - - d.addCallback(assertEqualsCallback('Should recover after throw.', 1)); - mockClock.tick(); -} - -function testSynchronousErrorCancelling() { - var d = new Deferred(); - d.addCallback(throwStuff); - - try { - d.callback(1); - d.addErrback(catchStuff); - mockClock.tick(); - } catch (ex) { - fail('Adding an errback to the end of a failing Deferred should cancel ' + - 'the unhandled error timeout.'); - } - - d.addCallback(assertEqualsCallback('Callback should fire', 1)); -} - -function testThrowNonError() { - var results = []; - - var d = new Deferred(); - d.addCallback(function(res) { - throw res; - }); - d.addErrback(function(res) { - results.push(res); - return 6; - }); - d.addCallback(function(res) { - results.push(res); - }); - - d.callback(7); - assertArrayEquals( - 'Errback should have been called with 7, followed by callback with 6.', - [7, 6], results); -} - -function testThrownErrorWithNoErrbacks() { - var d = new Deferred(); - d.addCallback(function() { - throw Error('foo'); - }); - d.addCallback(goog.nullFunction); - - function assertCallback() { - d.callback(1); - mockClock.tick(); // Should cause error because throwing is delayed. - } - - assertThrows('A thrown error should be rethrown if there is no ' + - 'errback to catch it.', assertCallback); -} - -function testThrownErrorCallbacksDoNotCancel() { - var d = new Deferred(); - d.addCallback(function() { - throw Error('foo'); - }); - - function assertCallback() { - d.callback(1); - // Add another callback after the fact. Note this is not an errback! - d.addCallback(neverHappen); - mockClock.tick(); // Should cause error because throwing is delayed. - } - - assertThrows('A thrown error should be rethrown if there is no ' + - 'errback to catch it.', assertCallback); -} - -function testAwaitDeferred() { - - var results = []; - - function fn(x) { - return function() { - results.push(x); - }; - } - - var d2 = new Deferred(); - d2.addCallback(fn('b')); - - // d1 -> a -> (wait for d2) -> c - var d1 = new Deferred(); - d1.addCallback(fn('a')); - d1.awaitDeferred(d2); - d1.addCallback(fn('c')); - - // calls 'a' then yields for d2. - d1.callback(null); - - // will get called after d2. - d1.addCallback(fn('d')); - - assertEquals('a', results.join('')); - - // d3 -> w -> (wait for d2) -> x - var d3 = new Deferred(); - d3.addCallback(fn('w')); - d3.awaitDeferred(d2); - d3.addCallback(fn('x')); - - // calls 'w', then yields for d2. - d3.callback(); - - - // will get called after d2. - d3.addCallback(fn('y')); - - assertEquals('aw', results.join('')); - - // d1 calls 'd', d3 calls 'y' - d2.callback(null); - - assertEquals('awbcdxy', results.join('')); - - // d3 and d2 already called, so 'z' called immediately. - d3.addCallback(fn('z')); - - assertEquals('awbcdxyz', results.join('')); -} - -function testAwaitDeferredWithErrors() { - var results = []; - - function fn(x) { - return function(e) { - results.push(x); - }; - } - - var d2 = new Deferred(); - d2.addErrback(fn('a')); - - var d1 = new Deferred(); - d1.awaitDeferred(d2); - d1.addCallback(fn('x')); - d1.addErrback(fn('b')); - d1.callback(null); - - assertEquals('', results.join('')); - - d2.addCallback(fn('z')); - d2.addErrback(fn('c')); - d2.errback(null); - - // First errback added to d2 prints 'a'. - // Next 'd' was chained, so execute its err backs, printing 'b'. - // Finally 'c' was added last by d2's errback. - assertEquals('abc', results.join('')); -} - -function testNonErrorErrback() { - var results = []; - - function fn(x) { - return function(e) { - results.push(x); - }; - } - - var d = new Deferred(); - d.addCallback(fn('a')); - d.addErrback(fn('b')); - - d.addCallback(fn('c')); - d.addErrback(fn('d')); - - d.errback('foo'); - - assertEquals('bd', results.join('')); -} - -function testUnequalReturnValueForErrback() { - var results = []; - - function fn(x) { - return function(e) { - results.push(x); - }; - } - - var d = new Deferred(); - d.addCallback(fn('a')); - d.addErrback(function() { - results.push('b'); - return 'bar'; - }); - - d.addCallback(fn('c')); - d.addErrback(fn('d')); - - d.errback('foo'); - - assertEquals('bc', results.join('')); -} - -function testBranch() { - function fn(x) { - return function(arr) { - return arr.concat(x); - }; - } - - var d = new Deferred(); - d.addCallback(fn(1)); - d.addCallback(fn(2)); - var d2 = d.branch(); - d.addCallback(fn(3)); - d2.addCallback(fn(4)); - - d.callback([]); - - assertTrue('both deferreds should have fired', d.hasFired()); - assertTrue('both deferreds should have fired', d2.hasFired()); - d.addCallback(function(arr) { assertArrayEquals([1, 2, 3], arr); }); - d2.addCallback(function(arr) { assertArrayEquals([1, 2, 4], arr); }); -} - -function testDiamondBranch() { - function fn(x) { - return function(arr) { - return arr.concat(x); - }; - } - - var d = new Deferred(); - d.addCallback(fn(1)); - - var d2 = d.branch(); - d2.addCallback(fn(2)); - - // Chain the branch back to the original. There is no good reason to do this - // cever. - d.addCallback(function(ret) {return d2;}); - d.callback([]); - - // But no reason it shouldn't work! - d.addCallback(function(arr) { assertArrayEquals([1, 2], arr); }); -} - -function testRepeatedBranch() { - var d = new Deferred().addCallback(increment); - - d.branch(). - addCallback(assertEqualsCallback('branch should be after increment', 2)). - addCallback(function(res) {return d.branch();}). - addCallback(assertEqualsCallback('second branch should be the same', 2)); - d.callback(1); -} - -function testCancelThroughBranch() { - var wasCancelled = false; - var d = new Deferred(function() { wasCancelled = true; }); - var branch1 = d.branch(true); - var branch2 = d.branch(true); - - branch1.cancel(); - assertFalse(wasCancelled); - branch2.cancel(); - assertTrue(wasCancelled); -} - -function testCancelThroughSeveralBranches() { - var wasCancelled = false; - var d = new Deferred(function() { wasCancelled = true; }); - var branch = d.branch(true).branch(true).branch(true); - - branch.cancel(); - assertTrue(wasCancelled); -} - -function testBranchCancelThenCallback() { - var wasCancelled = false; - var d = new Deferred(function() { wasCancelled = true; }); - var wasCalled = false; - d.addCallback(function() { wasCalled = true; }); - var branch1 = d.branch(); - var branch2 = d.branch(); - - var branch1WasCalled = false; - var branch2WasCalled = false; - branch1.addCallback(function() { branch1WasCalled = true; }); - branch2.addCallback(function() { branch2WasCalled = true; }); - - var branch1HadErrback = false; - var branch2HadErrback = false; - branch1.addErrback(function() { branch1HadErrback = true; }); - branch2.addErrback(function() { branch2HadErrback = true; }); - - branch1.cancel(); - assertFalse(wasCancelled); - assertTrue(branch1HadErrback); - assertFalse(branch2HadErrback); - - d.callback(); - assertTrue(wasCalled); - assertFalse(branch1WasCalled); - assertTrue(branch2WasCalled); -} - -function testDeepCancelOnBranch() { - var wasCancelled = false; - var d = new Deferred(function() { wasCancelled = true; }); - var branch1 = d.branch(true); - var branch2 = d.branch(true).branch(true).branch(true); - - var branch1HadErrback = false; - var branch2HadErrback = false; - branch1.addErrback(function() { branch1HadErrback = true; }); - branch2.addErrback(function() { branch2HadErrback = true; }); - - branch2.cancel(true /* opt_deepCancel */); - assertTrue(wasCancelled); - assertTrue(branch1HadErrback); - assertTrue(branch2HadErrback); -} - -function testCancelOnRoot() { - var wasCancelled = false; - var d = new Deferred(function() { wasCancelled = true; }); - var branch = d.branch(true).branch(true).branch(true); - - d.cancel(); - assertTrue(wasCancelled); -} - -function testCancelOnLeafBranch() { - var wasCancelled = false; - var branchWasCancelled = false; - var d = new Deferred(function() { wasCancelled = true; }); - var branch = d.branch(true).branch(true).branch(true); - branch.addErrback(function() { branchWasCancelled = true; }); - - branch.cancel(); - assertTrue(wasCancelled); - assertTrue(branchWasCancelled); -} - -function testCancelOnIntermediateBranch() { - var rootWasCancelled = false; - - var d = new Deferred(function() { rootWasCancelled = true; }); - var branch = d.branch(true).branch(true).branch(true); - - var deepBranch1 = branch.branch(true); - var deepBranch2 = branch.branch(true); - - branch.cancel(); - assertTrue(rootWasCancelled); - assertTrue(deepBranch1.hasFired()); - assertTrue(deepBranch2.hasFired()); -} - -function testCancelWithSomeCompletedBranches() { - var d = new Deferred(); - var branch1 = d.branch(true); - - var branch1HadCallback = false; - var branch1HadErrback = false; - branch1. - addCallback(function() { branch1HadCallback = true; }). - addErrback(function() { branch1HadErrback = true; }); - d.callback(true); - - assertTrue(branch1HadCallback); - assertFalse(branch1HadErrback); - - var rootHadCallback = false; - var rootHadErrback = false; - // Block the root on a new Deferred indefinitely. - d. - addCallback(function() { rootHadCallback = true; }). - addCallback(function() { return new goog.async.Deferred(); }). - addErrback(function() { rootHadErrback = true; }); - var branch2 = d.branch(true); - - assertTrue(rootHadCallback); - assertFalse(rootHadErrback); - - branch2.cancel(); - assertFalse(branch1HadErrback); - assertTrue('Cancelling the last active branch should cancel the parent.', - rootHadErrback); -} - -function testStaticCancelled() { - var callbackCalled = false; - var errbackResult = null; - - var d = goog.async.Deferred.cancelled(); - d.addCallback(function() { callbackCalled = true;} ); - d.addErrback(function(err) { errbackResult = err;} ); - - assertTrue('Errback should have been called with a cancelled error', - errbackResult instanceof goog.async.Deferred.CancelledError); - assertFalse('Callback should not have been called', callbackCalled); -} - -function testWhenWithValues() { - var called = false; - goog.async.Deferred.when(4, function(obj) { - called = true; - assertEquals(4, obj); - }); - assertTrue('Fn should have been called', called); -} - -function testWhenWithDeferred() { - var called = false; - - var d = new goog.async.Deferred(); - goog.async.Deferred.when(d, function(obj) { - called = true; - assertEquals(6, obj); - }); - assertFalse('Fn should not have been called yet', called); - d.callback(6); - assertTrue('Fn should have been called', called); -} - -function testWhenDoesntAlterOriginalChain() { - var calls = 0; - - var d1 = new goog.async.Deferred(); - var d2 = goog.async.Deferred.when(d1, function(obj) { - calls++; - return obj * 2; - }); - d1.addCallback(function(obj) { - assertEquals('Original chain should get original value', 5, obj); - calls++; - }); - d2.addCallback(function(obj) { - assertEquals('Branched chain should get modified value', 10, obj); - calls++; - }); - - d1.callback(5); - - assertEquals('There should have been 3 callbacks', 3, calls); -} - -</script> -</body> -</html> - diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/.svn/text-base/deferredlist.js.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/.svn/text-base/deferredlist.js.svn-base deleted file mode 100644 index 5a2c369..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/.svn/text-base/deferredlist.js.svn-base +++ /dev/null @@ -1,199 +0,0 @@ -// Copyright 2005 Bob Ippolito. All Rights Reserved. -// Modifications Copyright 2009 The Closure Library Authors. -// All Rights Reserved. - -/** - * @license Portions of this code are from MochiKit, received by The Closure - * Library Authors under the MIT license. All other code is Copyright - * 2005-2009 The Closure Library Authors. All Rights Reserved. - */ - -/** - * @fileoverview Class for tracking multiple asynchronous operations and - * handling the results. The DeferredList object here is patterned after the - * DeferredList object in the Twisted python networking framework. - * - * Based on the MochiKit code. - * - * See: http://twistedmatrix.com/projects/core/documentation/howto/defer.html - * - */ - -goog.provide('goog.async.DeferredList'); - -goog.require('goog.array'); -goog.require('goog.async.Deferred'); - - - -/** - * Constructs an object that waits on the results of multiple asynchronous - * operations and marshals the results. It is itself a <code>Deferred</code>, - * and sends results to its registered callback chain. Each instance is single - * use and may only fire once. - * - * Unless overridden by one of the options below, the <code>DeferredList</code> - * will wait for a result from every input <code>Deferred</code>. The results - * are stored in a list of two-element arrays as <code>[success, result]</code>, - * where <code>success</code> is whether that result was from a callback or - * errback. Once all results are available, the <code>DeferredList</code>'s - * callback chain is invoked with the full result list. - * - * @param {!Array.<!goog.async.Deferred>} list An array of deferred objects to - * wait for. - * @param {boolean=} opt_fireOnOneCallback Whether to stop waiting as soon as - * one input completes successfully. In this case, the - * <code>DeferredList</code>'s callback chain will be called with a two - * element array, <code>[index, result]</code>, where <code>index</code> - * identifies which input <code>Deferred</code> produced the - * <code>result</code>. - * @param {boolean=} opt_fireOnOneErrback Whether to stop waiting as soon as one - * input reports an error. The error result is passed to the - * <code>DeferredList</code>'s error callback chain. - * @param {boolean=} opt_consumeErrors When true, will stop propagation of the - * error callback chain for input deferred objects. If the failing deferred - * has a registered callback after this <code>DeferredList</code>, it will - * be called with null instead of an <code>Error</code>. - * @param {Function=} opt_canceller A function that will be called if the - * deferred list is canceled. - * @param {Object=} opt_defaultScope The default scope to call callbacks with. - * @constructor - * @extends {goog.async.Deferred} - */ -goog.async.DeferredList = function(list, - opt_fireOnOneCallback, - opt_fireOnOneErrback, - opt_consumeErrors, - opt_canceller, - opt_defaultScope) { - goog.async.Deferred.call(this, opt_canceller, opt_defaultScope); - - /** - * The list of Deferred objects to wait for. - * @type {!Array.<!goog.async.Deferred>} - * @private - */ - this.list_ = list; - - /** - * The stored return values of the Deferred objects. - * @type {!Array} - * @private - */ - this.deferredResults_ = []; - - /** - * Whether to fire on the first successful callback instead of waiting for - * every Deferred to complete. - * @type {boolean} - * @private - */ - this.fireOnOneCallback_ = !!opt_fireOnOneCallback; - - /** - * Whether to fire on the first error result received instead of waiting for - * every Deferred to complete. - * @type {boolean} - * @private - */ - this.fireOnOneErrback_ = !!opt_fireOnOneErrback; - - /** - * Whether to stop error propagation on the input Deferred objects. If the - * DeferredList sees an error from one of the Deferred inputs, the error will - * be captured, and the Deferred will be returned to success state with a null - * return value. - * @type {boolean} - * @private - */ - this.consumeErrors_ = !!opt_consumeErrors; - - for (var i = 0; i < list.length; i++) { - var d = list[i]; - d.addCallbacks(goog.bind(this.handleCallback_, this, i, true), - goog.bind(this.handleCallback_, this, i, false)); - } - - if (list.length == 0 && !this.fireOnOneCallback_) { - this.callback(this.deferredResults_); - } -}; -goog.inherits(goog.async.DeferredList, goog.async.Deferred); - - -/** - * The number of input deferred objects that have fired. - * @type {number} - * @private - */ -goog.async.DeferredList.prototype.numFinished_ = 0; - - -/** - * Registers the result from an input deferred callback or errback. The result - * is returned and may be passed to additional handlers in the callback chain. - * - * @param {number} index The index of the firing deferred object in the input - * list. - * @param {boolean} success Whether the result is from a callback or errback. - * @param {*} result The result of the callback or errback. - * @return {*} The result, to be handled by the next handler in the deferred's - * callback chain (if any). If consumeErrors is set, an error result is - * replaced with null. - * @private - */ -goog.async.DeferredList.prototype.handleCallback_ = function(index, - success, - result) { - this.numFinished_++; - this.deferredResults_[index] = [success, result]; - - if (!this.hasFired()) { - if (this.fireOnOneCallback_ && success) { - this.callback([index, result]); - } else if (this.fireOnOneErrback_ && !success) { - this.errback(result); - } else if (this.numFinished_ == this.list_.length) { - this.callback(this.deferredResults_); - } - } - - if (this.consumeErrors_ && !success) { - result = null; - } - - return result; -}; - - -/** @inheritDoc */ -goog.async.DeferredList.prototype.errback = function(res) { - goog.async.DeferredList.superClass_.errback.call(this, res); - // On error, cancel any pending requests. - goog.array.forEach(this.list_, function(item) { - item.cancel(); - }); -}; - - -/** - * Creates a <code>DeferredList</code> that gathers results from multiple - * <code>Deferred</code> inputs. If all inputs succeed, the callback is fired - * with the list of results as a flat array. If any input fails, the errback is - * fired with the error. - * - * @param {!Array.<!goog.async.Deferred>} list The list of deferred objects to - * wait for. - * @return {!goog.async.DeferredList} A new deferred list. - */ -goog.async.DeferredList.gatherResults = function(list) { - var d = new goog.async.DeferredList(list, false, true); - - d.addCallback(function(results) { - return goog.array.map(results, function(res) { - return res[1]; - }); - }); - - return d; -}; diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/.svn/text-base/deferredlist_test.html.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/.svn/text-base/deferredlist_test.html.svn-base deleted file mode 100644 index ec9582f..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/.svn/text-base/deferredlist_test.html.svn-base +++ /dev/null @@ -1,425 +0,0 @@ -<!DOCTYPE html> -<html> -<!-- - Copyright 2009 The Closure Library Authors. All Rights Reserved. ---> -<head> -<title>Closure Unit Tests - goog.async.DeferredList</title> -<script src="../../../../../closure/goog/base.js"></script> -<script> - -goog.require('goog.array'); -goog.require('goog.async.Deferred'); -goog.require('goog.async.DeferredList'); -goog.require('goog.testing.jsunit'); - -</script> -</head> -<body> -<script> - -var Deferred = goog.async.Deferred; -var DeferredList = goog.async.DeferredList; - - -/** - * A list of unhandled errors. - * @type {Array.<Error>} - */ -var storedErrors = []; - - -/** - * Adds a catch-all error handler to deferred objects. Unhandled errors that - * reach the catch-all will be rethrown during tearDown. - * - * @param {...Deferred} var_args A list of deferred objects. - */ -function addCatchAll(var_args) { - for (var i = 0, d; d = arguments[i]; i++) { - d.addErrback(function(res) { - storedErrors.push(res); - }); - } -} - - -/** - * Checks storedErrors for unhandled errors. If found, the error is rethrown. - */ -function checkCatchAll() { - var err = storedErrors.shift(); - goog.array.clear(storedErrors); - - if (err) { - throw err; - } -} - - -function tearDown() { - checkCatchAll(); -} - - -function neverHappen(res) { - fail('This should not happen'); -} - - -function testNoInputs() { - var count = 0; - var d = new DeferredList([]); - - d.addCallback(function(res) { - assertArrayEquals([], res); - count++; - }); - addCatchAll(d); - - assertEquals('An empty DeferredList should fire immediately with an empty ' + - 'list of results.', - 1, count); -} - - -function testNoInputsAndFireOnOneCallback() { - var count = 0; - var d = new DeferredList([], true); - - d.addCallback(function(res) { - assertArrayEquals([], res); - count++; - }); - addCatchAll(d); - - assertEquals('An empty DeferredList with opt_fireOnOneCallback set should ' + - 'not fire unless callback is invoked explicitly.', - 0, count); - - d.callback([]); - assertEquals('Calling callback explicitly should still fire.', 1, count); -} - - -function testDeferredList() { - var count = 0; - var results; - - var a = new Deferred(); - var b = new Deferred(); - var c = new Deferred(); - - var dl = new DeferredList([a, b, c]); - - dl.addCallback(function(res) { - assertEquals('Expected 3 Deferred results.', 3, res.length); - - assertTrue('Deferred a should return success.', res[0][0]); - assertFalse('Deferred b should return failure.', res[1][0]); - assertTrue('Deferred c should return success.', res[2][0]); - - assertEquals('Unexpected return value for a.', 'A', res[0][1]); - assertEquals('Unexpected return value for c.', 'C', res[2][1]); - - assertEquals('B', res[1][1]); - - count++; - }); - - addCatchAll(dl); - - c.callback('C'); - assertEquals(0, count); - - b.errback('B'); - assertEquals(0, count); - - a.callback('A'); - - checkCatchAll(); - assertEquals('DeferredList should fire on last call or errback.', 1, count); -} - - -function testFireOnFirstCallback() { - var a = new Deferred(); - var b = new Deferred(); - var c = new Deferred(); - - var dl = new DeferredList([a, b, c], true); - - dl.addCallback(function(res) { - assertEquals('Should be the deferred index in this mode.', 1, res[0]); - assertEquals('B', res[1]); - }); - dl.addErrback(neverHappen); - - addCatchAll(dl); - - a.errback('A'); - b.callback('B'); - - // Shouldn't cause any more callbacks on the DeferredList. - c.callback('C'); -} - - -function testFireOnFirstErrback() { - var a = new Deferred(); - var b = new Deferred(); - var c = new Deferred(); - - var dl = new DeferredList([a, b, c], false, true); - - dl.addCallback(neverHappen); - dl.addErrback(function(res) { - assertEquals('A', res); - - // Return a non-error value to break out of the errback path. - return true; - }); - - addCatchAll(dl); - - b.callback('B'); - a.errback('A'); - - // Shouldn't cause any more callbacks on the DeferredList. - c.callback('C'); -} - - -function testNoConsumeErrors() { - var count = 0; - - var a = new Deferred(); - var dl = new DeferredList([a]); - - a.addErrback(function(res) { - count++; - return true; - }); - - addCatchAll(a, dl); - - a.errback('oh noes'); - assertEquals(1, count); -} - - -function testConsumeErrors() { - var count = 0; - - var a = new Deferred(); - var dl = new DeferredList([a], false, false, true); - - a.addErrback(neverHappen); - - addCatchAll(a, dl); - - a.errback('oh noes'); - assertEquals(0, count); -} - - -function testNesting() { - - function upperCase(res) { - return res.toUpperCase(); - } - - // Concatenates a list of callback or errback results into a single string. - function combine(res) { - return goog.array.map(res, function(result) { - return result[1]; - }).join(''); - } - - var a = new Deferred(); - var b = new Deferred(); - var c = new Deferred(); - var d = new Deferred(); - - a.addCallback(upperCase); - b.addCallback(upperCase); - c.addCallback(upperCase); - d.addCallback(upperCase); - - var dl1 = new DeferredList([a, b]); - var dl2 = new DeferredList([c, d]); - - dl1.addCallback(combine); - dl2.addCallback(combine); - - var dl3 = new DeferredList([dl1, dl2]); - dl3.addCallback(combine); - dl3.addCallback(function(res) { - assertEquals('AbCd', res); - }); - - addCatchAll(dl1, dl2, dl3); - - a.callback('a'); - c.callback('c'); - b.errback('b'); - d.errback('d'); -} - - -function testGatherResults() { - var a = new Deferred(); - var b = new Deferred(); - var c = new Deferred(); - - var dl = DeferredList.gatherResults([a, b, c]); - - dl.addCallback(function(res) { - assertArrayEquals(['A', 'B', 'C'], res); - }); - - addCatchAll(dl); - - b.callback('B'); - a.callback('A'); - c.callback('C'); -} - - -function testGatherResultsFailure() { - var a = new Deferred(); - var b = new Deferred(); - var c = new Deferred(); - - var dl = DeferredList.gatherResults([a, b, c]); - - var firedErrback = false; - var firedCallback = false; - dl.addCallback(function() { - firedCallback = true; - }); - dl.addErrback(function() { - firedErrback = true; - return true; - }); - - addCatchAll(dl); - - b.callback('B'); - a.callback('A'); - c.errback(); - - assertTrue('Errback should be called', firedErrback); - assertFalse('Callback should not be called', firedCallback); -} - - -function testGatherResults_cancelCancelsChildren() { - var cancelled = []; - var a = new Deferred(function() { - cancelled.push('a'); - }); - var b = new Deferred(function() { - cancelled.push('b'); - }); - var c = new Deferred(function() { - cancelled.push('c'); - }); - - var dl = new DeferredList([a, b, c]); - - var firedErrback = false; - var firedCallback = false; - dl.addCallback(function() { - firedCallback = true; - }); - dl.addErrback(function() { - firedErrback = true; - return true; - }); - - addCatchAll(dl); - - b.callback('b'); - dl.cancel(); - - assertTrue('Errback should be called', firedErrback); - assertFalse('Callback should not be called', firedCallback); - assertArrayEquals(['a', 'c'], cancelled); -} - - -function testErrorCancelsPendingChildrenWhenFireOnFirstError() { - var cancelled = []; - var a = new Deferred(function() { - cancelled.push('a'); - }); - var b = new Deferred(function() { - cancelled.push('b'); - }); - var c = new Deferred(function() { - cancelled.push('c'); - }); - - var dl = new DeferredList([a, b, c], false, true); - - var firedErrback = false; - var firedCallback = false; - dl.addCallback(function() { - firedCallback = true; - }); - dl.addErrback(function() { - firedErrback = true; - return true; - }); - - addCatchAll(dl); - - a.callback('a') - b.errback(); - - assertTrue('Errback should be called', firedErrback); - assertFalse('Callback should not be called', firedCallback); - assertArrayEquals('Only C should be cancelled since A and B finished.', - ['c'], cancelled); -} - - -function testErrorDoesNotCancelPendingChildrenForVanillaLists() { - var cancelled = []; - var a = new Deferred(function() { - cancelled.push('a'); - }); - var b = new Deferred(function() { - cancelled.push('b'); - }); - var c = new Deferred(function() { - cancelled.push('c'); - }); - - var dl = new DeferredList([a, b, c]); - - var firedErrback = false; - var firedCallback = false; - dl.addCallback(function() { - firedCallback = true; - }); - dl.addErrback(function() { - firedErrback = true; - return true; - }); - - addCatchAll(dl); - - a.callback('a') - b.errback(); - c.callback('c') - - assertFalse('Errback should not be called', firedErrback); - assertTrue('Callback should be called', firedCallback); - assertArrayEquals('No cancellations', [], cancelled); -} - -</script> -</body> -</html> diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/deferred.js b/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/deferred.js index f89df16..6f18f08 100644 --- a/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/deferred.js +++ b/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/deferred.js @@ -263,24 +263,24 @@ goog.async.Deferred.prototype.check_ = function() { /** * Record a successful result for this operation, and send the result * to all registered callback functions. - * @param {*} result The result of the operation. + * @param {*=} opt_result The result of the operation. */ -goog.async.Deferred.prototype.callback = function(result) { +goog.async.Deferred.prototype.callback = function(opt_result) { this.check_(); - this.assertNotDeferred_(result); - this.resback_(true /* isSuccess */, result); + this.assertNotDeferred_(opt_result); + this.resback_(true /* isSuccess */, opt_result); }; /** * Record that this operation failed with an error, and send the error * to all registered errback functions. - * @param {*} result The error result of the operation. + * @param {*=} opt_result The error result of the operation. */ -goog.async.Deferred.prototype.errback = function(result) { +goog.async.Deferred.prototype.errback = function(opt_result) { this.check_(); - this.assertNotDeferred_(result); - this.resback_(false /* isSuccess */, result); + this.assertNotDeferred_(opt_result); + this.resback_(false /* isSuccess */, opt_result); }; @@ -472,6 +472,7 @@ goog.async.Deferred.prototype.fire_ = function() { var f = this.hadError_ ? errback : callback; if (f) { + /** @preserveTry */ try { var ret = f.call(scope || this.defaultScope_, res); @@ -511,15 +512,10 @@ goog.async.Deferred.prototype.fire_ = function() { if (unhandledException) { // Rethrow the unhandled error after a timeout. Execution will continue, but - // the error will be seen by global handlers and the user. The rethrow will + // the error will be seen by global handlers and the user. The throw will // be canceled if another errback is appended before the timeout executes. + // The error's original stack trace is preserved where available. this.unhandledExceptionTimeoutId_ = goog.global.setTimeout(function() { - // The stack trace is clobbered when the error is rethrown. Append the - // stack trace to the message if available. Since no one is capturing this - // error, the stack trace will be printed to the debug console. - if (goog.DEBUG && goog.isDef(res.message) && res.stack) { - res.message += '\n' + res.stack; - } throw res; }, 0); } @@ -620,12 +616,13 @@ goog.async.Deferred.AlreadyCalledError = function(deferred) { goog.inherits(goog.async.Deferred.AlreadyCalledError, goog.debug.Error); -/** - * Message text. - * @type {string} - * @override - */ -goog.async.Deferred.AlreadyCalledError.prototype.message = 'Already called'; +/** @override */ +goog.async.Deferred.AlreadyCalledError.prototype.message = + 'Deferred has already fired'; + + +/** @override */ +goog.async.Deferred.AlreadyCalledError.prototype.name = 'AlreadyCalledError'; @@ -647,9 +644,9 @@ goog.async.Deferred.CancelledError = function(deferred) { goog.inherits(goog.async.Deferred.CancelledError, goog.debug.Error); -/** - * Message text. - * @type {string} - * @override - */ +/** @override */ goog.async.Deferred.CancelledError.prototype.message = 'Deferred was cancelled'; + + +/** @override */ +goog.async.Deferred.CancelledError.prototype.name = 'CancelledError'; diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/deferred_test.html b/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/deferred_test.html index 4cb3c10..870b662 100644 --- a/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/deferred_test.html +++ b/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/deferred_test.html @@ -316,9 +316,7 @@ function testChainedDeferred2() { mockClock.tick(); neverHappen(); } catch (ex) { - assertTrue('In debug mode, should catch unhandled throw from d2. ' + - 'Error message may include stack trace in some browsers.', - goog.string.startsWith(ex.message, 'x')); + assertTrue('Should catch unhandled throw from d2.', ex.message == 'x'); } } @@ -362,12 +360,11 @@ function testUnhandledErrors() { d.addCallback(throwStuff); try { - d.callback(1); + d.callback(123); mockClock.tick(); neverHappen(); } catch (ex) { - assertEquals('In debug mode, unhandled exceptions should hit the browser.', - 1, ex); + assertEquals('Unhandled throws should hit the browser.', 123, ex); } try { @@ -828,4 +825,3 @@ function testWhenDoesntAlterOriginalChain() { </script> </body> </html> - diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/deferredlist.js b/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/deferredlist.js index 5a2c369..4180906 100644 --- a/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/deferredlist.js +++ b/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/deferredlist.js @@ -3,7 +3,7 @@ // All Rights Reserved. /** - * @license Portions of this code are from MochiKit, received by The Closure + * Portions of this code are from MochiKit, received by The Closure * Library Authors under the MIT license. All other code is Copyright * 2005-2009 The Closure Library Authors. All Rights Reserved. */ @@ -17,6 +17,7 @@ * * See: http://twistedmatrix.com/projects/core/documentation/howto/defer.html * + * @author brenneman@google.com (Shawn Brenneman) */ goog.provide('goog.async.DeferredList'); diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/deferredlist_test.html b/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/deferredlist_test.html index ec9582f..733f10d 100644 --- a/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/deferredlist_test.html +++ b/contexts/data/lib/closure-library/third_party/closure/goog/mochikit/async/deferredlist_test.html @@ -2,6 +2,7 @@ <html> <!-- Copyright 2009 The Closure Library Authors. All Rights Reserved. + Author: brenneman@google.com (Shawn Brenneman) --> <head> <title>Closure Unit Tests - goog.async.DeferredList</title> diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/osapi/.svn/all-wcprops b/contexts/data/lib/closure-library/third_party/closure/goog/osapi/.svn/all-wcprops deleted file mode 100644 index 8ef987c..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/osapi/.svn/all-wcprops +++ /dev/null @@ -1,11 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 55 -/svn/!svn/ver/1310/trunk/third_party/closure/goog/osapi -END -osapi.js -K 25 -svn:wc:ra_dav:version-url -V 64 -/svn/!svn/ver/1310/trunk/third_party/closure/goog/osapi/osapi.js -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/osapi/.svn/entries b/contexts/data/lib/closure-library/third_party/closure/goog/osapi/.svn/entries deleted file mode 100644 index d8ed517..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/osapi/.svn/entries +++ /dev/null @@ -1,62 +0,0 @@ -10 - -dir -1494 -http://closure-library.googlecode.com/svn/trunk/third_party/closure/goog/osapi -http://closure-library.googlecode.com/svn - - - -2011-09-29T22:38:05.000000Z -1310 -bolinfest@google.com - - - - - - - - - - - - - - -0b95b8e8-c90f-11de-9d4f-f947ee5921c8 - -osapi.js -file - - - - -2011-12-23T22:42:21.576244Z -859b1e27be9a129f6112a0e6ea3f1a46 -2011-09-29T22:38:05.000000Z -1310 -bolinfest@google.com -has-props - - - - - - - - - - - - - - - - - - - - -3069 - diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/osapi/.svn/prop-base/osapi.js.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/osapi/.svn/prop-base/osapi.js.svn-base deleted file mode 100644 index 7febff5..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/osapi/.svn/prop-base/osapi.js.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 22 -application/javascript -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/osapi/.svn/text-base/osapi.js.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/osapi/.svn/text-base/osapi.js.svn-base deleted file mode 100644 index 9206439..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/osapi/.svn/text-base/osapi.js.svn-base +++ /dev/null @@ -1,95 +0,0 @@ -/** - * @license - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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. - */ - -/** - * @fileoverview Base OSAPI binding. - * This file was copied from - * http://svn.apache.org/repos/asf/shindig/trunk/features/src/main/javascript/features/shindig.container/osapi.js - * and it's slightly modified for Closure. - */ - -goog.provide('goog.osapi'); - - -// Expose osapi from container side. -var osapi = osapi || {}; -goog.exportSymbol('osapi', osapi); - - -/** @type {Function} */ -osapi.callback; - - -/** - * Dispatch a JSON-RPC batch request to services defined in the osapi namespace - * @param {Array.<Object>} requests an array of rpc requests. - */ -goog.osapi.handleGadgetRpcMethod = function(requests) { - var responses = new Array(requests.length); - var callCount = 0; - var callback = osapi.callback; - var dummy = function(params, apiCallback) { - apiCallback({}); - }; - for (var i = 0; i < requests.length; i++) { - // Don't allow underscores in any part of the method name as a - // convention for restricted methods - var current = osapi; - if (requests[i]['method'].indexOf('_') == -1) { - var path = requests[i]['method'].split('.'); - for (var j = 0; j < path.length; j++) { - if (current.hasOwnProperty(path[j])) { - current = current[path[j]]; - } else { - // No matching api - current = dummy; - break; - } - } - } else { - current = dummy; - } - - // Execute the call and latch the rpc callback until all - // complete - current(requests[i]['params'], function(i) { - return function(response) { - // Put back in json-rpc format - responses[i] = {'id': requests[i].id, 'data': response}; - callCount++; - if (callCount == requests.length) { - callback(responses); - } - }; - }(i)); - } -}; - - -/** - * Initializes container side osapi binding. - */ -goog.osapi.init = function() { - // Container-side binding for the gadgetsrpctransport used by osapi. - // Containers add services to the client-side osapi implementation by - // defining them in the osapi namespace - if (gadgets && gadgets.rpc) { // Only define if gadgets rpc exists. - // Register the osapi RPC dispatcher. - gadgets.rpc.register('osapi._handleGadgetRpcMethod', - /** @type {!Function} */ (goog.osapi.handleGadgetRpcMethod)); - } -}; diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/all-wcprops b/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/all-wcprops deleted file mode 100644 index acb2988..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/all-wcprops +++ /dev/null @@ -1,77 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 61 -/svn/!svn/ver/1310/trunk/third_party/closure/goog/silverlight -END -ClipboardButton.xaml.cs -K 25 -svn:wc:ra_dav:version-url -V 84 -/svn/!svn/ver/497/trunk/third_party/closure/goog/silverlight/ClipboardButton.xaml.cs -END -AssemblyInfo.cs -K 25 -svn:wc:ra_dav:version-url -V 76 -/svn/!svn/ver/497/trunk/third_party/closure/goog/silverlight/AssemblyInfo.cs -END -ClipboardButtonApp.xaml.cs -K 25 -svn:wc:ra_dav:version-url -V 87 -/svn/!svn/ver/497/trunk/third_party/closure/goog/silverlight/ClipboardButtonApp.xaml.cs -END -ClosureClipboardButton.csproj.user -K 25 -svn:wc:ra_dav:version-url -V 95 -/svn/!svn/ver/497/trunk/third_party/closure/goog/silverlight/ClosureClipboardButton.csproj.user -END -clipboardbutton.js -K 25 -svn:wc:ra_dav:version-url -V 80 -/svn/!svn/ver/1310/trunk/third_party/closure/goog/silverlight/clipboardbutton.js -END -AppManifest.xml -K 25 -svn:wc:ra_dav:version-url -V 76 -/svn/!svn/ver/497/trunk/third_party/closure/goog/silverlight/AppManifest.xml -END -silverlight.js -K 25 -svn:wc:ra_dav:version-url -V 76 -/svn/!svn/ver/1310/trunk/third_party/closure/goog/silverlight/silverlight.js -END -ClosureClipboardButton.csproj -K 25 -svn:wc:ra_dav:version-url -V 90 -/svn/!svn/ver/497/trunk/third_party/closure/goog/silverlight/ClosureClipboardButton.csproj -END -xap_files -K 25 -svn:wc:ra_dav:version-url -V 70 -/svn/!svn/ver/497/trunk/third_party/closure/goog/silverlight/xap_files -END -ClipboardButton.xaml -K 25 -svn:wc:ra_dav:version-url -V 81 -/svn/!svn/ver/497/trunk/third_party/closure/goog/silverlight/ClipboardButton.xaml -END -ClipboardButtonApp.xaml -K 25 -svn:wc:ra_dav:version-url -V 84 -/svn/!svn/ver/497/trunk/third_party/closure/goog/silverlight/ClipboardButtonApp.xaml -END -supporteduseragent.js -K 25 -svn:wc:ra_dav:version-url -V 82 -/svn/!svn/ver/850/trunk/third_party/closure/goog/silverlight/supporteduseragent.js -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/entries b/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/entries deleted file mode 100644 index a1a150e..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/entries +++ /dev/null @@ -1,436 +0,0 @@ -10 - -dir -1494 -http://closure-library.googlecode.com/svn/trunk/third_party/closure/goog/silverlight -http://closure-library.googlecode.com/svn - - - -2011-09-29T22:38:05.000000Z -1310 -bolinfest@google.com - - - - - - - - - - - - - - -0b95b8e8-c90f-11de-9d4f-f947ee5921c8 - -ClipboardButton.xaml.cs -file - - - - -2011-12-23T22:42:21.804247Z -424a47a8a8da56488d63a1e3a97e800c -2010-11-29T17:27:37.000000Z -497 -nicksantos@google.com -has-props - - - - - - - - - - - - - - - - - - - - -2550 - -AssemblyInfo.cs -file - - - - -2011-12-23T22:42:21.804247Z -09c61e66f6b4638761dbd6217516adae -2010-11-29T17:27:37.000000Z -497 -nicksantos@google.com -has-props - - - - - - - - - - - - - - - - - - - - -1388 - -ClipboardButtonApp.xaml.cs -file - - - - -2011-12-23T22:42:21.805247Z -5c274142643d4d63a28927ebaa3f2311 -2010-11-29T17:27:37.000000Z -497 -nicksantos@google.com -has-props - - - - - - - - - - - - - - - - - - - - -3027 - -ClosureClipboardButton.csproj.user -file - - - - -2011-12-23T22:42:21.806247Z -9cac3d690c8074d225f241303f50955e -2010-11-29T17:27:37.000000Z -497 -nicksantos@google.com -has-props - - - - - - - - - - - - - - - - - - - - -1114 - -clipboardbutton.js -file - - - - -2011-12-23T22:42:21.807247Z -93c59220fe41a6c6900a1f185ea0577a -2011-09-29T22:38:05.000000Z -1310 -bolinfest@google.com -has-props - - - - - - - - - - - - - - - - - - - - -8438 - -AppManifest.xml -file - - - - -2011-12-23T22:42:21.808247Z -02f91cbd3825b166a9f38682b50f9945 -2010-11-29T17:27:37.000000Z -497 -nicksantos@google.com -has-props - - - - - - - - - - - - - - - - - - - - -201 - -silverlight.js -file - - - - -2011-12-23T22:42:21.809247Z -32fd1bdadca1c3c00ff50149a66f99fd -2011-09-29T22:38:05.000000Z -1310 -bolinfest@google.com -has-props - - - - - - - - - - - - - - - - - - - - -23891 - -ClosureClipboardButton.csproj -file - - - - -2011-12-23T22:42:21.810247Z -7cbb17135fcd9e031e0d2c9bd21bf9a8 -2010-11-29T17:27:37.000000Z -497 -nicksantos@google.com -has-props - - - - - - - - - - - - - - - - - - - - -4803 - -xap_files -file - - - - -2011-12-23T22:42:21.811247Z -bad0b9dbad3a74ed302fc278eb3ac4d9 -2010-11-29T17:27:37.000000Z -497 -nicksantos@google.com -has-props - - - - - - - - - - - - - - - - - - - - -4256 - -ClipboardButton.xaml -file - - - - -2011-12-23T22:42:21.811247Z -04d90970886fbb3e306c4588200428ab -2010-11-29T17:27:37.000000Z -497 -nicksantos@google.com -has-props - - - - - - - - - - - - - - - - - - - - -435 - -ClipboardButtonApp.xaml -file - - - - -2011-12-23T22:42:21.812247Z -6dbb713e279d853888f356872a6f2ab3 -2010-11-29T17:27:37.000000Z -497 -nicksantos@google.com -has-props - - - - - - - - - - - - - - - - - - - - -295 - -supporteduseragent.js -file - - - - -2011-12-23T22:42:21.813247Z -73df1061fc477d7f6cb3964b85c6608b -2011-04-12T20:35:47.000000Z -850 -diegosalas@google.com -has-props - - - - - - - - - - - - - - - - - - - - -4738 - diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/prop-base/AppManifest.xml.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/prop-base/AppManifest.xml.svn-base deleted file mode 100644 index 28f7b43..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/prop-base/AppManifest.xml.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 14 -svn:executable -V 1 -* -K 13 -svn:mime-type -V 15 -application/xml -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/prop-base/AssemblyInfo.cs.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/prop-base/AssemblyInfo.cs.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/prop-base/AssemblyInfo.cs.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/prop-base/ClipboardButton.xaml.cs.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/prop-base/ClipboardButton.xaml.cs.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/prop-base/ClipboardButton.xaml.cs.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/prop-base/ClipboardButton.xaml.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/prop-base/ClipboardButton.xaml.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/prop-base/ClipboardButton.xaml.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/prop-base/ClipboardButtonApp.xaml.cs.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/prop-base/ClipboardButtonApp.xaml.cs.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/prop-base/ClipboardButtonApp.xaml.cs.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/prop-base/ClipboardButtonApp.xaml.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/prop-base/ClipboardButtonApp.xaml.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/prop-base/ClipboardButtonApp.xaml.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/prop-base/ClosureClipboardButton.csproj.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/prop-base/ClosureClipboardButton.csproj.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/prop-base/ClosureClipboardButton.csproj.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/prop-base/ClosureClipboardButton.csproj.user.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/prop-base/ClosureClipboardButton.csproj.user.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/prop-base/ClosureClipboardButton.csproj.user.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/prop-base/clipboardbutton.js.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/prop-base/clipboardbutton.js.svn-base deleted file mode 100644 index 7febff5..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/prop-base/clipboardbutton.js.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 22 -application/javascript -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/prop-base/silverlight.js.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/prop-base/silverlight.js.svn-base deleted file mode 100644 index 7febff5..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/prop-base/silverlight.js.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 22 -application/javascript -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/prop-base/supporteduseragent.js.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/prop-base/supporteduseragent.js.svn-base deleted file mode 100644 index 7febff5..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/prop-base/supporteduseragent.js.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 22 -application/javascript -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/prop-base/xap_files.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/prop-base/xap_files.svn-base deleted file mode 100644 index dbc918b..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/prop-base/xap_files.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 14 -svn:executable -V 1 -* -K 13 -svn:mime-type -V 24 -application/octet-stream -END diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/text-base/AppManifest.xml.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/text-base/AppManifest.xml.svn-base deleted file mode 100644 index 6712a11..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/text-base/AppManifest.xml.svn-base +++ /dev/null @@ -1,6 +0,0 @@ -<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" -> - <Deployment.Parts> - </Deployment.Parts> -</Deployment> diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/text-base/AssemblyInfo.cs.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/text-base/AssemblyInfo.cs.svn-base deleted file mode 100644 index 37c6b86..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/text-base/AssemblyInfo.cs.svn-base +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("ClosureClipboardButton")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Google")] -[assembly: AssemblyProduct("ClosureClipboardButton")] -[assembly: AssemblyCopyright("Copyright © Google 2010")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("1e052ceb-4e47-484b-97d6-a37d4f84c23e")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyFileVersion("1.0.*")] diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/text-base/ClipboardButton.xaml.cs.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/text-base/ClipboardButton.xaml.cs.svn-base deleted file mode 100644 index 8ade8d9..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/text-base/ClipboardButton.xaml.cs.svn-base +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2010 The Closure Library Authors. All Rights Reserved. -// -// 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. - -/// Clipboard button user control. -/// <author>nicksantos@google.com (Nick Santos)</author> - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Windows; -using System.Windows.Browser; -using System.Windows.Controls; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Animation; -using System.Windows.Shapes; - -namespace ClosureLibrary { - public enum ClipboardButtonType { - COPY = 1, - PASTE = 2 - } - - public partial class ClipboardButton : UserControl { - private readonly ClipboardButtonType buttonType; - private readonly string callbackName; - - /// <param name="buttonType"> - /// The clipboard event that the button will fire. - /// </param> - /// <param name="callbackName"> - /// The name of a callback into JS. If it's a Paste, it - /// should be a function(string): void that accepts the clipboard contents. - /// If it's a Copy, it should be a function(): string that returns - /// the content to put on the clipboard. - /// </param> - /// <param name="buttonProperties"> - /// Other properties for the button, like Content. - /// </param> - public ClipboardButton(ClipboardButtonType buttonType, string callbackName, - IDictionary<string, string> buttonProperties) { - this.buttonType = buttonType; - this.callbackName = callbackName; - - InitializeComponent(); - - if (buttonProperties.Keys.Contains("Content")) { - button.Content = buttonProperties["Content"]; - } - } - - public void onClick(object sender, EventArgs e) { - // TODO(nicksantos): What happens if the user denies clipboard access? - if (buttonType == ClipboardButtonType.COPY) { - Clipboard.SetText(HtmlPage.Window.Invoke(callbackName).ToString()); - } else { - HtmlPage.Window.Invoke(callbackName, Clipboard.GetText()); - } - } - } -} diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/text-base/ClipboardButton.xaml.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/text-base/ClipboardButton.xaml.svn-base deleted file mode 100644 index 1804058..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/text-base/ClipboardButton.xaml.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -<UserControl x:Class="ClosureLibrary.ClipboardButton" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - mc:Ignorable="d"> - - <Button x:Name="button" Click="onClick" Background="White"></Button> -</UserControl> diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/text-base/ClipboardButtonApp.xaml.cs.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/text-base/ClipboardButtonApp.xaml.cs.svn-base deleted file mode 100644 index 445c9a1..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/text-base/ClipboardButtonApp.xaml.cs.svn-base +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2010 The Closure Library Authors. All Rights Reserved. -// -// 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. - -/// Application wrapper for a single clipboard button. -/// <author>nicksantos@google.com (Nick Santos)</author> - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Animation; -using System.Windows.Shapes; - -namespace ClosureLibrary { - public partial class ClipboardButtonApp : Application { - - public ClipboardButtonApp() { - this.Startup += this.Application_Startup; - this.UnhandledException += this.Application_UnhandledException; - - InitializeComponent(); - } - - private void Application_Startup(object sender, StartupEventArgs e) { - string callbackName = e.InitParams["callbackName"]; - ClipboardButtonType buttonType = (ClipboardButtonType) Enum.Parse( - typeof(ClipboardButtonType), e.InitParams["buttonType"], false); - - this.RootVisual = new ClipboardButton( - buttonType, callbackName, e.InitParams); - } - - // Error handlers generated by MS Visual Web Developer. - private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) { - // If the app is running outside of the debugger then report the exception using - // the browser's exception mechanism. On IE this will display it a yellow alert - // icon in the status bar and Firefox will display a script error. - if (!System.Diagnostics.Debugger.IsAttached) { - - // NOTE: This will allow the application to continue running after an exception has been thrown - // but not handled. - // For production applications this error handling should be replaced with something that will - // report the error to the website and stop the application. - e.Handled = true; - Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); }); - } - } - - private void ReportErrorToDOM(ApplicationUnhandledExceptionEventArgs e) { - try { - string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace; - errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n"); - - System.Windows.Browser.HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight Application " + errorMsg + "\");"); - } catch (Exception) { - } - } - } -} diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/text-base/ClipboardButtonApp.xaml.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/text-base/ClipboardButtonApp.xaml.svn-base deleted file mode 100644 index 101f245..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/text-base/ClipboardButtonApp.xaml.svn-base +++ /dev/null @@ -1,8 +0,0 @@ -<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - x:Class="ClosureLibrary.ClipboardButtonApp" - > - <Application.Resources> - - </Application.Resources> -</Application> diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/text-base/ClosureClipboardButton.csproj.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/text-base/ClosureClipboardButton.csproj.svn-base deleted file mode 100644 index 9958672..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/text-base/ClosureClipboardButton.csproj.svn-base +++ /dev/null @@ -1,108 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProductVersion>8.0.50727</ProductVersion> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{5B03D96F-A520-4B8F-B915-C8A95E6D56FD}</ProjectGuid> - <ProjectTypeGuids>{A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids> - <OutputType>Library</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>ClosureLibrary</RootNamespace> - <AssemblyName>ClosureClipboardButton</AssemblyName> - <TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier> - <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> - <SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion> - <SilverlightApplication>true</SilverlightApplication> - <SupportedCultures> - </SupportedCultures> - <XapOutputs>true</XapOutputs> - <GenerateSilverlightManifest>true</GenerateSilverlightManifest> - <XapFilename>ClosureClipboardButton.xap</XapFilename> - <SilverlightManifestTemplate>Properties\AppManifest.xml</SilverlightManifestTemplate> - <SilverlightAppEntry>ClosureLibrary.ClipboardButtonApp</SilverlightAppEntry> - <TestPageFileName>ClosureClipboardButtonTestPage.html</TestPageFileName> - <CreateTestPage>true</CreateTestPage> - <ValidateXaml>true</ValidateXaml> - <EnableOutOfBrowser>false</EnableOutOfBrowser> - <OutOfBrowserSettingsFile>Properties\OutOfBrowserSettings.xml</OutOfBrowserSettingsFile> - <UsePlatformExtensions>false</UsePlatformExtensions> - <ThrowErrorsInValidation>true</ThrowErrorsInValidation> - <LinkedServerProject> - </LinkedServerProject> - </PropertyGroup> - <!-- This property group is only here to support building this project using the - MSBuild 3.5 toolset. In order to work correctly with this older toolset, it needs - to set the TargetFrameworkVersion to v3.5 --> - <PropertyGroup Condition="'$(MSBuildToolsVersion)' == '3.5'"> - <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>Bin\Debug</OutputPath> - <DefineConstants>DEBUG;TRACE;SILVERLIGHT</DefineConstants> - <NoStdLib>true</NoStdLib> - <NoConfig>true</NoConfig> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <OutputPath>Bin\Release</OutputPath> - <DefineConstants>TRACE;SILVERLIGHT</DefineConstants> - <NoStdLib>true</NoStdLib> - <NoConfig>true</NoConfig> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <ItemGroup> - <Reference Include="mscorlib" /> - <Reference Include="System.Windows" /> - <Reference Include="system" /> - <Reference Include="System.Core" /> - <Reference Include="System.Net" /> - <Reference Include="System.Xml" /> - <Reference Include="System.Windows.Browser" /> - </ItemGroup> - <ItemGroup> - <Compile Include="ClipboardButtonApp.xaml.cs"> - <DependentUpon>ClipboardButtonApp.xaml</DependentUpon> - </Compile> - <Compile Include="ClipboardButton.xaml.cs"> - <DependentUpon>ClipboardButton.xaml</DependentUpon> - </Compile> - <Compile Include="Properties\AssemblyInfo.cs" /> - </ItemGroup> - <ItemGroup> - <ApplicationDefinition Include="ClipboardButtonApp.xaml"> - <SubType>Designer</SubType> - <Generator>MSBuild:Compile</Generator> - </ApplicationDefinition> - <Page Include="ClipboardButton.xaml"> - <SubType>Designer</SubType> - <Generator>MSBuild:Compile</Generator> - </Page> - </ItemGroup> - <ItemGroup> - <None Include="Properties\AppManifest.xml" /> - </ItemGroup> - <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\$(SilverlightVersion)\Microsoft.Silverlight.CSharp.targets" /> - <!-- To modify your build process, add your task inside one of the targets below and uncomment it. - Other similar extension points exist, see Microsoft.Common.targets. - <Target Name="BeforeBuild"> - </Target> - <Target Name="AfterBuild"> - </Target> - --> - <ProjectExtensions> - <VisualStudio> - <FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}"> - <SilverlightProjectProperties /> - </FlavorProperties> - </VisualStudio> - </ProjectExtensions> -</Project>
\ No newline at end of file diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/text-base/ClosureClipboardButton.csproj.user.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/text-base/ClosureClipboardButton.csproj.user.svn-base deleted file mode 100644 index 8b80b1f..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/text-base/ClosureClipboardButton.csproj.user.svn-base +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ProjectExtensions> - <VisualStudio> - <FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}"> - <SilverlightProjectProperties> - <StartPageUrl> - </StartPageUrl> - <StartAction>DynamicPage</StartAction> - <AspNetDebugging>True</AspNetDebugging> - <NativeDebugging>False</NativeDebugging> - <SQLDebugging>False</SQLDebugging> - <ExternalProgram> - </ExternalProgram> - <StartExternalURL> - </StartExternalURL> - <StartCmdLineArguments> - </StartCmdLineArguments> - <StartWorkingDirectory> - </StartWorkingDirectory> - <ShowWebRefOnDebugPrompt>True</ShowWebRefOnDebugPrompt> - <OutOfBrowserProjectToDebug> - </OutOfBrowserProjectToDebug> - <ShowRiaSvcsOnDebugPrompt>True</ShowRiaSvcsOnDebugPrompt> - </SilverlightProjectProperties> - </FlavorProperties> - </VisualStudio> - </ProjectExtensions> -</Project>
\ No newline at end of file diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/text-base/clipboardbutton.js.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/text-base/clipboardbutton.js.svn-base deleted file mode 100644 index 543d484..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/text-base/clipboardbutton.js.svn-base +++ /dev/null @@ -1,280 +0,0 @@ -// Copyright 2010 The Closure Library Authors. All Rights Reserved. -// -// 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. - -/** - * @fileoverview A button that can access the native clipboard. Calls - * out to silverlight when it's possible to do so. - * - * If the current browser does not support native clipboard access, - * throw an error. - * - * @author nicksantos@google.com (Nick Santos) - */ - -goog.provide('goog.silverlight.ClipboardButton'); -goog.provide('goog.silverlight.ClipboardButtonType'); -goog.provide('goog.silverlight.ClipboardEvent'); -goog.provide('goog.silverlight.CopyButton'); -goog.provide('goog.silverlight.PasteButton'); -goog.provide('goog.silverlight.PasteButtonEvent'); - -goog.require('goog.asserts'); -goog.require('goog.events.Event'); -goog.require('goog.math.Size'); -goog.require('goog.silverlight'); -goog.require('goog.ui.Component'); - - -/** - * A button that can access the native clipboard, via Silverlight. - * - * If this is not a browser that supports native clipboard access, - * throw an error. - * - * Clients should not instantiate this directly. Instead, use CopyButton - * or PasteButton. - * - * @param {goog.silverlight.ClipboardButtonType} type Copy or Paste. - * @param {Function} callback The callback function for copy or paste. - * @param {goog.Uri} slResource The URI of ClosureClipboardButton.xap (The - * silverlight resource included in this package.) - * @param {string} caption Text caption to display as the button's caption. - * @param {goog.dom.DomHelper=} opt_domHelper Optional DOM helper, used for - * document interaction. - * @constructor - * @extends {goog.ui.Component} - */ -goog.silverlight.ClipboardButton = - function(type, callback, slResource, caption, opt_domHelper) { - // In an ideal world, we'd use some sort of transparent overlay over - // an HTML-based button. Silverlight doesn't appear to allow this. - // Silverlight only allows copy and paste in response to a - // silverlight-managed click on a silverlight-rendered button, - // and this button cannot be transparent. - goog.asserts.assert( - goog.silverlight.ClipboardButton.hasClipboardAccess(), - 'no clipboard access'); - - goog.base(this, opt_domHelper); - - /** - * The ID of the handler to pass to silverlight. - * @type {string} - * @private - */ - this.callbackId_ = goog.asserts.assertString( - goog.silverlight.getHandlerName(callback)); - - /** - * The button caption. - * @type {string} - * @private - */ - this.caption_ = caption; - - /** - * The compiled silverlight bundle. - * @type {goog.Uri} - * @private - */ - this.slResource_ = slResource; - - /** - * @type {goog.silverlight.ClipboardButtonType} - * @private - */ - this.type_ = type; - - /** - * @type {goog.math.Size} - * @private - */ - this.size_ = goog.silverlight.ClipboardButton.DEFAULT_SIZE_; -}; -goog.inherits(goog.silverlight.ClipboardButton, goog.ui.Component); - - -/** - * The default size of the button. - * @type {goog.math.Size} - * @private - */ -goog.silverlight.ClipboardButton.DEFAULT_SIZE_ = new goog.math.Size(100, 30); - - -/** - * Silverlight components need absolute sizing. Should be set before the - * component is rendered. - * @param {goog.math.Size} size The size of the component. - */ -goog.silverlight.ClipboardButton.prototype.setSize = function(size) { - this.size_ = size; -}; - - -/** - * Creates the button's DOM. - * @override - */ -goog.silverlight.ClipboardButton.prototype.createDom = function() { - var dom = this.getDomHelper(); - var element = dom.createDom('div', goog.getCssName('goog-inline-block')); - this.setElementInternal(element); - - var source = this.slResource_.toString(); - goog.silverlight.createObject( - source, element, null, - {version: '4.0', - width: this.size_.width, height: this.size_.height}, null, - ['buttonType=' + this.type_, - 'callbackName=' + this.callbackId_, - 'Content=' + this.caption_].join(',')); -}; - - -/** @return {boolean} If clipboard access is supported. */ -goog.silverlight.ClipboardButton.hasClipboardAccess = function() { - // TODO(nicksantos): Use IE execCommand if available. - return goog.silverlight.isInstalled('4.0'); -}; - - -/** @inheritDoc */ -goog.silverlight.ClipboardButton.prototype.disposeInternal = function() { - goog.silverlight.disposeHandlerName(this.callbackId_); - goog.base(this, 'disposeInternal'); -}; - - -/** - * Whether the button should trigger a copy or a paste. - * @enum - * @private - */ -goog.silverlight.ClipboardButtonType = { - COPY: 1, - PASTE: 2 -}; - - -/** - * A clipboard button event. By design, replicates IE's clipboard API. - * @param {string} type The event type. - * @param {string=} opt_data The data pasted, if this is a paste event. - * @constructor - * @extends {goog.events.Event} - */ -goog.silverlight.ClipboardEvent = function(type, opt_data) { - goog.base(this, type); - - /** - * @type {?string} - * @private - */ - this.data_ = opt_data || null; -}; -goog.inherits(goog.silverlight.ClipboardEvent, goog.events.Event); - - -/** @return {?string} Data pasted from the clipboard. */ -goog.silverlight.ClipboardEvent.prototype.getData = function() { - return this.data_; -}; - - -/** @param {string} data Data to put on the clipboard. */ -goog.silverlight.ClipboardEvent.prototype.setData = function(data) { - this.data_ = data; -}; - - -/** @enum {string} */ -goog.silverlight.ClipboardEventType = { - COPY: 'copy', - PASTE: 'paste' -}; - - -/** - * A button that can retrieve contents from the native clipboard. - * - * @param {goog.Uri} slResource The URI of ClosureClipboardButton.xap (the - * silverlight resource included in this package. - * @param {string=} opt_caption Text caption to display as the button's caption. - * Defaults to 'Paste'. - * @param {goog.dom.DomHelper=} opt_domHelper Optional DOM helper, used for - * document interaction. - * @constructor - * @extends {goog.silverlight.ClipboardButton} - */ -goog.silverlight.PasteButton = - function(slResource, opt_caption, opt_domHelper) { - /** @desc Label for the paste button */ - var MSG_DEFAULT_PASTE_BUTTON_CAPTION = goog.getMsg('Paste'); - var caption = opt_caption || MSG_DEFAULT_PASTE_BUTTON_CAPTION; - - goog.base(this, - goog.silverlight.ClipboardButtonType.PASTE, - goog.bind(this.handlePaste_, this), - slResource, - caption, - opt_domHelper); -}; -goog.inherits(goog.silverlight.PasteButton, goog.silverlight.ClipboardButton); - - -/** @param {string} content The native content that was pasted. */ -goog.silverlight.PasteButton.prototype.handlePaste_ = function(content) { - this.dispatchEvent( - new goog.silverlight.ClipboardEvent( - goog.silverlight.ClipboardEventType.PASTE, - content)); -}; - - -/** - * A button that can copy contents. - * - * @param {goog.Uri} slResource The URI of ClosureClipboardButton.xap (the - * silverlight resource included in this package. - * @param {string=} opt_caption Text caption to display as the button's caption. - * Defaults to 'Copy'. - * @param {goog.dom.DomHelper=} opt_domHelper Optional DOM helper, used for - * document interaction. - * @constructor - * @extends {goog.silverlight.ClipboardButton} - */ -goog.silverlight.CopyButton = - function(slResource, opt_caption, opt_domHelper) { - /** @desc Label for the copy button */ - var MSG_DEFAULT_COPY_BUTTON_CAPTION = goog.getMsg('Copy'); - var caption = opt_caption || MSG_DEFAULT_COPY_BUTTON_CAPTION; - - goog.base(this, - goog.silverlight.ClipboardButtonType.COPY, - goog.bind(this.handleCopy_, this), - slResource, - caption, - opt_domHelper); -}; -goog.inherits(goog.silverlight.CopyButton, goog.silverlight.ClipboardButton); - - -/** @return {string} The content to be copied to the clipboard. */ -goog.silverlight.CopyButton.prototype.handleCopy_ = function() { - var event = new goog.silverlight.ClipboardEvent( - goog.silverlight.ClipboardEventType.COPY); - this.dispatchEvent(event); - return event.getData() || ''; -}; diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/text-base/silverlight.js.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/text-base/silverlight.js.svn-base deleted file mode 100644 index 49459a3..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/text-base/silverlight.js.svn-base +++ /dev/null @@ -1,760 +0,0 @@ -/** - * @license - * Portions of this code are from Silverlight.js under the Ms-PL license and - * modified by The Closure Authors. - * - * Silverlight.js version 4.0.50401.0 - * - * This file is provided by Microsoft as a helper file for websites that - * incorporate Silverlight Objects. This file is provided under the Microsoft - * Public License available at - * http://code.msdn.microsoft.com/silverlightjs/Project/License.aspx. - * You may not use or distribute this file or the code in this file except as - * expressly permitted under that license. - * - * Copyright (c) Microsoft Corporation. All rights reserved. - */ - -/** - * @fileoverview Modified version of Silverlight.js to work with - * the compiler's advanced modes. The API should be the same, except - * that they're namespaced under goog.silverlight instead of Silverlight. - * - * We've also modified this so that the silverlight bootstrapper - * does not run by default. If you need to start up silverlight, you - * should explicitly call goog.silverlight.startup(). - * - * @author nicksantos@google.com (Nick Santos) (ported to Closure) - */ - -goog.provide('goog.silverlight'); - - -/** - * Counter of globalized event handlers - * @type {number} - */ -goog.silverlight._silverlightCount = 0; - - -/** - * Prevents onSilverlightInstalled from being called multiple - * times - * @type {boolean} - */ -goog.silverlight.__onSilverlightInstalledCalled = false; - - -/** - * Prefix for fwlink URL's - * @type {string} - */ -goog.silverlight.fwlinkRoot = 'http://go2.microsoft.com/fwlink/?LinkID='; - - -/** - * Ensures that only one Installation State event is fired. - * @type {boolean} - */ -goog.silverlight.__installationEventFired = false; - - -/** - * Called by goog.silverlight.getSilverlight to notify the page that a user - * has requested the Silverlight installer - * @type {Function} - */ -goog.silverlight.onGetSilverlight = null; - - -/** - * Called by Silverlight.waitForInstallCompletion when the page detects - * that Silverlight has been installed. The event handler is not called - * in upgrade scenarios. - */ -goog.silverlight.onSilverlightInstalled = function() { - window.location.reload(false); -}; - - -/** - * Checks to see if the correct version is installed. - * @param {?string=} version The silverlight version. - * @return {boolean} Whether silverlight is installed. - */ -goog.silverlight.isInstalled = function(version) { - if (version == undefined) - version = null; - - var isVersionSupported = false; - var container = null; - - try { - var control = null; - var tryNS = false; - if (typeof ActiveXObject == 'undefined') { - try { - control = new ActiveXObject('AgControl.AgControl'); - if (version === null) { - isVersionSupported = true; - } else if (control.isVersionSupported(version)) { - isVersionSupported = true; - } - control = null; - } catch (e) { - tryNS = true; - } - } else { - tryNS = true; - } - if (tryNS) { - var plugin = navigator.plugins['Silverlight Plug-In']; - if (plugin) { - if (version === null) { - isVersionSupported = true; - } else { - var actualVer = plugin.description; - if (actualVer === '1.0.30226.2') - actualVer = '2.0.30226.2'; - var actualVerArray = actualVer.split('.'); - while (actualVerArray.length > 3) { - actualVerArray.pop(); - } - while (actualVerArray.length < 4) { - actualVerArray.push(0); - } - var reqVerArray = version.split('.'); - while (reqVerArray.length > 4) { - reqVerArray.pop(); - } - - var requiredVersionPart; - var actualVersionPart; - var index = 0; - - - do { - requiredVersionPart = parseInt(reqVerArray[index], 10); - actualVersionPart = parseInt(actualVerArray[index], 10); - index++; - } - while (index < reqVerArray.length && - requiredVersionPart === actualVersionPart); - - if (requiredVersionPart <= actualVersionPart && - !isNaN(requiredVersionPart)) { - isVersionSupported = true; - } - } - } - } - } catch (e) { - isVersionSupported = false; - } - - return isVersionSupported; -}; - - -/** - * Occasionally checks for Silverlight installation status. If it - * detects that Silverlight has been installed then it calls - * Silverlight.onSilverlightInstalled();. This is only supported - * if Silverlight was not previously installed on this computer. - */ -goog.silverlight.waitForInstallCompletion = function() { - if (!goog.silverlight.isBrowserRestartRequired && - goog.silverlight.onSilverlightInstalled) { - try { - navigator.plugins.refresh(); - } catch (e) { - } - if (goog.silverlight.isInstalled(null) && - !goog.silverlight.__onSilverlightInstalledCalled) { - goog.silverlight.onSilverlightInstalled(); - goog.silverlight.__onSilverlightInstalledCalled = true; - } else { - setTimeout(goog.silverlight.waitForInstallCompletion, 3000); - } - } -}; - - -/** - * Performs startup tasks. - */ -goog.silverlight.startup = function() { - navigator.plugins.refresh(); - goog.silverlight.isBrowserRestartRequired = - goog.silverlight.isInstalled(null); - if (!goog.silverlight.isBrowserRestartRequired) { - goog.silverlight.waitForInstallCompletion(); - if (!goog.silverlight.__installationEventFired) { - goog.silverlight.onInstallRequired(); - goog.silverlight.__installationEventFired = true; - } - } else if (window.navigator.mimeTypes) { - var mimeSL2 = navigator.mimeTypes['application/x-silverlight-2']; - var mimeSL2b2 = navigator.mimeTypes['application/x-silverlight-2-b2']; - var mimeSL2b1 = navigator.mimeTypes['application/x-silverlight-2-b1']; - var mimeHighestBeta = mimeSL2b1; - if (mimeSL2b2) - mimeHighestBeta = mimeSL2b2; - - if (!mimeSL2 && (mimeSL2b1 || mimeSL2b2)) { - if (!goog.silverlight.__installationEventFired) { - goog.silverlight.onUpgradeRequired(); - goog.silverlight.__installationEventFired = true; - } - } else if (mimeSL2 && mimeHighestBeta) { - if (mimeSL2.enabledPlugin && - mimeHighestBeta.enabledPlugin) { - if (mimeSL2.enabledPlugin.description != - mimeHighestBeta.enabledPlugin.description) { - if (!goog.silverlight.__installationEventFired) { - goog.silverlight.onRestartRequired(); - goog.silverlight.__installationEventFired = true; - } - } - } - } - } -}; - - -/** - * Inserts a Silverlight <object> tag or installation experience into - * the HTML DOM based on the current installed state of - * goog.silverlight. - * @param {string} source The source file. - * @param {Element} parentElement The place to render the tag. - * @param {(string|null)=} opt_id A DOM id for the tag. - * @param {Object=} opt_properties Properties for the tag. One of these should - * be version, to get the correct version of silverlight. - * @param {Array.<Function>=} opt_events An array of functions, keyed by - * the name of the event that they should be listening on (e.g., - * "onload"). What a weird API. The keys should be quoted if you're - * compiling with property renaming on. - * @param {string=} opt_initParams The initParams property of SilverlightPlugin. - * @param {Object=} opt_userContext Context to fire the events in. doesn't - * really work correctly. Use goog.bind instead. - * @return {?string} The html for the object, if no rendering parent - * was specified. - */ -goog.silverlight.createObject = - function(source, parentElement, opt_id, opt_properties, - opt_events, opt_initParams, opt_userContext) { - var slPluginHelper = {}; - var slProperties = opt_properties; - var slEvents = opt_events; - - slPluginHelper.version = slProperties.version; - slProperties.source = source; - slPluginHelper.alt = slProperties.alt; - - // Rename properties to their tag property names. For backwards compatibility - // with goog.silverlight.js version 1.0 - if (opt_initParams) - slProperties.initParams = opt_initParams; - if (slProperties.isWindowless && !slProperties.windowless) - slProperties.windowless = slProperties.isWindowless; - if (slProperties.framerate && !slProperties.maxFramerate) - slProperties.maxFramerate = slProperties.framerate; - if (opt_id && !slProperties.id) - slProperties.id = opt_id; - - // remove elements which are not to be added to the instantiation tag - delete slProperties.ignoreBrowserVer; - delete slProperties.inplaceInstallPrompt; - delete slProperties.version; - delete slProperties.isWindowless; - delete slProperties.framerate; - delete slProperties.data; - delete slProperties.src; - delete slProperties.alt; - - - // detect that the correct version of Silverlight is installed, else - // display install - var slPluginHtml; - if (goog.silverlight.isInstalled(slPluginHelper.version)) { - // move unknown events to the slProperties array - for (var name in slEvents) { - if (slEvents[name]) { - if (name == 'onLoad' && typeof slEvents[name] == 'function' && - slEvents[name].length != 1) { - var onLoadHandler = slEvents[name]; - slEvents[name] = function(sender) { - return onLoadHandler( - document.getElementById(/** @type {string} */ (opt_id)), - opt_userContext, - sender); - }; - } - var handlerName = goog.silverlight.getHandlerName(slEvents[name]); - if (handlerName != null) { - slProperties[name] = handlerName; - slEvents[name] = null; - } else { - throw 'typeof events.' + name + " must be 'function' or 'string'"; - } - } - } - slPluginHtml = goog.silverlight.buildHtml(slProperties); - } else { - // The control could not be instantiated. Show the installation prompt - slPluginHtml = goog.silverlight.buildPromptHtml(slPluginHelper); - } - - // insert or return the HTML - if (parentElement) { - parentElement.innerHTML = slPluginHtml; - } else { - return slPluginHtml; - } - return null; -}; - - -/** - * Create HTML that instantiates the control - * @param {Object} slProperties The properties of the object. - * @return {string} The HTML for the object. - */ -goog.silverlight.buildHtml = function(slProperties) { - var htmlBuilder = []; - - htmlBuilder.push( - '<object type=\"application/x-silverlight\" ' + - 'data="data:application/x-silverlight,"'); - if (slProperties.id != null) { - htmlBuilder.push( - ' id="' + - goog.silverlight.htmlAttributeEncode(slProperties.id) + '"'); - } - if (slProperties.width != null) { - htmlBuilder.push(' width="' + slProperties.width + '"'); - } - if (slProperties.height != null) { - htmlBuilder.push(' height="' + slProperties.height + '"'); - } - htmlBuilder.push(' >'); - - delete slProperties.id; - delete slProperties.width; - delete slProperties.height; - - for (var name in slProperties) { - if (slProperties[name]) { - htmlBuilder.push( - '<param name="' + goog.silverlight.htmlAttributeEncode(name) + - '" value="' + - goog.silverlight.htmlAttributeEncode(slProperties[name]) + - '" />'); - } - } - htmlBuilder.push('<\/object>'); - return htmlBuilder.join(''); -}; - - -/** - * takes a single parameter of all createObject - * parameters enclosed in {} - * @param {{source: string, - * parentElement: Element, - * id: string, - * properties: Object, - * events: Array.<Function>, - * initParams: string, - * context: Object}} params Named parameters of createObject. - * @return {?string} See #createObject. - */ -goog.silverlight.createObjectEx = function(params) { - // stupid hack to make compiler stop complaining. - var unused = {properties: 0, events: 0, context: 0}; - - var parameters = params; - var html = goog.silverlight.createObject( - parameters.source, parameters.parentElement, parameters.id, - parameters.properties, parameters.events, parameters.initParams, - parameters.context); - if (parameters.parentElement == null) { - return html; - } - return null; -}; - - -/** - * Builds the HTML to prompt the user to download and install Silverlight - * - * @param {{version: string, alt: string}} slPluginHelper Alt is an alternate - * link to silverlight. If no alternate is specified, a default will - * be used with the given version number. - * @return {string} The UI. - */ -goog.silverlight.buildPromptHtml = function(slPluginHelper) { - var slPluginHtml = ''; - var urlRoot = goog.silverlight.fwlinkRoot; - var version = slPluginHelper.version; - if (slPluginHelper.alt) { - slPluginHtml = slPluginHelper.alt; - } else { - if (!version) { - version = ''; - } - slPluginHtml = - "<a href='javascript:goog.silverlight.getSilverlight(\"{1}\");' " + - "style='text-decoration: none;'><img src='{2}' " + - "alt='Get Microsoft Silverlight' style='border-style: none'/></a>"; - slPluginHtml = slPluginHtml.replace('{1}', version); - slPluginHtml = slPluginHtml.replace('{2}', urlRoot + '108181'); - } - - return slPluginHtml; -}; - - -/** - * Navigates the browser to the appropriate Silverlight installer - * @param {string} version The silverlight version. - */ -goog.silverlight.getSilverlight = function(version) { - if (goog.silverlight.onGetSilverlight) { - goog.silverlight.onGetSilverlight(); - } - - var shortVer = ''; - var reqVerArray = String(version).split('.'); - if (reqVerArray.length > 1) { - var majorNum = parseInt(reqVerArray[0], 10); - if (isNaN(majorNum) || majorNum < 2) { - shortVer = '1.0'; - } else { - shortVer = reqVerArray[0] + '.' + reqVerArray[1]; - } - } - - var verArg = ''; - - if (shortVer.match(/^\d+\056\d+$/)) { - verArg = '&v=' + shortVer; - } - - goog.silverlight.followFWLink('149156' + verArg); -}; - - -/** - * Navigates to a url based on fwlinkid - * @param {string} linkid The link suffix. - */ -goog.silverlight.followFWLink = function(linkid) { - top.location = goog.silverlight.fwlinkRoot + String(linkid); -}; - - -/** - * Encodes special characters in input strings as charcodes - * @param {?string} strInput String to encode, or null. If null - * is passed, we give null right back. - * @return {?string} The encoded string, or null. - */ -goog.silverlight.htmlAttributeEncode = function(strInput) { - var c; - var retVal = ''; - - if (strInput == null) { - return null; - } - - for (var cnt = 0; cnt < strInput.length; cnt++) { - c = strInput.charCodeAt(cnt); - - if (((c > 96) && (c < 123)) || - ((c > 64) && (c < 91)) || - ((c > 43) && (c < 58) && (c != 47)) || - (c == 95)) { - retVal = retVal + String.fromCharCode(c); - } else { - retVal = retVal + '&#' + c + ';'; - } - } - - return retVal; -}; - - -/** - * Default error handling function - * @param {SilverlightDependencyObject} sender dep object. - * @param {SilverlightErrorEventArgs} args The event. - */ -goog.silverlight.defaultErrorHandler = function(sender, args) { - var iErrorCode; - var errorType = args.errorType; - - iErrorCode = args.errorCode; - - var errMsg = '\nSilverlight error message \n'; - - errMsg += 'ErrorCode: ' + iErrorCode + '\n'; - - - errMsg += 'ErrorType: ' + errorType + ' \n'; - errMsg += 'Message: ' + args.errorMessage + ' \n'; - - if (errorType == 'ParserError') { - errMsg += 'XamlFile: ' + args.xamlFile + ' \n'; - errMsg += 'Line: ' + args.lineNumber + ' \n'; - errMsg += 'Position: ' + args.charPosition + ' \n'; - } else if (errorType == 'RuntimeError') { - if (args.lineNumber != 0) { - errMsg += 'Line: ' + args.lineNumber + ' \n'; - errMsg += 'Position: ' + args.charPosition + ' \n'; - } - errMsg += 'MethodName: ' + args.methodName + ' \n'; - } - alert(errMsg); -}; - - -/** - * Releases event handler resources when the page is unloaded - */ -goog.silverlight.__cleanup = function() { - for (var i = goog.silverlight._silverlightCount - 1; i >= 0; i--) { - goog.global['__closure_slEvent' + i] = null; - } - goog.silverlight._silverlightCount = 0; - if (window.removeEventListener) { - window.removeEventListener('unload', goog.silverlight.__cleanup, false); - } else { - window.detachEvent('onunload', goog.silverlight.__cleanup); - } -}; - - -/** - * Generates named event handlers for delegates. - * - * Attaches them to the global window with the name __closure_slEvent + - * a unique id. - * - * @param {Function|string} handler A function to export. - * @return {?string} The name of the handler. - */ -goog.silverlight.getHandlerName = function(handler) { - var handlerName = ''; - if (typeof handler == 'string') { - handlerName = handler; - } else if (typeof handler == 'function') { - if (goog.silverlight._silverlightCount == 0) { - if (window.addEventListener) { - window.addEventListener('unload', goog.silverlight.__cleanup, false); - } else { - window.attachEvent('onunload', goog.silverlight.__cleanup); - } - } - var count = goog.silverlight._silverlightCount++; - handlerName = '__closure_slEvent' + count; - - goog.global[handlerName] = handler; - } else { - handlerName = null; - } - return handlerName; -}; - - -/** - * Frees a handler created by getHandlerName. - * @param {string} handlerName A handler name. - */ -goog.silverlight.disposeHandlerName = function(handlerName) { - delete goog.global[handlerName]; -}; - - -/** - * Called by version verification control to notify the page that - * an appropriate build of Silverlight is available. The page - * should respond by injecting the appropriate Silverlight control - */ -goog.silverlight.onRequiredVersionAvailable = function() { - -}; - - -/** - * Called by version verification control to notify the page that - * an appropriate build of Silverlight is installed but not loaded. - * The page should respond by injecting a clear and visible - * "Thanks for installing. Please restart your browser and return - * to mysite.com" or equivalent into the browser DOM - */ -goog.silverlight.onRestartRequired = function() { - -}; - - -/** - * Called by version verification control to notify the page that - * Silverlight must be upgraded. The page should respond by - * injecting a clear, visible, and actionable upgrade message into - * the DOM. The message must inform the user that they need to - * upgrade Silverlight to use the page. They are already somewhat - * familiar with the Silverlight product when they encounter this. - * Silverlight should be mentioned so the user expects to see that - * string in the installer UI. However, the Silverlight-powered - * application should be the focus of the solicitation. The user - * wants the app. Silverlight is a means to the app. - * - * The upgrade solicitation will have a button that directs - * the user to the Silverlight installer. Upon click the button - * should both kick off a download of the installer URL and replace - * the Upgrade text with "Thanks for downloading. When the upgarde - * is complete please restart your browser and return to - * mysite.com" or equivalent. - * - * Note: For a more interesting upgrade UX we can use Silverlight - * 1.0-style XAML for this upgrade experience. Contact PiotrP for - * details. - */ -goog.silverlight.onUpgradeRequired = function() { - -}; - - -/** - * Called by goog.silverlight.checkInstallStatus to notify the page - * that Silverlight has not been installed by this user. - * The page should respond by - * injecting a clear, visible, and actionable upgrade message into - * the DOM. The message must inform the user that they need to - * download and install components needed to use the page. - * Silverlight should be mentioned so the user expects to see that - * string in the installer UI. However, the Silverlight-powered - * application should be the focus of the solicitation. The user - * wants the app. Silverlight is a means to the app. - * - * The installation solicitation will have a button that directs - * the user to the Silverlight installer. Upon click the button - * should both kick off a download of the installer URL and replace - * the Upgrade text with "Thanks for downloading. When installation - * is complete you may need to refresh the page to view this - * content" or equivalent. - */ -goog.silverlight.onInstallRequired = function() { - -}; - - -/** - * This function should be called at the beginning of a web page's - * Silverlight error handler. It will determine if the required - * version of Silverlight is installed and available in the - * current process. - * - * During its execution the function will trigger one of the - * Silverlight installation state events, if appropriate. - * - * Sender and Args should be passed through from the calling - * onError handler's parameters. - * - * The associated Sivlerlight <object> tag must have - * minRuntimeVersion set and should have autoUpgrade set to false. - * - * @param {SilverlightDependencyObject} sender The sender. - * @param {SilverlightErrorEventArgs} args The event arguments. - * @return {boolean} Is the version available? - */ -goog.silverlight.isVersionAvailableOnError = function(sender, args) { - var retVal = false; - try { - if (args.errorCode == 8001 && !goog.silverlight.__installationEventFired) { - goog.silverlight.onUpgradeRequired(); - goog.silverlight.__installationEventFired = true; - } else if (args.errorCode == 8002 && - !goog.silverlight.__installationEventFired) { - goog.silverlight.onRestartRequired(); - goog.silverlight.__installationEventFired = true; - } - // this handles upgrades from 1.0. That control did not - // understand the minRuntimeVerison parameter. It also - // did not know how to parse XAP files, so would throw - // Parse Error (5014). A Beta 2 control may throw 2106 - else if (args.errorCode == 5014 || args.errorCode == 2106) { - if (goog.silverlight.__verifySilverlight2UpgradeSuccess(args.getHost())) { - retVal = true; - } - } else { - retVal = true; - } - } catch (e) { - } - return retVal; -}; - - -/** - * This function should be called at the beginning of a web page's - * Silverlight onLoad handler. It will determine if the required - * version of Silverlight is installed and available in the - * current process. - * - * During its execution the function will trigger one of the - * Silverlight installation state events, if appropriate. - * - * Sender should be passed through from the calling - * onError handler's parameters. - * - * The associated Sivlerlight <object> tag must have - * minRuntimeVersion set and should have autoUpgrade set to false. - * - * @param {SilverlightDependencyObject} sender The dep object. - * @return {boolean} Is the version available? - */ -goog.silverlight.isVersionAvailableOnLoad = function(sender) { - var retVal = false; - try { - if (goog.silverlight.__verifySilverlight2UpgradeSuccess(sender.getHost())) { - retVal = true; - } - } catch (e) { - } - return retVal; -}; - - -/** - * This internal function helps identify installation state by - * taking advantage of behavioral differences between the - * 1.0 and 2.0 releases of goog.silverlight. - * @param {SilverlightPlugin} host The dep object. - * @return {boolean} If verification succeeded. - */ -goog.silverlight.__verifySilverlight2UpgradeSuccess = function(host) { - var retVal = false; - var version = '4.0.50401'; - var installationEvent = null; - - try { - if (host.isVersionSupported(version + '.99')) { - installationEvent = goog.silverlight.onRequiredVersionAvailable; - retVal = true; - } else if (host.isVersionSupported(version + '.0')) { - installationEvent = goog.silverlight.onRestartRequired; - } else { - installationEvent = goog.silverlight.onUpgradeRequired; - } - - if (installationEvent && !goog.silverlight.__installationEventFired) { - installationEvent(); - goog.silverlight.__installationEventFired = true; - } - } catch (e) { - } - return retVal; -}; diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/text-base/supporteduseragent.js.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/text-base/supporteduseragent.js.svn-base deleted file mode 100644 index e436d9b..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/text-base/supporteduseragent.js.svn-base +++ /dev/null @@ -1,138 +0,0 @@ -/** - * @license - * Portions of this code are from Silverlight.supportedUserAgent.js - * under the Ms-PL license. - * - * Silverlight.supportedUserAgent.js version 4.0.50401.0 - * - * This file is provided by Microsoft as a helper file for websites that - * incorporate Silverlight Objects. This file is provided under the Microsoft - * Public License available at - * http://code.msdn.microsoft.com/SLsupportedUA/Project/License.aspx. - * You may not use or distribute this file or the code in this file except as - * expressly permitted under that license. - * - * Copyright (c) Microsoft Corporation. All rights reserved. - */ - -/** - * @fileoverview Modified version of Silverlight.supportedUserAgent.js - * to work with the compiler's advanced modes. The API should be the same, - * except that they're namespaced under goog.silverlight - * instead of Silverlight. - * - * @author nicksantos@google.com (Nick Santos) (ported to Closure) - */ - -goog.provide('goog.silverlight.supportedUserAgent'); - - -/** - * NOTE: This function is strongly tied to current implementations of web - * browsers. The implementation of this function will change over time to - * account for new Web browser developments. Visit - * http://code.msdn.microsoft.com/SLsupportedUA often to ensure that you have - * the latest version. - * - * Determines if the client browser is supported by Silverlight. - * - * @param {string} version - * determines if a particular version of Silverlight supports - * this browser. Acceptable values are "1.0" and "2.0". - * @param {string=} userAgent - * optional. User Agent string to be analized. If null then the - * current browsers user agent string will be used. - * - * @return {boolean} Whether the user agent is supported. - */ -goog.silverlight.supportedUserAgent = function(version, userAgent) { - try { - var ua = null; - - if (userAgent) { - ua = userAgent; - } else { - ua = window.navigator.userAgent; - } - - var slua = {OS: 'Unsupported', Browser: 'Unsupported'}; - - //Silverlight does not support pre-Windows NT platforms - if (ua.indexOf('Windows NT') >= 0 || - ua.indexOf('Mozilla/4.0 (compatible; MSIE 6.0)') >= 0) { - slua.OS = 'Windows'; - } else if (ua.indexOf('PPC Mac OS X') >= 0) { - slua.OS = 'MacPPC'; - } else if (ua.indexOf('Intel Mac OS X') >= 0) { - slua.OS = 'MacIntel'; - } else if (ua.indexOf('Linux') >= 0) { - slua.OS = 'Linux'; - } - - if (slua.OS != 'Unsupported') { - if (ua.indexOf('MSIE') >= 0) { - if (navigator.userAgent.indexOf('Win64') == -1) { - if (parseInt(ua.split('MSIE')[1], 10) >= 6) { - slua.Browser = 'MSIE'; - } - } - } else if (ua.indexOf('Firefox') >= 0) { - var versionArr = ua.split('Firefox/')[1].split('.'); - var major = parseInt(versionArr[0], 10); - if (major >= 2) { - slua.Browser = 'Firefox'; - } else { - var minor = parseInt(versionArr[1], 10); - if ((major == 1) && (minor >= 5)) { - slua.Browser = 'Firefox'; - } - } - } else if (ua.indexOf('Chrome') >= 0) { - slua.Browser = 'Chrome'; - } else if (ua.indexOf('Safari') >= 0) { - slua.Browser = 'Safari'; - } - } - - var sl_version = parseInt(version, 10); - - // detect all unsupported platform combinations (IE on Mac, Safari on Win) - var supUA = (!(// Unsupported OS - slua.OS == 'Unsupported' || - // Unsupported Browser - slua.Browser == 'Unsupported' || - // Safari is not supported on Windows - (slua.OS == 'Windows' && slua.Browser == 'Safari') || - // IE is not supported on Mac - (slua.OS.indexOf('Mac') >= 0 && slua.Browser == 'MSIE') || - // Google Chrome is not supported on Mac - (slua.OS.indexOf('Mac') >= 0 && slua.Browser == 'Chrome'))); - - // Detection of specific platform/versions - - // Google Chrome only on Windows and only in SL4+ - if ((slua.OS.indexOf('Windows') >= 0 && - slua.Browser == 'Chrome' && sl_version < 4)) { - return false; - } - - // detect unsupported MacPPC platforms (basically anything but 1.0) - if ((slua.OS == 'MacPPC') && (sl_version > 1)) { - return ((supUA && (slua.OS != 'MacPPC'))); - } - - // detect unsupported Linux platforms per Moonlight - if ((slua.OS == 'Linux') && (sl_version > 2)) { - return ((supUA && (slua.OS != 'Linux'))); - } - - // detect other unsupported 1.0 platforms (win2k) - if (version == '1.0') { - return (supUA && (ua.indexOf('Windows NT 5.0') < 0)); - } else { - return (supUA); - } - } catch (e) { - return false; - } -}; diff --git a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/text-base/xap_files.svn-base b/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/text-base/xap_files.svn-base Binary files differdeleted file mode 100644 index 6a9209f..0000000 --- a/contexts/data/lib/closure-library/third_party/closure/goog/silverlight/.svn/text-base/xap_files.svn-base +++ /dev/null |