You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by li...@apache.org on 2010/09/15 03:40:15 UTC
svn commit: r997163 [34/37] - in
/shindig/trunk/features/src/main/javascript/features: caja/
com.google.gadgets.analytics/ container/ core.config/ core.io/ core.json/
core.legacy/ core.log/ core.prefs/ core.util/ dynamic-height.util/
dynamic-height/ fl...
Modified: shindig/trunk/features/src/main/javascript/features/opensocial-reference/person.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/opensocial-reference/person.js?rev=997163&r1=997162&r2=997163&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/opensocial-reference/person.js (original)
+++ shindig/trunk/features/src/main/javascript/features/opensocial-reference/person.js Wed Sep 15 01:39:49 2010
@@ -58,26 +58,26 @@ opensocial.Person.Field = {
* A string ID that can be permanently associated with this person.
* @member opensocial.Person.Field
*/
- ID : 'id',
+ ID: 'id',
/**
* A opensocial.Name object containing the person's name.
* @member opensocial.Person.Field
*/
- NAME : 'name',
+ NAME: 'name',
/**
* A String representing the person's nickname.
* @member opensocial.Person.Field
*/
- NICKNAME : 'nickname',
+ NICKNAME: 'nickname',
/**
* Person's photo thumbnail URL, specified as a string.
* This URL must be fully qualified. Relative URLs will not work in gadgets.
* @member opensocial.Person.Field
*/
- THUMBNAIL_URL : 'thumbnailUrl',
+ THUMBNAIL_URL: 'thumbnailUrl',
/**
* Person's profile URL, specified as a string.
@@ -85,7 +85,7 @@ opensocial.Person.Field = {
* Container support for this field is OPTIONAL.
* @member opensocial.Person.Field
*/
- PROFILE_URL : 'profileUrl',
+ PROFILE_URL: 'profileUrl',
/**
* Person's current location, specified as an
@@ -93,7 +93,7 @@ opensocial.Person.Field = {
* Container support for this field is OPTIONAL.
* @member opensocial.Person.Field
*/
- CURRENT_LOCATION : 'currentLocation',
+ CURRENT_LOCATION: 'currentLocation',
/**
* Addresses associated with the person, specified as an Array of
@@ -101,7 +101,7 @@ opensocial.Person.Field = {
* Container support for this field is OPTIONAL.
* @member opensocial.Person.Field
*/
- ADDRESSES : 'addresses',
+ ADDRESSES: 'addresses',
/**
* Emails associated with the person, specified as an Array of
@@ -109,7 +109,7 @@ opensocial.Person.Field = {
* Container support for this field is OPTIONAL.
* @member opensocial.Person.Field
*/
- EMAILS : 'emails',
+ EMAILS: 'emails',
/**
* Phone numbers associated with the person, specified as an Array of
@@ -117,7 +117,7 @@ opensocial.Person.Field = {
* Container support for this field is OPTIONAL.
* @member opensocial.Person.Field
*/
- PHONE_NUMBERS : 'phoneNumbers',
+ PHONE_NUMBERS: 'phoneNumbers',
/**
* A general statement about the person, specified as a string.
@@ -125,7 +125,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- ABOUT_ME : 'aboutMe',
+ ABOUT_ME: 'aboutMe',
/**
* Person's status, headline or shoutout, specified as a string.
@@ -133,7 +133,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- STATUS : 'status',
+ STATUS: 'status',
/**
* Person's profile song, specified as an opensocial.Url.
@@ -141,7 +141,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- PROFILE_SONG : 'profileSong',
+ PROFILE_SONG: 'profileSong',
/**
* Person's profile video, specified as an opensocial.Url.
@@ -149,7 +149,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- PROFILE_VIDEO : 'profileVideo',
+ PROFILE_VIDEO: 'profileVideo',
/**
* Person's gender, specified as an opensocial.Enum with the enum's
@@ -158,49 +158,49 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- GENDER : 'gender',
+ GENDER: 'gender',
/**
* Person's sexual orientation, specified as a string.
* Container support for this field is OPTIONAL.
* @member opensocial.Person.Field
*/
- SEXUAL_ORIENTATION : 'sexualOrientation',
+ SEXUAL_ORIENTATION: 'sexualOrientation',
/**
* Person's relationship status, specified as a string.
* Container support for this field is OPTIONAL.
* @member opensocial.Person.Field
*/
- RELATIONSHIP_STATUS : 'relationshipStatus',
+ RELATIONSHIP_STATUS: 'relationshipStatus',
/**
* Person's age, specified as a number.
* Container support for this field is OPTIONAL.
* @member opensocial.Person.Field
*/
- AGE : 'age',
+ AGE: 'age',
/**
* Person's date of birth, specified as a Date object.
* Container support for this field is OPTIONAL.
* @member opensocial.Person.Field
*/
- DATE_OF_BIRTH : 'dateOfBirth',
+ DATE_OF_BIRTH: 'dateOfBirth',
/**
* Person's body characteristics, specified as an opensocial.BodyType.
* Container support for this field is OPTIONAL.
* @member opensocial.Person.Field
*/
- BODY_TYPE : 'bodyType',
+ BODY_TYPE: 'bodyType',
/**
* Person's ethnicity, specified as a string.
* Container support for this field is OPTIONAL.
* @member opensocial.Person.Field
*/
- ETHNICITY : 'ethnicity',
+ ETHNICITY: 'ethnicity',
/**
* Person's smoking status, specified as an opensocial.Enum with the enum's
@@ -209,7 +209,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- SMOKER : 'smoker',
+ SMOKER: 'smoker',
/**
* Person's drinking status, specified as an opensocial.Enum with the enum's
@@ -218,28 +218,28 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- DRINKER : 'drinker',
+ DRINKER: 'drinker',
/**
* Description of the person's children, specified as a string.
* Container support for this field is OPTIONAL.
* @member opensocial.Person.Field
*/
- CHILDREN : 'children',
+ CHILDREN: 'children',
/**
* Description of the person's pets, specified as a string.
* Container support for this field is OPTIONAL.
* @member opensocial.Person.Field
*/
- PETS : 'pets',
+ PETS: 'pets',
/**
* Description of the person's living arrangement, specified as a string.
* Container support for this field is OPTIONAL.
* @member opensocial.Person.Field
*/
- LIVING_ARRANGEMENT : 'livingArrangement',
+ LIVING_ARRANGEMENT: 'livingArrangement',
/**
* Person's time zone, specified as the difference in minutes between
@@ -248,7 +248,7 @@ opensocial.Person.Field = {
* Container support for this field is OPTIONAL.
* @member opensocial.Person.Field
*/
- TIME_ZONE : 'timeZone',
+ TIME_ZONE: 'timeZone',
/**
* List of the languages that the person speaks as ISO 639-1 codes,
@@ -256,7 +256,7 @@ opensocial.Person.Field = {
* Container support for this field is OPTIONAL.
* @member opensocial.Person.Field
*/
- LANGUAGES_SPOKEN : 'languagesSpoken',
+ LANGUAGES_SPOKEN: 'languagesSpoken',
/**
* Jobs the person has held, specified as an Array of
@@ -265,7 +265,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- JOBS : 'jobs',
+ JOBS: 'jobs',
/**
* Person's favorite jobs, or job interests and skills, specified as a string.
@@ -273,7 +273,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- JOB_INTERESTS : 'jobInterests',
+ JOB_INTERESTS: 'jobInterests',
/**
* Schools the person has attended, specified as an Array of
@@ -282,7 +282,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- SCHOOLS : 'schools',
+ SCHOOLS: 'schools',
/**
* Person's interests, hobbies or passions, specified as an Array of strings.
@@ -290,7 +290,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- INTERESTS : 'interests',
+ INTERESTS: 'interests',
/**
* URLs related to the person, their webpages, or feeds. Specified as an
@@ -299,7 +299,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- URLS : 'urls',
+ URLS: 'urls',
/**
* Person's favorite music, specified as an Array of strings.
@@ -307,7 +307,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- MUSIC : 'music',
+ MUSIC: 'music',
/**
* Person's favorite movies, specified as an Array of strings.
@@ -315,7 +315,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- MOVIES : 'movies',
+ MOVIES: 'movies',
/**
* Person's favorite TV shows, specified as an Array of strings.
@@ -323,7 +323,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- TV_SHOWS : 'tvShows',
+ TV_SHOWS: 'tvShows',
/**
* Person's favorite books, specified as an Array of strings.
@@ -331,7 +331,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- BOOKS : 'books',
+ BOOKS: 'books',
/**
* Person's favorite activities, specified as an Array of strings.
@@ -339,7 +339,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- ACTIVITIES : 'activities',
+ ACTIVITIES: 'activities',
/**
* Person's favorite sports, specified as an Array of strings.
@@ -347,7 +347,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- SPORTS : 'sports',
+ SPORTS: 'sports',
/**
* Person's favorite heroes, specified as an Array of strings.
@@ -355,7 +355,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- HEROES : 'heroes',
+ HEROES: 'heroes',
/**
* Person's favorite quotes, specified as an Array of strings.
@@ -363,7 +363,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- QUOTES : 'quotes',
+ QUOTES: 'quotes',
/**
* Person's favorite cars, specified as an Array of strings.
@@ -371,7 +371,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- CARS : 'cars',
+ CARS: 'cars',
/**
* Person's favorite food, specified as an Array of strings.
@@ -379,7 +379,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- FOOD : 'food',
+ FOOD: 'food',
/**
* Person's turn ons, specified as an Array of strings.
@@ -387,7 +387,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- TURN_ONS : 'turnOns',
+ TURN_ONS: 'turnOns',
/**
* Person's turn offs, specified as an Array of strings.
@@ -395,7 +395,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- TURN_OFFS : 'turnOffs',
+ TURN_OFFS: 'turnOffs',
/**
* Arbitrary tags about the person, specified as an Array of strings.
@@ -403,7 +403,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- TAGS : 'tags',
+ TAGS: 'tags',
/**
* Person's comments about romance, specified as a string.
@@ -411,7 +411,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- ROMANCE : 'romance',
+ ROMANCE: 'romance',
/**
* What the person is scared of, specified as a string.
@@ -419,7 +419,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- SCARED_OF : 'scaredOf',
+ SCARED_OF: 'scaredOf',
/**
* Describes when the person is happiest, specified as a string.
@@ -427,7 +427,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- HAPPIEST_WHEN : 'happiestWhen',
+ HAPPIEST_WHEN: 'happiestWhen',
/**
* Person's thoughts on fashion, specified as a string.
@@ -435,7 +435,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- FASHION : 'fashion',
+ FASHION: 'fashion',
/**
* Person's thoughts on humor, specified as a string.
@@ -443,7 +443,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- HUMOR : 'humor',
+ HUMOR: 'humor',
/**
* Person's statement about who or what they are looking for, or what they are
@@ -453,7 +453,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- LOOKING_FOR : 'lookingFor',
+ LOOKING_FOR: 'lookingFor',
/**
* Person's relgion or religious views, specified as a string.
@@ -461,7 +461,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- RELIGION : 'religion',
+ RELIGION: 'religion',
/**
* Person's political views, specified as a string.
@@ -469,7 +469,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- POLITICAL_VIEWS : 'politicalViews',
+ POLITICAL_VIEWS: 'politicalViews',
/**
* A boolean indicating whether the person has used the current app.
@@ -477,7 +477,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- HAS_APP : 'hasApp',
+ HAS_APP: 'hasApp',
/**
* Person's current network status. Specified as an Enum with the enum's
@@ -486,14 +486,14 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- NETWORK_PRESENCE : 'networkPresence'
+ NETWORK_PRESENCE: 'networkPresence'
};
/**
* Gets an ID that can be permanently associated with this person.
*
- * @return {string} The ID
+ * @return {string} The ID.
*/
opensocial.Person.prototype.getId = function() {
return this.getField(opensocial.Person.Field.ID);
@@ -501,17 +501,17 @@ opensocial.Person.prototype.getId = func
var ORDERED_NAME_FIELDS_ = [
- opensocial.Name.Field.HONORIFIC_PREFIX,
- opensocial.Name.Field.GIVEN_NAME,
- opensocial.Name.Field.FAMILY_NAME,
- opensocial.Name.Field.HONORIFIC_SUFFIX,
- opensocial.Name.Field.ADDITIONAL_NAME];
+ opensocial.Name.Field.HONORIFIC_PREFIX,
+ opensocial.Name.Field.GIVEN_NAME,
+ opensocial.Name.Field.FAMILY_NAME,
+ opensocial.Name.Field.HONORIFIC_SUFFIX,
+ opensocial.Name.Field.ADDITIONAL_NAME];
/**
* Gets a text display name for this person; guaranteed to return
* a useful string.
*
- * @return {string} The display name
+ * @return {string} The display name.
*/
opensocial.Person.prototype.getDisplayName = function() {
var name = this.getField(opensocial.Person.Field.NAME);
@@ -530,7 +530,7 @@ opensocial.Person.prototype.getDisplayNa
fullName += nameValue + ' ';
}
}
- return fullName.replace(/^\s+|\s+$/g, '') ;
+ return fullName.replace(/^\s+|\s+$/g, '');
}
// Finally, try the nickname field
@@ -548,7 +548,7 @@ opensocial.Person.prototype.getDisplayNa
* opt_params Additional
* <a href="opensocial.DataRequest.DataRequestFields.html">params</a>
* to pass to the request.
- * @return {string} The data
+ * @return {string} The data.
*/
opensocial.Person.prototype.getField = function(key, opt_params) {
return opensocial.Container.getField(this.fields_, key, opt_params);
@@ -570,7 +570,7 @@ opensocial.Person.prototype.getAppData =
* Returns true if this person object represents the currently logged in user.
*
* @return {boolean} True if this is the currently logged in user;
- * otherwise, false
+ * otherwise, false.
*/
opensocial.Person.prototype.isViewer = function() {
return !!this.isViewer_;
@@ -581,7 +581,7 @@ opensocial.Person.prototype.isViewer = f
* Returns true if this person object represents the owner of the current page.
*
* @return {boolean} True if this is the owner of the page;
- * otherwise, false
+ * otherwise, false.
*/
opensocial.Person.prototype.isOwner = function() {
return !!this.isOwner_;
Modified: shindig/trunk/features/src/main/javascript/features/opensocial-reference/phone.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/opensocial-reference/phone.js?rev=997163&r1=997162&r2=997163&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/opensocial-reference/phone.js (original)
+++ shindig/trunk/features/src/main/javascript/features/opensocial-reference/phone.js Wed Sep 15 01:39:49 2010
@@ -60,14 +60,14 @@ opensocial.Phone.Field = {
*
* @member opensocial.Phone.Field
*/
- TYPE : 'type',
+ TYPE: 'type',
/**
* The phone number, specified as a String.
*
* @member opensocial.Phone.Field
*/
- NUMBER : 'number'
+ NUMBER: 'number'
};
@@ -81,7 +81,7 @@ opensocial.Phone.Field = {
* opt_params Additional
* <a href="opensocial.DataRequest.DataRequestFields.html">params</a>
* to pass to the request.
- * @return {string} The data
+ * @return {string} The data.
*/
opensocial.Phone.prototype.getField = function(key, opt_params) {
return opensocial.Container.getField(this.fields_, key, opt_params);
Modified: shindig/trunk/features/src/main/javascript/features/opensocial-reference/responseitem.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/opensocial-reference/responseitem.js?rev=997163&r1=997162&r2=997163&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/opensocial-reference/responseitem.js (original)
+++ shindig/trunk/features/src/main/javascript/features/opensocial-reference/responseitem.js Wed Sep 15 01:39:49 2010
@@ -53,7 +53,7 @@ opensocial.ResponseItem = function(origi
/**
* Returns true if there was an error in fetching this data from the server.
*
- * @return {boolean} True if there was an error; otherwise, false
+ * @return {boolean} True if there was an error; otherwise, false.
*/
opensocial.ResponseItem.prototype.hadError = function() {
return !!this.errorCode_;
@@ -74,7 +74,7 @@ opensocial.ResponseItem.Error = {
*
* @member opensocial.ResponseItem.Error
*/
- NOT_IMPLEMENTED : 'notImplemented',
+ NOT_IMPLEMENTED: 'notImplemented',
/**
* The gadget does not have access to the requested data.
@@ -84,21 +84,21 @@ opensocial.ResponseItem.Error = {
*
* @member opensocial.ResponseItem.Error
*/
- UNAUTHORIZED : 'unauthorized',
+ UNAUTHORIZED: 'unauthorized',
/**
* The gadget can never have access to the requested data.
*
* @member opensocial.ResponseItem.Error
*/
- FORBIDDEN : 'forbidden',
+ FORBIDDEN: 'forbidden',
- /**
+ /**
* The request was invalid. Example: 'max' was -1.
*
* @member opensocial.ResponseItem.Error
*/
- BAD_REQUEST : 'badRequest',
+ BAD_REQUEST: 'badRequest',
/**
* The request encountered an unexpected condition that
@@ -106,7 +106,7 @@ opensocial.ResponseItem.Error = {
*
* @member opensocial.ResponseItem.Error
*/
- INTERNAL_ERROR : 'internalError',
+ INTERNAL_ERROR: 'internalError',
/**
* The gadget exceeded a quota on the request. Example quotas include a
@@ -115,7 +115,7 @@ opensocial.ResponseItem.Error = {
*
* @member opensocial.ResponseItem.Error
*/
- LIMIT_EXCEEDED : 'limitExceeded'
+ LIMIT_EXCEEDED: 'limitExceeded'
};
@@ -125,7 +125,7 @@ opensocial.ResponseItem.Error = {
* or one of the values defined by
* <a href="opensocial.ResponseItem.Error.html"><code>Error</code></a>.
*
- * @return {string} The error code, or null if no error occurred
+ * @return {string} The error code, or null if no error occurred.
*/
opensocial.ResponseItem.prototype.getErrorCode = function() {
return this.errorCode_;
@@ -136,7 +136,7 @@ opensocial.ResponseItem.prototype.getErr
* If the request had an error, returns the error message.
*
* @return {string} A human-readable description of the error that occurred;
- * can be null, even if an error occurred
+ * can be null, even if an error occurred.
*/
opensocial.ResponseItem.prototype.getErrorMessage = function() {
return this.errorMessage_;
@@ -147,7 +147,7 @@ opensocial.ResponseItem.prototype.getErr
* Returns the original data request.
*
* @return {opensocial.DataRequest} The data request used to fetch this data
- * response
+ * response.
*/
opensocial.ResponseItem.prototype.getOriginalDataRequest = function() {
return this.originalDataRequest_;
@@ -158,7 +158,7 @@ opensocial.ResponseItem.prototype.getOri
* Gets the response data.
*
* @return {Object} The requested value calculated by the server; the type of
- * this value is defined by the type of request that was made
+ * this value is defined by the type of request that was made.
*/
opensocial.ResponseItem.prototype.getData = function() {
return this.data_;
Modified: shindig/trunk/features/src/main/javascript/features/opensocial-reference/taming.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/opensocial-reference/taming.js?rev=997163&r1=997162&r2=997163&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/opensocial-reference/taming.js (original)
+++ shindig/trunk/features/src/main/javascript/features/opensocial-reference/taming.js Wed Sep 15 01:39:49 2010
@@ -67,28 +67,28 @@ tamings___.push(function(imports) {
___.grantInnocentMethod(JsonPerson.prototype, 'getAppData');
caja___.whitelistCtors([
- [window, 'JsonRpcRequestItem', Object],
- [opensocial, 'Activity', Object],
- [opensocial, 'Address', Object],
- [opensocial, 'Album', Object],
- [opensocial, 'BodyType', Object],
- [opensocial, 'Container', Object],
- [opensocial, 'Collection', Object],
- [opensocial, 'DataRequest', Object],
- [opensocial, 'DataResponse', Object],
- [opensocial, 'Email', Object],
- [opensocial, 'Enum', Object],
- [opensocial, 'Environment', Object],
- [opensocial, 'IdSpec', Object],
- [opensocial, 'MediaItem', Object],
- [opensocial, 'Message', Object],
- [opensocial, 'Name', Object],
- [opensocial, 'NavigationParameters', Object],
- [opensocial, 'Organization', Object],
- [opensocial, 'Person', Object],
- [opensocial, 'Phone', Object],
- [opensocial, 'ResponseItem', Object],
- [opensocial, 'Url', Object]
+ [window, 'JsonRpcRequestItem', Object],
+ [opensocial, 'Activity', Object],
+ [opensocial, 'Address', Object],
+ [opensocial, 'Album', Object],
+ [opensocial, 'BodyType', Object],
+ [opensocial, 'Container', Object],
+ [opensocial, 'Collection', Object],
+ [opensocial, 'DataRequest', Object],
+ [opensocial, 'DataResponse', Object],
+ [opensocial, 'Email', Object],
+ [opensocial, 'Enum', Object],
+ [opensocial, 'Environment', Object],
+ [opensocial, 'IdSpec', Object],
+ [opensocial, 'MediaItem', Object],
+ [opensocial, 'Message', Object],
+ [opensocial, 'Name', Object],
+ [opensocial, 'NavigationParameters', Object],
+ [opensocial, 'Organization', Object],
+ [opensocial, 'Person', Object],
+ [opensocial, 'Phone', Object],
+ [opensocial, 'ResponseItem', Object],
+ [opensocial, 'Url', Object]
]);
caja___.whitelistMeths([
[opensocial.Activity, 'getField'],
Modified: shindig/trunk/features/src/main/javascript/features/opensocial-reference/url.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/opensocial-reference/url.js?rev=997163&r1=997162&r2=997163&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/opensocial-reference/url.js (original)
+++ shindig/trunk/features/src/main/javascript/features/opensocial-reference/url.js Wed Sep 15 01:39:49 2010
@@ -58,21 +58,21 @@ opensocial.Url.Field = {
*
* @member opensocial.Url.Field
*/
- TYPE : 'type',
+ TYPE: 'type',
/**
* The text of the link. Specified as a String.
*
* @member opensocial.Url.Field
*/
- LINK_TEXT : 'linkText',
+ LINK_TEXT: 'linkText',
/**
* The address the url points to. Specified as a String.
*
* @member opensocial.Url.Field
*/
- ADDRESS : 'address'
+ ADDRESS: 'address'
};
@@ -86,7 +86,7 @@ opensocial.Url.Field = {
* opt_params Additional
* <a href="opensocial.DataRequest.DataRequestFields.html">params</a>
* to pass to the request.
- * @return {string} The data
+ * @return {string} The data.
*/
opensocial.Url.prototype.getField = function(key, opt_params) {
return opensocial.Container.getField(this.fields_, key, opt_params);
Modified: shindig/trunk/features/src/main/javascript/features/opensocial-templates/base.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/opensocial-templates/base.js?rev=997163&r1=997162&r2=997163&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/opensocial-templates/base.js (original)
+++ shindig/trunk/features/src/main/javascript/features/opensocial-templates/base.js Wed Sep 15 01:39:49 2010
@@ -62,37 +62,37 @@ window['log'] = os.log;
* Logs a warning to the console.
*/
os.warn = function(msg) {
- os.log("WARNING: " + msg);
+ os.log('WARNING: ' + msg);
};
/**
- * Is the object an array?
+ * Is the object an array?
*/
os.isArray = function(obj) {
- return typeof(obj) == "object" &&
- typeof(obj.length) == "number" &&
- typeof(obj.push) == "function";
+ return typeof(obj) == 'object' &&
+ typeof(obj.length) == 'number' &&
+ typeof(obj.push) == 'function';
};
/**
* Constants
* TODO(davidbyttow): Pull these out of os and make them global (optimization)
*/
-os.ATT_customtag = "customtag";
+os.ATT_customtag = 'customtag';
-os.VAR_my = "$my";
-os.VAR_cur = "$cur";
-os.VAR_node = "$node";
-os.VAR_msg = "Msg";
-os.VAR_parentnode = "$parentnode";
-os.VAR_uniqueId = "$uniqueId";
-os.VAR_identifierresolver = "$_ir";
-os.VAR_emptyArray = "$_ea";
-os.VAR_callbacks = "$callbacks_";
+os.VAR_my = '$my';
+os.VAR_cur = '$cur';
+os.VAR_node = '$node';
+os.VAR_msg = 'Msg';
+os.VAR_parentnode = '$parentnode';
+os.VAR_uniqueId = '$uniqueId';
+os.VAR_identifierresolver = '$_ir';
+os.VAR_emptyArray = '$_ea';
+os.VAR_callbacks = '$callbacks_';
/**
* Reusable empty array instance
- * IE6 PERF: To avoid creating empty arrays when they are needed.
+ * IE6 PERF: To avoid creating empty arrays when they are needed.
*/
os.EMPTY_ARRAY = [];
@@ -110,11 +110,11 @@ os.regExps_ = {
* @param {Element|TextNode|string} node DOM node containing the template data, or the
* string source.
* @param {string=} opt_id An optional ID for the new template.
- * @return {os.Template} A compiled Template object
+ * @return {os.Template} A compiled Template object.
*/
os.compileTemplate = function(node, opt_id) {
// Allow polymorphic behavior.
- if (typeof(node) == "string") {
+ if (typeof(node) == 'string') {
return os.compileTemplateString(node, opt_id);
}
@@ -134,8 +134,8 @@ os.compileTemplate = function(node, opt_
* Compile a template without requiring a DOM node.
* @param {string} src XML data to be compiled.
* @param {string=} opt_id An optional ID for the new template.
- * @param {Element=} opt_container An optional container DOM Element
- * to look for namespaces
+ * @param {Element=} opt_container An optional container DOM Element
+ * to look for namespaces.
* @return {opensocial.template.Template} A compiled Template object.
*/
os.compileTemplateString = function(src, opt_id, opt_container) {
@@ -146,7 +146,7 @@ os.compileTemplateString = function(src,
/**
* Render one compiled node with a context.
- * @return {Element} a DOM element containing the result of template processing
+ * @return {Element} a DOM element containing the result of template processing.
*/
os.renderTemplateNode_ = function(compiledNode, context) {
var template = domCloneElement(compiledNode);
@@ -181,10 +181,10 @@ os.createTemplateCustomTag = function(te
};
/**
- * Creates a map of the named children of a node. Lower-cased element names
- * (including transformed custom tags) are used as keys.
+ * Creates a map of the named children of a node. Lower-cased element names
+ * (including transformed custom tags) are used as keys.
* Where multiple elements share a name, the map value will be an array.
- * @param {Element} node The node whose children are to be mapped
+ * @param {Element} node The node whose children are to be mapped.
* @return {Object} A Map of Element names to Elements.
*/
os.computeChildMap_ = function(node) {
@@ -194,9 +194,9 @@ os.computeChildMap_ = function(node) {
if (!child.tagName) {
continue;
}
- var name = child.getAttribute(os.ATT_customtag);
+ var name = child.getAttribute(os.ATT_customtag);
if (name) {
- var parts = name.split(":");
+ var parts = name.split(':');
parts.length == 2 ? name = parts[1] : name = parts[0];
} else {
name = child.tagName;
@@ -232,18 +232,18 @@ os.createNodeAccessor_ = function(node)
/**
* A singleton instance of the current gadget Prefs - only instantiated if
* we are in a gadget container.
- * @type gadgets.Prefs
+ * @type {gadgets.Prefs}
*/
os.gadgetPrefs_ = null;
if (window['gadgets'] && window['gadgets']['Prefs']) {
os.gadgetPrefs_ = new window['gadgets']['Prefs']();
-};
+}
/**
* A convenience function to get a localized message by key from the shared
* gadgets.Prefs object.
- * @param {string} key The message key to get
- * @return {string|null} The localized message for a given key, or null if not
+ * @param {string} key The message key to get.
+ * @return {?string} The localized message for a given key, or null if not
* found, or not in the gadgets environment.
*/
os.getPrefMessage = function(key) {
@@ -266,7 +266,7 @@ os.customAttributes_ = {};
* a DOM node, the specified functor will be called.
* @param {string} attrName The name of the custom attribute.
* @param {function(string)} functor A function with signature
- * function({Element}, {string}, {Object}, {JSEvalContext})
+ * function({Element}, {string}, {Object}, {JSEvalContext}).
*/
os.registerAttribute_ = function(attrName, functor) {
os.customAttributes_[attrName] = functor;
@@ -294,37 +294,37 @@ os.doAttribute = function(node, attrName
os.doTag = function(node, ns, tag, data, context) {
var tagFunction = os.getCustomTag(ns, tag);
if (!tagFunction) {
- os.warn("Custom tag <" + ns + ":" + tag + "> not defined.");
+ os.warn('Custom tag <' + ns + ':' + tag + '> not defined.');
return;
}
var ctx = null;
// Process tag's inner content before processing the tag.
- for (var child = node.firstChild; child; child = child.nextSibling) {
+ for (var child = node.firstChild; child; child = child.nextSibling) {
if (child.nodeType == DOM_ELEMENT_NODE) {
- if (ctx == null) {
+ if (ctx == null) {
var selectInner = node[PROP_jstcache] ? node[PROP_jstcache][ATT_innerselect] : null;
if (selectInner) {
var data = context.jsexec(selectInner, node);
ctx = context.clone(data, 0, 0);
} else {
- ctx = context;
+ ctx = context;
}
}
jstProcess(ctx, child);
os.markNodeToSkip(child);
}
- }
-
+ }
+
ctx = context.clone({}, 0, 0);
var result = tagFunction.call(null, node, data, ctx);
- if (!result && typeof(result) != "string") {
- throw Error("Custom tag <" + ns + ":" + tag + "> failed to return anything.");
+ if (!result && typeof(result) != 'string') {
+ throw Error('Custom tag <' + ns + ':' + tag + '> failed to return anything.');
}
- if (typeof(result) == "string") {
- node.innerHTML = result ? result : "";
+ if (typeof(result) == 'string') {
+ node.innerHTML = result ? result : '';
} else if (os.isArray(result)) {
os.removeChildren(node);
for (var i = 0; i < result.length; i++) {
@@ -378,7 +378,7 @@ os.setContextNode_ = function(data, cont
* different context.
*/
os.markNodeToSkip = function(node) {
- node.setAttribute(ATT_skip, "true");
+ node.setAttribute(ATT_skip, 'true');
// Remove the attributes processed when jsskip is true
node.removeAttribute(ATT_select);
Modified: shindig/trunk/features/src/main/javascript/features/opensocial-templates/compiler.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/opensocial-templates/compiler.js?rev=997163&r1=997162&r2=997163&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/opensocial-templates/compiler.js (original)
+++ shindig/trunk/features/src/main/javascript/features/opensocial-templates/compiler.js Wed Sep 15 01:39:49 2010
@@ -96,15 +96,15 @@ os.operatorMap = {
};
/**
- * Shared regular expression to split a string into lexical parts. Quoted
- * strings are treated as tokens, so are identifiers and any characters between
+ * Shared regular expression to split a string into lexical parts. Quoted
+ * strings are treated as tokens, so are identifiers and any characters between
* them.
* In "foo + bar = 'baz - bing'", the tokens are
* ["foo", " + ", "bar", " = ", "'baz - bing'"]
*/
-os.regExps_.SPLIT_INTO_TOKENS =
- /"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|\w+|[^"'\w]+/g;
-
+os.regExps_.SPLIT_INTO_TOKENS =
+ /"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|\w+|[^"'\w]+/g;
+
/**
* Parses operator markup into JS code. See operator map above.
*
@@ -114,9 +114,9 @@ os.regExps_.SPLIT_INTO_TOKENS =
* @param {string} src The string snippet to parse.
*/
os.remapOperators_ = function(src) {
- return src.replace(os.regExps_.SPLIT_INTO_TOKENS,
- function (token) {
- return os.operatorMap.hasOwnProperty(token) ?
+ return src.replace(os.regExps_.SPLIT_INTO_TOKENS,
+ function(token) {
+ return os.operatorMap.hasOwnProperty(token) ?
os.operatorMap[token] : token;
});
};
@@ -142,13 +142,13 @@ os.variableMap_ = {
'Cur': VAR_this,
'$cur': VAR_this,
'Top': VAR_top,
- 'Context': VAR_loop
+ 'Context': VAR_loop
};
/**
* Replace the top level variables
- * @param {string} text The expression
- * @return {string} Expression with replacements
+ * @param {string} text The expression.
+ * @return {string} Expression with replacements.
*/
os.replaceTopLevelVars_ = function(text) {
@@ -161,12 +161,12 @@ os.replaceTopLevelVars_ = function(text)
}
return text.replace(regex,
- function (whole, left, right) {
- if (os.variableMap_.hasOwnProperty(right)) {
- return left + os.variableMap_[right];
- } else {
- return whole;
- }
+ function(whole, left, right) {
+ if (os.variableMap_.hasOwnProperty(right)) {
+ return left + os.variableMap_[right];
+ } else {
+ return whole;
+ }
});
};
@@ -199,8 +199,8 @@ os.setIdentifierResolver = function(reso
*
* TODO: This should not be in compiler.
*
- * @param {JsEvalContext|Object} context Context to get property from
- * @param {string} name Name of the property
+ * @param {JsEvalContext|Object} context Context to get property from.
+ * @param {string} name Name of the property.
* @return {Object|string}
*/
os.getFromContext = function(context, name, opt_default) {
@@ -213,20 +213,20 @@ os.getFromContext = function(context, na
// Is the context payload a DOM node?
if (context.data_.nodeType == DOM_ELEMENT_NODE) {
ret = os.getValueFromNode_(context.data_, name);
- if (ret == null) {
+ if (ret == null) {
// Set to undefined
ret = void(0);
}
} else {
ret = os.identifierResolver_(context.data_, name);
}
- if (typeof(ret) == "undefined") {
+ if (typeof(ret) == 'undefined') {
ret = os.identifierResolver_(context.vars_, name);
}
- if (typeof(ret) == "undefined" && context.vars_[os.VAR_my]) {
+ if (typeof(ret) == 'undefined' && context.vars_[os.VAR_my]) {
ret = os.getValueFromNode_(context.vars_[os.VAR_my], name);
}
- if (typeof(ret) == "undefined" && context.vars_[VAR_top]) {
+ if (typeof(ret) == 'undefined' && context.vars_[VAR_top]) {
ret = context.vars_[VAR_top][name];
}
} else if (context.nodeType == DOM_ELEMENT_NODE) {
@@ -235,17 +235,17 @@ os.getFromContext = function(context, na
} else {
ret = os.identifierResolver_(context, name);
}
- if (typeof(ret) == "undefined" || ret == null) {
- if (typeof(opt_default) != "undefined") {
+ if (typeof(ret) == 'undefined' || ret == null) {
+ if (typeof(opt_default) != 'undefined') {
ret = opt_default;
} else {
- ret = "";
+ ret = '';
}
- } else if (opt_default && os.isArray(opt_default) && !os.isArray(ret) &&
+ } else if (opt_default && os.isArray(opt_default) && !os.isArray(ret) &&
ret.list && os.isArray(ret.list)) {
// If we were trying to get an array, but got a JSON object with an
// array property "list", return that instead.
- ret = ret.list;
+ ret = ret.list;
}
return ret;
};
@@ -282,7 +282,7 @@ os.attributeMap_ = {
os.appendJSTAttribute_ = function(node, attrName, value) {
var previousValue = node.getAttribute(attrName);
if (previousValue) {
- value = previousValue + ";" + value;
+ value = previousValue + ';' + value;
}
node.setAttribute(attrName, value);
};
@@ -320,9 +320,9 @@ os.copyAttributes_ = function(from, to,
"', $this, $context)");
} else if (name == 'repeat') {
os.appendJSTAttribute_(to, ATT_eval,
- "os.setContextNode_($this, $context)");
+ 'os.setContextNode_($this, $context)');
}
- var outName = os.attributeMap_.hasOwnProperty(name) ?
+ var outName = os.attributeMap_.hasOwnProperty(name) ?
os.attributeMap_[name] : name;
var substitution =
(os.attributeMap_[name]) ?
@@ -349,7 +349,7 @@ os.copyAttributes_ = function(from, to,
outName = '.' + outName;
substitution = 'new Function(' + substitution + ')';
} else if (outName == 'selected' && to.tagName == 'OPTION') {
- // For the @selected attribute of an option, set the property
+ // For the @selected attribute of an option, set the property
// instead to allow false values to not mark the option selected.
outName = '.selected';
}
@@ -364,13 +364,13 @@ os.copyAttributes_ = function(from, to,
if (os.attributeMap_.hasOwnProperty(name)) {
// If the attribute value looks like "${expr}", just use the "expr".
if (value.length > 3 &&
- value.substring(0, 2) == '${' &&
- value.charAt(value.length - 1) == '}') {
+ value.substring(0, 2) == '${' &&
+ value.charAt(value.length - 1) == '}') {
value = value.substring(2, value.length - 1);
}
// In special attributes, default value is empty array for repeats,
// null for others
- value = os.transformExpression_(value,
+ value = os.transformExpression_(value,
name == 'repeat' ? os.VAR_emptyArray : 'null');
} else if (outName == 'class') {
// In IE, we must set className instead of class.
@@ -412,37 +412,37 @@ os.compileNode_ = function(node) {
return os.breakTextNode_(textNode);
} else if (node.nodeType == DOM_ELEMENT_NODE) {
var output;
- if (node.tagName.indexOf(":") > 0) {
- if (node.tagName == "os:Repeat") {
+ if (node.tagName.indexOf(':') > 0) {
+ if (node.tagName == 'os:Repeat') {
output = document.createElement(os.computeContainerTag_(node));
- output.setAttribute(ATT_select, os.parseAttribute_(node.getAttribute("expression")));
- var varAttr = node.getAttribute("var");
+ output.setAttribute(ATT_select, os.parseAttribute_(node.getAttribute('expression')));
+ var varAttr = node.getAttribute('var');
if (varAttr) {
os.appendJSTAttribute_(output, ATT_vars, varAttr + ': $this');
}
- var contextAttr = node.getAttribute("context");
+ var contextAttr = node.getAttribute('context');
if (contextAttr) {
os.appendJSTAttribute_(output, ATT_vars, contextAttr + ': ' + VAR_loop);
}
- os.appendJSTAttribute_(output, ATT_eval, "os.setContextNode_($this, $context)");
- } else if (node.tagName == "os:If") {
+ os.appendJSTAttribute_(output, ATT_eval, 'os.setContextNode_($this, $context)');
+ } else if (node.tagName == 'os:If') {
output = document.createElement(os.computeContainerTag_(node));
- output.setAttribute(ATT_display, os.parseAttribute_(node.getAttribute("condition")));
+ output.setAttribute(ATT_display, os.parseAttribute_(node.getAttribute('condition')));
} else {
- output = document.createElement("span");
+ output = document.createElement('span');
output.setAttribute(os.ATT_customtag, node.tagName);
- var custom = node.tagName.split(":");
- os.appendJSTAttribute_(output, ATT_eval, "os.doTag(this, \""
- + custom[0] + "\", \"" + custom[1] + "\", $this, $context)");
- var context = node.getAttribute("cur") || "{}";
+ var custom = node.tagName.split(':');
+ os.appendJSTAttribute_(output, ATT_eval, 'os.doTag(this, \"'
+ + custom[0] + '\", \"' + custom[1] + '\", $this, $context)');
+ var context = node.getAttribute('cur') || '{}';
output.setAttribute(ATT_innerselect, context);
// For os:Render, create a parent node reference.
// TODO: remove legacy support
- if (node.tagName == "os:render" || node.tagName == "os:Render" ||
- node.tagName == "os:renderAll" || node.tagName == "os:RenderAll") {
- os.appendJSTAttribute_(output, ATT_values, os.VAR_parentnode + ":" +
+ if (node.tagName == 'os:render' || node.tagName == 'os:Render' ||
+ node.tagName == 'os:renderAll' || node.tagName == 'os:RenderAll') {
+ os.appendJSTAttribute_(output, ATT_values, os.VAR_parentnode + ':' +
os.VAR_node);
}
@@ -485,13 +485,13 @@ os.compileNode_ = function(node) {
};
/**
- * Calculates the type of element best suited to encapsulating contents of a
- * <os:Repeat> or <os:If> tags. Inspects the element's children to see if one
+ * Calculates the type of element best suited to encapsulating contents of a
+ * <os:Repeat> or <os:If> tags. Inspects the element's children to see if one
* of the special cases should be used.
* "optgroup" for <option>s
* "tbody" for <tr>s
* "span" otherwise
- * @param {Element} element The repeater/conditional element
+ * @param {Element} element The repeater/conditional element.
* @return {stirng} Name of the node ot represent this repeater.
*/
os.computeContainerTag_ = function(element) {
@@ -502,15 +502,15 @@ os.computeContainerTag_ = function(eleme
}
if (child) {
var tag = child.tagName.toLowerCase();
- if (tag == "option") {
- return "optgroup";
+ if (tag == 'option') {
+ return 'optgroup';
}
- if (tag == "tr") {
- return "tbody";
+ if (tag == 'tr') {
+ return 'tbody';
}
}
}
- return "span";
+ return 'span';
};
/**
@@ -518,7 +518,7 @@ os.computeContainerTag_ = function(eleme
*
* TODO(levik): A better way to do this.
*/
-os.ENTITIES = "<!ENTITY nbsp \" \">";
+os.ENTITIES = '<!ENTITY nbsp \" \">';
/**
* Creates an HTML node that's a shallow copy of an XML node
@@ -540,7 +540,7 @@ os.fireCallbacks = function(context) {
if (callback.onAttach) {
callback.onAttach();
// TODO(levik): Remove no-context handlers?
- } else if (typeof(callback) == "function") {
+ } else if (typeof(callback) == 'function') {
callback.apply({});
}
}
@@ -633,7 +633,7 @@ os.breakTextNode_ = function(textNode) {
if (!token) {
token = VAR_this;
}
- var tokenSpan = document.createElement("span");
+ var tokenSpan = document.createElement('span');
tokenSpan.setAttribute(ATT_content, os.transformExpression_(token));
nodes.push(tokenSpan);
match = text.match(substRex);
@@ -647,7 +647,7 @@ os.breakTextNode_ = function(textNode) {
};
/**
- * Transforms a literal string for inclusion into a variable evaluation
+ * Transforms a literal string for inclusion into a variable evaluation
* (a JS string):
* - Escapes single quotes.
* - Replaces newlines with spaces.
@@ -656,7 +656,7 @@ os.breakTextNode_ = function(textNode) {
*/
os.transformLiteral_ = function(string) {
return "'" + string.replace(/'/g, "\\'").
- replace(/\n/g, " ").replace(/;/g, "'+os.SEMICOLON+'") + "'";
+ replace(/\n/g, ' ').replace(/;/g, "'+os.SEMICOLON+'") + "'";
};
/**
@@ -664,7 +664,7 @@ os.transformLiteral_ = function(string)
* "Hello, " + user + "!".
*
* @param {string} value Attribute value to parse
- * TODO: Rename to parseExpression()
+ * TODO: Rename to parseExpression().
*/
os.parseAttribute_ = function(value) {
if (!value.length) {
@@ -686,7 +686,7 @@ os.parseAttribute_ = function(value) {
if (!expr) {
expr = VAR_this;
}
- parts.push('(' +
+ parts.push('(' +
os.transformExpression_(expr) + ')');
text = match[3];
match = text.match(substRex);
@@ -699,41 +699,41 @@ os.parseAttribute_ = function(value) {
};
/**
- * Returns a named value of a given node. First looks for a property, then
+ * Returns a named value of a given node. First looks for a property, then
* attribute, then a child node (or nodes). If multiple child nodes are found,
- * they will be returned in an array. If we find a single Node that is an
+ * they will be returned in an array. If we find a single Node that is an
* Element, it's children will be returned in an array.
- * @param {Element} node The DOM node to inspect
+ * @param {Element} node The DOM node to inspect.
* @param {string} name The name of the property/attribute/child node(s) to get.
- * The special value "*" means return all child Nodes
+ * The special value "*" means return all child Nodes.
* @return {string|Element|Object|Array.<Element>} The value as a String,
* Object, Element or array of Elements.
*/
os.getValueFromNode_ = function(node, name) {
- if (name == "*") {
+ if (name == '*') {
var children = [];
for (var child = node.firstChild; child; child = child.nextSibling) {
children.push(child);
}
return children;
}
-
+
// Since namespaces are not supported, strip off prefix.
if (name.indexOf(':') >= 0) {
name = name.substring(name.indexOf(':') + 1);
}
-
+
var ret = node[name];
- if (typeof(ret) == "undefined" || ret == null) {
+ if (typeof(ret) == 'undefined' || ret == null) {
ret = node.getAttribute(name);
}
-
- if (typeof(ret) != "undefined" && ret != null) {
+
+ if (typeof(ret) != 'undefined' && ret != null) {
// Process special cases where ret would be wrongly evaluated as "true"
- if (ret == "false") {
+ if (ret == 'false') {
ret = false;
- } else if (ret == "0") {
+ } else if (ret == '0') {
ret = 0;
}
return ret;
@@ -773,7 +773,7 @@ os.identifiersNotToWrap_[VAR_loop] = tru
* @param {string} ch Character to check.
* @return {boolean} This character can start an identifier.
*/
-os.canStartIdentifier= function(ch) {
+os.canStartIdentifier = function(ch) {
return (ch >= 'a' && ch <= 'z') ||
(ch >= 'A' && ch <= 'Z') ||
ch == '_' || ch == '$';
@@ -781,7 +781,7 @@ os.canStartIdentifier= function(ch) {
/**
* Checks if a character can be contained in a legal identifier name.
- * (A legal identifier in Templates can contain any character a legal
+ * (A legal identifier in Templates can contain any character a legal
* JS identifier can plus the colon - to support ${My.os:Foo})
* @param {string} ch Character to check.
* @return {string} This is a valid identifier character.
@@ -813,7 +813,7 @@ os.canBeInToken = function(ch) {
* literal string 'null').
*/
os.wrapSingleIdentifier = function(iden, opt_context, opt_default) {
- if (os.identifiersNotToWrap_.hasOwnProperty(iden) &&
+ if (os.identifiersNotToWrap_.hasOwnProperty(iden) &&
(!opt_context || opt_context == VAR_context)) {
return iden;
}
@@ -837,7 +837,7 @@ os.wrapIdentifiersInToken = function(tok
// such cases should be optimized.
if (token.substring(0, os.VAR_msg.length + 1) == (os.VAR_msg + '.') &&
os.gadgetPrefs_) {
- var key = token.split(".")[1];
+ var key = token.split('.')[1];
var msg = os.getPrefMessage(key) || '';
return os.parseAttribute_(msg) || os.transformLiteral_(msg);
}
@@ -858,7 +858,7 @@ os.wrapIdentifiersInToken = function(tok
} else {
buffer.length = 0;
buffer.push(os.wrapSingleIdentifier(parts[0], output));
- for (var j = 1; j < parts.length; j+= 3) {
+ for (var j = 1; j < parts.length; j += 3) {
buffer.push(parts[j]);
if (parts[j + 1]) {
buffer.push(os.wrapIdentifiersInExpression(parts[j + 1]));
@@ -868,7 +868,7 @@ os.wrapIdentifiersInToken = function(tok
output = buffer.join('');
}
}
- return output;
+ return output;
};
/**
@@ -1052,7 +1052,7 @@ os.breakUpParens = function(identifier)
}
} else {
if ((parenstart == '(' && ch == ')') ||
- (parenstart == '[' && ch == ']')) {
+ (parenstart == '[' && ch == ']')) {
parenlevel--;
if (parenlevel == 0) {
parts.push(buffer.join(''));
Modified: shindig/trunk/features/src/main/javascript/features/opensocial-templates/container.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/opensocial-templates/container.js?rev=997163&r1=997162&r2=997163&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/opensocial-templates/container.js (original)
+++ shindig/trunk/features/src/main/javascript/features/opensocial-templates/container.js Wed Sep 15 01:39:49 2010
@@ -75,7 +75,7 @@ os.Container.processed_ = false;
os.Container.disableAutoProcessing = function() {
if (os.Container.processed_) {
- throw Error("Document already processed.");
+ throw Error('Document already processed.');
}
os.Container.autoProcess_ = false;
};
@@ -95,7 +95,7 @@ os.Container.registerDomLoadListener_ =
var gadgets = window['gadgets'];
if (gadgets && gadgets.util) {
gadgets.util.registerOnLoadHandler(os.Container.onDomLoad_);
- } else if (typeof(navigator) != 'undefined' && navigator.product &&
+ } else if (typeof(navigator) != 'undefined' && navigator.product &&
navigator.product == 'Gecko') {
window.addEventListener('DOMContentLoaded', os.Container.onDomLoad_, false);
} if (window.addEventListener) {
@@ -122,7 +122,7 @@ os.Container.onDomLoad_ = function() {
if (os.Container.domLoaded_) {
return;
}
- for (var i = 0; i < os.Container.domLoadCallbacks_.length; i ++) {
+ for (var i = 0; i < os.Container.domLoadCallbacks_.length; i++) {
try {
os.Container.domLoadCallbacks_[i]();
} catch (e) {
@@ -198,7 +198,7 @@ os.Container.compileInlineTemplates = fu
/**
* @return {JsEvalContext} the default rendering context to use - this will
- * contain all available data.
+ * contain all available data.
*/
os.Container.getDefaultContext = function() {
if ((window['gadgets'] && gadgets.util.hasFeature('opensocial-data')) ||
@@ -248,7 +248,7 @@ os.Container.renderInlineTemplates = fun
// This template will render when the specified data is available.
var keys = requiredData.split(/[\, ]+/);
var callback = os.Container.createRenderClosure(template, el);
- if ("true" == node.getAttribute("autoUpdate")) {
+ if ('true' == node.getAttribute('autoUpdate')) {
if (rendered) {
opensocial.data.getDataContext().registerDeferredListener_(keys, callback);
} else {
@@ -274,31 +274,31 @@ os.Container.renderInlineTemplates = fun
* @param {Object=} opt_data Optional data to be used as to create a context.
* @param {Object=} opt_context Optional pre-constructed rendering context.
* @return {Function} The constructed closure.
-* TODO(davidbyttow): Move this into util.js
+* TODO(davidbyttow): Move this into util.js.
*/
os.Container.createRenderClosure = function(template, element, opt_data,
opt_context) {
- var closure = function() {
- var context = opt_context;
- var data = opt_data;
- if (!context) {
- if (data) {
- context = os.createContext(data);
- } else {
- context = os.Container.getDefaultContext();
- data = context.data_;
- }
- }
- template.renderInto(element, data, context);
- };
- return closure;
+ var closure = function() {
+ var context = opt_context;
+ var data = opt_data;
+ if (!context) {
+ if (data) {
+ context = os.createContext(data);
+ } else {
+ context = os.Container.getDefaultContext();
+ data = context.data_;
+ }
+ }
+ template.renderInto(element, data, context);
+ };
+ return closure;
};
/**
* Creates a closure that will hide a DOM element.
* @param {Element} element The DOM element to inject the template into.
* @return {Function} The constructed closure.
- * TODO(davidbyttow): Move this into util.js
+ * TODO(davidbyttow): Move this into util.js.
*/
os.Container.createHideElementClosure = function(element) {
var closure = function() {
@@ -362,27 +362,27 @@ os.Container.processGadget = function()
if (!window['gadgets']) {
return;
}
-
+
// Honor the "disableAutoProcessing" feature param.
- var params = gadgets.util.getFeatureParameters("opensocial-templates");
+ var params = gadgets.util.getFeatureParameters('opensocial-templates');
if (!params) {
return;
}
- if (params.disableAutoProcessing &&
- params.disableAutoProcessing.toLowerCase != "false") {
+ if (params.disableAutoProcessing &&
+ params.disableAutoProcessing.toLowerCase != 'false') {
os.Container.autoProcess_ = false;
}
-
+
// Honor the "requireLibrary" feature param(s).
if (params.requireLibrary) {
- if (typeof params.requireLibrary == "string") {
+ if (typeof params.requireLibrary == 'string') {
os.Container.addRequiredLibrary(params.requireLibrary);
} else {
for (var i = 0; i < params.requireLibrary.length; i++) {
os.Container.addRequiredLibrary(params.requireLibrary[i]);
}
}
- }
+ }
};
//Process the gadget when the page loads.
@@ -397,8 +397,8 @@ os.Container.processWaitingForLibraries_
/**
* Utility method which will automatically register all templates
* and render all that are inline.
- * @param {Object=} opt_data Optional JSON object to render templates against
- * @param {Document=} opt_doc Optional document to use instead of window.document
+ * @param {Object=} opt_data Optional JSON object to render templates against.
+ * @param {Document=} opt_doc Optional document to use instead of window.document.
*/
os.Container.processDocument = function(opt_data, opt_doc) {
if (os.Container.requiredLibraries_ > 0) {
@@ -427,17 +427,17 @@ os.Container.executeOnDomLoad(function()
os.Container.onLibraryLoad_ = function() {
if (os.Container.requiredLibraries_ > 0) {
os.Container.requiredLibraries_--;
- if (os.Container.requiredLibraries_ == 0 &&
+ if (os.Container.requiredLibraries_ == 0 &&
os.Container.processWaitingForLibraries_) {
os.Container.processDocument();
}
- }
+ }
};
/**
* Adds a required library - the processing will be deferred until all
* required libraries have loaded.
- * @param {string} libUrl The URL of the library needed to process this page
+ * @param {string} libUrl The URL of the library needed to process this page.
*/
os.Container.addRequiredLibrary = function(libUrl) {
os.Container.requiredLibraries_++;
@@ -502,7 +502,7 @@ os.Container.registerTagElement_ = funct
if (!nsObj) {
// Auto Create a namespace for lazy registration.
nsObj = os.createNamespace(tagParts[0], null);
- }
+ }
nsObj[tagParts[1]] = os.createTemplateCustomTag(template);
}
}
Modified: shindig/trunk/features/src/main/javascript/features/opensocial-templates/jsTemplate/jsevalcontext.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/opensocial-templates/jsTemplate/jsevalcontext.js?rev=997163&r1=997162&r2=997163&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/opensocial-templates/jsTemplate/jsevalcontext.js (original)
+++ shindig/trunk/features/src/main/javascript/features/opensocial-templates/jsTemplate/jsevalcontext.js Wed Sep 15 01:39:49 2010
@@ -39,7 +39,7 @@ var VAR_loop = '$loop';
/**
* The name of the global variable which holds the value to be returned if
- * context evaluation results in an error.
+ * context evaluation results in an error.
* Use JsEvalContext.setGlobal(GLOB_default, value) to set this.
*/
var GLOB_default = '$default';
@@ -108,7 +108,7 @@ JsEvalContext.prototype.constructor_ = f
/**
* The current context object is assigned to the special variable
* $this so it is possible to use it in expressions.
- * @type Object
+ * @type {Object}
*/
me.vars_[VAR_this] = opt_data;
@@ -129,7 +129,7 @@ JsEvalContext.prototype.constructor_ = f
* above, but for the expression context we replace null and
* undefined by the empty string.
*
- * @type {Object|null}
+ * @type {?Object}
*/
me.data_ = getDefaultObject(opt_data, STRING_empty);
@@ -145,7 +145,7 @@ JsEvalContext.prototype.constructor_ = f
/**
* A map of globally defined symbols. Every instance of JsExprContext
* inherits them in its vars_.
- * @type Object
+ * @type {Object}
*/
JsEvalContext.globals_ = {};
@@ -158,7 +158,7 @@ JsEvalContext.globals_ = {};
* global variables in general apply also here. (Hence the name
* "global", and not "global var".)
* @param {string} name
- * @param {Object|null} value
+ * @param {?Object} value
*/
JsEvalContext.setGlobal = function(name, value) {
JsEvalContext.globals_[name] = value;
@@ -166,8 +166,8 @@ JsEvalContext.setGlobal = function(name,
/**
- * Set the default value to be returned if context evaluation results in an
- * error. (This can occur if a non-existent value was requested).
+ * Set the default value to be returned if context evaluation results in an
+ * error. (This can occur if a non-existent value was requested).
*/
JsEvalContext.setGlobal(GLOB_default, null);
@@ -175,7 +175,7 @@ JsEvalContext.setGlobal(GLOB_default, nu
/**
* A cache to reuse JsEvalContext instances. (IE6 perf)
*
- * @type Array.<JsEvalContext>
+ * @type {Array.<JsEvalContext>}
*/
JsEvalContext.recycledInstances_ = [];
@@ -224,7 +224,7 @@ JsEvalContext.recycle = function(instanc
*
* @param {Element} template DOM node of the template.
*
- * @return {Object|null} The value of the expression from which
+ * @return {?Object} The value of the expression from which
* exprFunction was created in the current js expression context and
* the context of template.
*/
@@ -249,10 +249,10 @@ JsEvalContext.prototype.jsexec = functio
* @param {Object} data The new context object.
*
* @param {number} index Position of the new context when multiply
- * instantiated. (See implementation of jstSelect().)
- *
+ * instantiated. (See implementation of jstSelect().).
+ *
* @param {number} count The total number of contexts that were multiply
- * instantiated. (See implementation of jstSelect().)
+ * instantiated. (See implementation of jstSelect().).
*
* @return {JsEvalContext}
*/
@@ -290,7 +290,7 @@ JsEvalContext.prototype.setVariable = fu
*
* @param {string} name
*
- * @return {?Object} value
+ * @return {?Object} value.
*/
JsEvalContext.prototype.getVariable = function(name) {
return this.vars_[name];
@@ -301,10 +301,10 @@ JsEvalContext.prototype.getVariable = fu
* Evaluates a string expression within the scope of this context
* and returns the result.
*
- * @param {string} expr A javascript expression
- * @param {Element=} opt_template An optional node to serve as "this"
+ * @param {string} expr A javascript expression.
+ * @param {Element=} opt_template An optional node to serve as "this".
*
- * @return {?Object} value
+ * @return {?Object} value.
*/
JsEvalContext.prototype.evalExpression = function(expr, opt_template) {
var exprFunction = jsEvalToFunction(expr);
@@ -322,7 +322,7 @@ var STRING_with = 'with (a_) with (b_) r
/**
* Cache for jsEvalToFunction results.
- * @type Object
+ * @type {Object}
*/
JsEvalContext.evalToFunctionCache_ = {};
@@ -343,7 +343,7 @@ function jsEvalToFunction(expr) {
try {
// NOTE: The Function constructor is faster than eval().
JsEvalContext.evalToFunctionCache_[expr] =
- new Function(STRING_a, STRING_b, STRING_with + expr);
+ new Function(STRING_a, STRING_b, STRING_with + expr);
} catch (e) {
log('jsEvalToFunction (' + expr + ') EXCEPTION ' + e);
}
Modified: shindig/trunk/features/src/main/javascript/features/opensocial-templates/jsTemplate/jstemplate.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/opensocial-templates/jsTemplate/jstemplate.js?rev=997163&r1=997162&r2=997163&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/opensocial-templates/jsTemplate/jstemplate.js (original)
+++ shindig/trunk/features/src/main/javascript/features/opensocial-templates/jsTemplate/jstemplate.js Wed Sep 15 01:39:49 2010
@@ -113,7 +113,7 @@ function jstProcess(context, template, o
/**
* Caches the document of the template node, so we don't have to
* access it through ownerDocument.
- * @type Document
+ * @type {Document}
*/
processor.document_ = ownerDocument(template);
@@ -137,7 +137,7 @@ function JstProcessor() {
/**
* An array of logging messages. These are collected during processing
* and dumped to the console at the end.
- * @type Array.<string>
+ * @type {Array.<string>}
*/
this.logs_ = [];
}
@@ -150,14 +150,14 @@ function JstProcessor() {
* from the jstcache_. The id is stored in an attribute so it
* suvives cloneNode() and thus cloned template nodes can share the
* same cache entry.
- * @type number
+ * @type {number}
*/
JstProcessor.jstid_ = 0;
/**
* Map from jstid to processed js attributes.
- * @type Object
+ * @type {Object}
*/
JstProcessor.jstcache_ = {};
@@ -182,7 +182,7 @@ JstProcessor.jstcache_[0] = {};
* when a cached entry already exists for a given combination of attribute
* values. (For example when two different nodes in a template share the same
* JST attributes.)
- * @type Object
+ * @type {Object}
*/
JstProcessor.jstcacheattributes_ = {};
@@ -190,7 +190,7 @@ JstProcessor.jstcacheattributes_ = {};
/**
* Map for storing temporary attribute values in prepareNode_() so they don't
* have to be retrieved twice. (IE6 perf)
- * @type Object
+ * @type {Object}
*/
JstProcessor.attributeValues_ = {};
@@ -199,7 +199,7 @@ JstProcessor.attributeValues_ = {};
* A list for storing non-empty attributes found on a node in prepareNode_().
* The array is global since it can be reused - this way there is no need to
* construct a new array object for each invocation. (IE6 perf)
- * @type Array
+ * @type {Array}
*/
JstProcessor.attributeList_ = [];
@@ -222,18 +222,18 @@ JstProcessor.prepareTemplate_ = function
* A list of attributes we use to specify jst processing instructions,
* and the functions used to parse their values.
*
- * @type Array.<Array>
+ * @type {Array.<Array>}
*/
var JST_ATTRIBUTES = [
- [ ATT_select, jsEvalToFunction ],
- [ ATT_display, jsEvalToFunction ],
- [ ATT_values, jsEvalToValues ],
- [ ATT_vars, jsEvalToValues ],
- [ ATT_eval, jsEvalToExpressions ],
- [ ATT_transclude, jsEvalToSelf ],
- [ ATT_content, jsEvalToFunction ],
- [ ATT_skip, jsEvalToFunction ],
- [ ATT_innerselect, jsEvalToFunction ]
+ [ATT_select, jsEvalToFunction],
+ [ATT_display, jsEvalToFunction],
+ [ATT_values, jsEvalToValues],
+ [ATT_vars, jsEvalToValues],
+ [ATT_eval, jsEvalToExpressions],
+ [ATT_transclude, jsEvalToSelf],
+ [ATT_content, jsEvalToFunction],
+ [ATT_skip, jsEvalToFunction],
+ [ATT_innerselect, jsEvalToFunction]
];
@@ -277,7 +277,7 @@ JstProcessor.prepareNode_ = function(nod
var value = domGetAttribute(node, name);
attributeValues[name] = value;
if (value != null) {
- attributeList.push(name + "=" + value);
+ attributeList.push(name + '=' + value);
}
}
@@ -351,7 +351,7 @@ JstProcessor.prototype.run_ = function(f
*
* The outer array is a stack of such queues.
*
- * @type Array.<Array>
+ * @type {Array.<Array>}
*/
var calls = me.calls_ = [];
@@ -360,13 +360,13 @@ JstProcessor.prototype.run_ = function(f
* be to maintain the queues in reverse order (popping off of the
* end) but the repeated calls to .pop() consumed 90% of this
* function's execution time.
- * @type Array.<number>
+ * @type {Array.<number>}
*/
var queueIndices = me.queueIndices_ = [];
/**
* A pool of empty arrays. Minimizes object allocation for IE6's benefit.
- * @type Array.<Array>
+ * @type {Array.<Array>}
*/
var arrayPool = me.arrayPool_ = [];
@@ -400,7 +400,7 @@ JstProcessor.prototype.run_ = function(f
* This method takes ownership of the given array!
*
* @param {Array} args Array of method calls structured as
- * [ method, arg1, arg2, method, arg1, arg2, ... ]
+ * [ method, arg1, arg2, method, arg1, arg2, ... ].
*/
JstProcessor.prototype.push_ = function(args) {
this.calls_.push(args);
@@ -410,7 +410,7 @@ JstProcessor.prototype.push_ = function(
/**
* Enable/disable debugging.
- * @param {boolean} debugging New state
+ * @param {boolean} debugging New state.
*/
JstProcessor.prototype.setDebugging = function(debugging) {
if (MAPS_DEBUG) {
@@ -572,7 +572,7 @@ JstProcessor.prototype.jstProcessInner_
if (c.nodeType == DOM_ELEMENT_NODE) {
// Construct a new context if needed, lazily.
if (!ctx) {
- ctx = context;
+ ctx = context;
var selectInner = jstAttributes[ATT_innerselect];
if (selectInner && selectInner != VAR_this) {
ctx = context.clone(context.jsexec(selectInner, template), 0, 0);
@@ -621,7 +621,7 @@ JstProcessor.prototype.jstSelect_ = func
instance = parseInt10(instance.substr(1));
instanceLast = true;
} else {
- instance = parseInt10(/** @type string */(instance));
+ instance = parseInt10(/** @type {string} */(instance));
}
}
@@ -671,12 +671,12 @@ JstProcessor.prototype.jstSelect_ = func
var node = domCloneNode(template);
domInsertBefore(node, template);
- jstSetInstance(/** @type Element */(node), value, i);
+ jstSetInstance(/** @type {Element} */(node), value, i);
clone = context.clone(value[i], i, count);
queue.push(me.jstProcessInner_, clone, node,
JsEvalContext.recycle, clone, null);
-
+
}
// Push the originally present template instance last to keep
// the order aligned with the DOM order, because the newly
@@ -734,7 +734,7 @@ JstProcessor.prototype.jstSelect_ = func
JstProcessor.prototype.jstVars_ = function(context, template, values) {
for (var i = 0, I = jsLength(values); i < I; i += 2) {
var label = values[i];
- var value = context.jsexec(values[i+1], template);
+ var value = context.jsexec(values[i + 1], template);
context.setVariable(label, value);
}
};
@@ -762,7 +762,7 @@ JstProcessor.prototype.jstVars_ = functi
JstProcessor.prototype.jstValues_ = function(context, template, values) {
for (var i = 0, I = jsLength(values); i < I; i += 2) {
var label = values[i];
- var value = context.jsexec(values[i+1], template);
+ var value = context.jsexec(values[i + 1], template);
if (label.charAt(0) == CHAR_dollar) {
// A jsvalues entry whose name starts with $ sets a local
@@ -875,8 +875,8 @@ JstProcessor.prototype.jstAttributes_ =
* @param {Function=} opt_loadHtmlFn A function which, when called, will return
* HTML that contains an element whose ID is 'name'.
*
- * @return {Element|null} The DOM node of the template. (Only element nodes
- * can be found by ID, hence it's a Element.)
+ * @return {?Element} The DOM node of the template. (Only element nodes
+ * can be found by ID, hence it's a Element.).
*/
function jstGetTemplate(name, opt_loadHtmlFn) {
var doc = document;
@@ -905,12 +905,12 @@ function jstGetTemplate(name, opt_loadHt
* HTML that contains an element whose ID is 'name'.
*
* @return {Element} The DOM node of the template. (Only element nodes
- * can be found by ID, hence it's a Element.)
+ * can be found by ID, hence it's a Element.).
*/
function jstGetTemplateOrDie(name, opt_loadHtmlFn) {
var x = jstGetTemplate(name, opt_loadHtmlFn);
//check(x !== null);
- return /** @type Element */(x);
+ return /** @type {Element} */(x);
}
@@ -925,7 +925,7 @@ function jstGetTemplateOrDie(name, opt_l
* @param {string=} opt_target The id of a DOM object under which to attach the
* HTML once it's inserted. An object with this id is created if it does not
* exist.
- * @return {Element} The node whose id is 'name'
+ * @return {Element} The node whose id is 'name'.
*/
function jstLoadTemplateIfNotPresent(doc, name, loadHtmlFn, opt_target) {
var section = domGetElementById(doc, name);
@@ -936,10 +936,10 @@ function jstLoadTemplateIfNotPresent(doc
jstLoadTemplate_(doc, loadHtmlFn(), opt_target || STRING_jsts);
var section = domGetElementById(doc, name);
if (!section) {
- log("Error: jstGetTemplate was provided with opt_loadHtmlFn, " +
+ log('Error: jstGetTemplate was provided with opt_loadHtmlFn, ' +
"but that function did not provide the id '" + name + "'.");
}
- return /** @type Element */(section);
+ return /** @type {Element} */(section);
}
@@ -1016,7 +1016,7 @@ JstProcessor.prototype.logState_ = funct
}
if (jstAttributeValues) {
msg += '<tr><td>' + 'attr:' +
- '</td><td>' + /*jsToSource*/(jstAttributeValues) + '</td></tr>';
+ '</td><td>' + /*jsToSource*/(jstAttributeValues) + '</td></tr>';
}
msg += '</tbody></table><br/>';
this.logs_.push(msg);
Modified: shindig/trunk/features/src/main/javascript/features/opensocial-templates/jsTemplate/util.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/opensocial-templates/jsTemplate/util.js?rev=997163&r1=997162&r2=997163&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/opensocial-templates/jsTemplate/util.js (original)
+++ shindig/trunk/features/src/main/javascript/features/opensocial-templates/jsTemplate/util.js Wed Sep 15 01:39:49 2010
@@ -51,7 +51,7 @@ var TYPE_undefined = 'undefined';
* code and returns null if the eval throws an exception.
*
* @param {string} expr
- * @return {Object|null}
+ * @return {?Object}
*/
function jsEval(expr) {
try {
@@ -94,11 +94,11 @@ function copyProperties(to, from) {
* @param {Object|null|undefined} value The possible value to use.
* @param {Object} defaultValue The default if the value is not set.
* @return {Object} The value, if it is
- * defined and not null; otherwise the default
+ * defined and not null; otherwise the default.
*/
function getDefaultObject(value, defaultValue) {
if (typeof value != TYPE_undefined && value != null) {
- return /** @type Object */(value);
+ return /** @type {Object} */(value);
} else {
return defaultValue;
}
@@ -108,7 +108,7 @@ function getDefaultObject(value, default
* Detect if an object looks like an Array.
* Note that instanceof Array is not robust; for example an Array
* created in another iframe fails instanceof Array.
- * @param {Object|null} value Object to interrogate
+ * @param {?Object} value Object to interrogate.
* @return {boolean} Is the object an array?
*/
function isArray(value) {
@@ -163,12 +163,12 @@ function arrayClear(array) {
/**
- * Prebinds "this" within the given method to an object, but ignores all
+ * Prebinds "this" within the given method to an object, but ignores all
* arguments passed to the resulting function.
* I.e. var_args are all the arguments that method is invoked with when
* invoking the bound function.
*
- * @param {Object|null} object The object that the method call targets.
+ * @param {?Object} object The object that the method call targets.
* @param {Function} method The target method.
* @return {Function} Method with the target object bound to it and curried by
* the provided arguments.
@@ -224,11 +224,11 @@ function DomTraverser(callback) {
*/
DomTraverser.prototype.run = function(root) {
var me = this;
- me.queue_ = [ root ];
+ me.queue_ = [root];
while (jsLength(me.queue_)) {
me.process_(me.queue_.shift());
}
-}
+};
/**
* Processes a single node.
@@ -244,14 +244,14 @@ DomTraverser.prototype.process_ = functi
me.queue_.push(c);
}
}
-}
+};
/**
* Get an attribute from the DOM. Simple redirect, exists to compress code.
*
* @param {Element} node Element to interrogate.
* @param {string} name Name of parameter to extract.
- * @return {string|null} Resulting attribute.
+ * @return {?string} Resulting attribute.
*/
function domGetAttribute(node, name) {
return node.getAttribute(name);
@@ -313,13 +313,13 @@ function domCloneElement(element) {
* itself.
*
* @param {Node|null|undefined} node The node whose ownerDocument is required.
- * @returns {Document} The owner document or window.document if unsupported.
+ * @return {Document} The owner document or window.document if unsupported.
*/
function ownerDocument(node) {
if (!node) {
return document;
} else if (node.nodeType == DOM_DOCUMENT_NODE) {
- return /** @type Document */(node);
+ return /** @type {Document} */(node);
} else {
return node.ownerDocument || document;
}
@@ -442,7 +442,7 @@ function stringTrim(str) {
* @return {string} Trimmed string.
*/
function stringTrimLeft(str) {
- return str.replace(/^\s+/, "");
+ return str.replace(/^\s+/, '');
}
/**
@@ -454,5 +454,5 @@ function stringTrimLeft(str) {
* @return {string} Trimmed string.
*/
function stringTrimRight(str) {
- return str.replace(/\s+$/, "");
+ return str.replace(/\s+$/, '');
}
Modified: shindig/trunk/features/src/main/javascript/features/opensocial-templates/loader.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/opensocial-templates/loader.js?rev=997163&r1=997162&r2=997163&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/opensocial-templates/loader.js (original)
+++ shindig/trunk/features/src/main/javascript/features/opensocial-templates/loader.js Wed Sep 15 01:39:49 2010
@@ -63,7 +63,7 @@ os.Loader.loadedUrls_ = {};
* @param {Function} callback Function to call once loaded.
*/
os.Loader.loadUrl = function(url, callback) {
- if (typeof(window['gadgets']) != "undefined") {
+ if (typeof(window['gadgets']) != 'undefined') {
os.Loader.requestUrlGadgets_(url, callback);
} else {
os.Loader.requestUrlXHR_(url, callback);
@@ -87,12 +87,12 @@ os.Loader.requestUrlXHR_ = function(url,
shindig.xhrwrapper &&
shindig.xhrwrapper.createXHR) {
req = shindig.xhrwrapper.createXHR();
- } else if (typeof XMLHttpRequest != "undefined") {
+ } else if (typeof XMLHttpRequest != 'undefined') {
req = new XMLHttpRequest();
} else {
- req = new ActiveXObject("MSXML2.XMLHTTP");
+ req = new ActiveXObject('MSXML2.XMLHTTP');
}
- req.open("GET", url, true);
+ req.open('GET', url, true);
req.onreadystatechange = function() {
if (req.readyState == 4) {
os.Loader.loadContent(req.responseText, url);
@@ -154,7 +154,7 @@ os.Loader.loadContent = function(xmlStri
/**
* Gets the function that should be used for processing a tag.
* @param {string} tagName Name of the tag.
- * @return {Function|null} The function for processing such tags.
+ * @return {?Function} The function for processing such tags.
*/
os.Loader.getProcessorFunction_ = function(tagName) {
// TODO(levik): This won't work once compiler does name mangling.
@@ -179,8 +179,8 @@ os.Loader.processTemplatesNode = functio
* Processes the <Namespace> node.
*/
os.Loader.processNamespaceNode = function(node) {
- var prefix = node.getAttribute("prefix");
- var url = node.getAttribute("url");
+ var prefix = node.getAttribute('prefix');
+ var url = node.getAttribute('url');
os.createNamespace(prefix, url);
};
@@ -188,8 +188,8 @@ os.Loader.processNamespaceNode = functio
* Processes the <TemplateDef> node
*/
os.Loader.processTemplateDefNode = function(node) {
- var tag = node.getAttribute("tag");
- var name = node.getAttribute("name");
+ var tag = node.getAttribute('tag');
+ var name = node.getAttribute('name');
for (var child = node.firstChild; child; child = child.nextSibling) {
if (child.nodeType == DOM_ELEMENT_NODE) {
// TODO(levik): This won't work once compiler does name mangling.
@@ -205,17 +205,17 @@ os.Loader.processTemplateDefNode = funct
* Processes the <Template> node
*/
os.Loader.processTemplateNode = function(node, opt_tag, opt_name) {
- var tag = opt_tag || node.getAttribute("tag");
- var name = opt_name || node.getAttribute("name");
+ var tag = opt_tag || node.getAttribute('tag');
+ var name = opt_name || node.getAttribute('name');
if (tag) {
- var tagParts = tag.split(":");
+ var tagParts = tag.split(':');
if (tagParts.length != 2) {
- throw Error("Invalid tag name: " + tag);
+ throw Error('Invalid tag name: ' + tag);
}
var nsObj = os.getNamespace(tagParts[0]);
if (!nsObj) {
- throw Error("Namespace not registered: " + tagParts[0] +
- " while trying to define " + tag);
+ throw Error('Namespace not registered: ' + tagParts[0] +
+ ' while trying to define ' + tag);
}
var template = os.compileXMLNode(node);
nsObj[tagParts[1]] = os.createTemplateCustomTag(template);
@@ -273,25 +273,25 @@ os.Loader.injectJavaScript = function(js
os.Loader.injectStyle = function(cssCode) {
var sheet;
if (document.styleSheets.length == 0) {
- document.getElementsByTagName("head")[0].appendChild(
- document.createElement("style"));
+ document.getElementsByTagName('head')[0].appendChild(
+ document.createElement('style'));
}
sheet = document.styleSheets[0];
- var rules = cssCode.split("}");
+ var rules = cssCode.split('}');
for (var i = 0; i < rules.length; i++) {
- var rule = rules[i].replace(/\n/g, "").replace(/\s+/g, " ");
+ var rule = rules[i].replace(/\n/g, '').replace(/\s+/g, ' ');
try {
if (rule.length > 2) {
if (sheet.insertRule) {
- rule = rule + "}";
- sheet.insertRule(rule, sheet.cssRules.length);
+ rule = rule + '}';
+ sheet.insertRule(rule, sheet.cssRules.length);
} else {
- var ruleParts = rule.split("{");
+ var ruleParts = rule.split('{');
sheet.addRule(ruleParts[0], ruleParts[1]);
}
}
} catch (err) {
- gadgets.error("Error in stylesheet: " + rule + " - " + e.name + " - " + e.message);
+ gadgets.error('Error in stylesheet: ' + rule + ' - ' + e.name + ' - ' + e.message);
}
}
};
Modified: shindig/trunk/features/src/main/javascript/features/opensocial-templates/namespaces.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/opensocial-templates/namespaces.js?rev=997163&r1=997162&r2=997163&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/opensocial-templates/namespaces.js (original)
+++ shindig/trunk/features/src/main/javascript/features/opensocial-templates/namespaces.js Wed Sep 15 01:39:49 2010
@@ -58,11 +58,11 @@ os.createNamespace = function(ns, url) {
tags = {};
os.nsmap_[ns] = tags;
opensocial.xmlutil.NSMAP[ns] = url;
- } else if (opensocial.xmlutil.NSMAP[ns] == null ) {
+ } else if (opensocial.xmlutil.NSMAP[ns] == null) {
// Lazily register an auto-created namespace.
opensocial.xmlutil.NSMAP[ns] = url;
} else if (opensocial.xmlutil.NSMAP[ns] != url) {
- throw("Namespace " + ns + " already defined with url " +
+ throw ('Namespace ' + ns + ' already defined with url ' +
opensocial.xmlutil.NSMAP[ns]);
}
return tags;
@@ -99,4 +99,4 @@ os.getCustomTag = function(ns, tag) {
} else {
return nsObj[tag];
}
-};
\ No newline at end of file
+};
Modified: shindig/trunk/features/src/main/javascript/features/opensocial-templates/os.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/opensocial-templates/os.js?rev=997163&r1=997162&r2=997163&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/opensocial-templates/os.js (original)
+++ shindig/trunk/features/src/main/javascript/features/opensocial-templates/os.js Wed Sep 15 01:39:49 2010
@@ -25,8 +25,8 @@
* Define 'os:Render' and 'os:Html' tags and the @onAttach attribute
*/
os.defineBuiltinTags = function() {
- var osn = os.getNamespace("os") ||
- os.createNamespace("os", "http://ns.opensocial.org/2008/markup");
+ var osn = os.getNamespace('os') ||
+ os.createNamespace('os', 'http://ns.opensocial.org/2008/markup');
/**
* <os:Render> custom tag renders the specified child nodes of the current
@@ -34,11 +34,11 @@ os.defineBuiltinTags = function() {
*/
osn.Render = function(node, data, context) {
var parent = context.getVariable(os.VAR_parentnode);
- var exp = node.getAttribute("content") || "*";
+ var exp = node.getAttribute('content') || '*';
var result = os.getValueFromNode_(parent, exp);
if (!result) {
- return "";
- } else if (typeof(result) == "string") {
+ return '';
+ } else if (typeof(result) == 'string') {
var textNode = document.createTextNode(result);
result = [];
result.push(textNode);
@@ -48,7 +48,7 @@ os.defineBuiltinTags = function() {
resultArray.push(result.childNodes[i]);
}
result = resultArray;
- } else if (exp != "*" && result.length == 1 &&
+ } else if (exp != '*' && result.length == 1 &&
result[0].nodeType == DOM_ELEMENT_NODE) {
// When we call <os:renderAll content="tag"/>, render the inner content
// of the tag returned, not the tag itself.
@@ -85,7 +85,7 @@ os.defineBuiltinTags = function() {
* rather than the text of the markup.
*/
osn.Html = function(node) {
- var html = node.code ? "" + node.code : node.getAttribute("code") || "";
+ var html = node.code ? '' + node.code : node.getAttribute('code') || '';
// TODO(levik): Sanitize the HTML here to avoid script injection issues.
// Perhaps use the gadgets sanitizer if available.
return html;
@@ -110,11 +110,11 @@ os.defineBuiltinTags = function() {
var func = new Function(code);
callbacks.push(createClosure(node, func));
}
- os.registerAttribute_("onAttach", processOnAttach);
- os.registerAttribute_("onCreate", processOnAttach);
- os.registerAttribute_("oncreate", processOnAttach);
- os.registerAttribute_("x-oncreate", processOnAttach);
- os.registerAttribute_("x-onCreate", processOnAttach);
+ os.registerAttribute_('onAttach', processOnAttach);
+ os.registerAttribute_('onCreate', processOnAttach);
+ os.registerAttribute_('oncreate', processOnAttach);
+ os.registerAttribute_('x-oncreate', processOnAttach);
+ os.registerAttribute_('x-onCreate', processOnAttach);
};
os.defineBuiltinTags();
@@ -135,7 +135,7 @@ os.defineBuiltinTags();
*/
os.resolveOpenSocialIdentifier = function(object, name) {
// Simple property from object.
- if (typeof(object[name]) != "undefined") {
+ if (typeof(object[name]) != 'undefined') {
return object[name];
}
Modified: shindig/trunk/features/src/main/javascript/features/opensocial-templates/template.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/opensocial-templates/template.js?rev=997163&r1=997162&r2=997163&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/opensocial-templates/template.js (original)
+++ shindig/trunk/features/src/main/javascript/features/opensocial-templates/template.js Wed Sep 15 01:39:49 2010
@@ -54,10 +54,10 @@ os.getContextDefaults_ = function() {
os.contextDefaults_ = {};
os.contextDefaults_[os.VAR_emptyArray] = os.EMPTY_ARRAY;
os.contextDefaults_[os.VAR_identifierresolver] = os.getFromContext;
- if (window["JSON"] && JSON.parse) {
- os.contextDefaults_["osx:parseJson"] = JSON.parse;
- } else if (window["gadgets"] && gadgets.json && gadgets.json.parse) {
- os.contextDefaults_["osx:parseJson"] = gadgets.json.parse;
+ if (window['JSON'] && JSON.parse) {
+ os.contextDefaults_['osx:parseJson'] = JSON.parse;
+ } else if (window['gadgets'] && gadgets.json && gadgets.json.parse) {
+ os.contextDefaults_['osx:parseJson'] = gadgets.json.parse;
}
}
return os.contextDefaults_;
@@ -65,11 +65,11 @@ os.getContextDefaults_ = function() {
/**
* A renderable compiled Template. A template can contain one or more
- * compiled nodes pre-processed for JST operation.
+ * compiled nodes pre-processed for JST operation.
* @constructor
*/
os.Template = function(opt_id) {
- this.templateRoot_ = document.createElement("span");
+ this.templateRoot_ = document.createElement('span');
this.id = opt_id || ('template_' + os.Template.idCounter_++);
};
@@ -83,7 +83,7 @@ os.Template.idCounter_ = 0;
/**
* A Map of registered templates by keyed ID.
* @type {Object.<string, os.Template>}
- * @private
+ * @private
*/
os.registeredTemplates_ = {};
@@ -135,13 +135,13 @@ os.Template.prototype.setCompiledNodes_
/**
* Renders the template and returns the result.
* Does not fire callbacks.
- * @return {Element} a DOM element containing the result of template processing
+ * @return {Element} a DOM element containing the result of template processing.
*/
os.Template.prototype.render = function(opt_data, opt_context) {
if (!opt_context) {
opt_context = os.createContext(opt_data);
}
- return os.renderTemplateNode_(this.templateRoot_, opt_context);
+ return os.renderTemplateNode_(this.templateRoot_, opt_context);
};
/**
Modified: shindig/trunk/features/src/main/javascript/features/opensocial-templates/util.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/opensocial-templates/util.js?rev=997163&r1=997162&r2=997163&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/opensocial-templates/util.js (original)
+++ shindig/trunk/features/src/main/javascript/features/opensocial-templates/util.js Wed Sep 15 01:39:49 2010
@@ -27,12 +27,12 @@
* @return {string} Input with leading and trailing whitespace removed.
*/
os.trim = function(string) {
- return string.replace(/^\s+|\s+$/g, '');
+ return string.replace(/^\s+|\s+$/g, '');
};
/**
- * Checks whether or not a given character is alpha-numeric. *
+ * Checks whether or not a given character is alpha-numeric. *
* @param {string} ch Character to check.
* @return {boolean} This character is alpha-numeric.
*/
@@ -67,7 +67,7 @@ os.appendChildren = function(sourceNode,
};
/**
- * Given a property name (e.g. 'foo') will create a JavaBean-style getter
+ * Given a property name (e.g. 'foo') will create a JavaBean-style getter
* (e.g. 'getFoo').
* @param {string} propertyName Name of the property.
* @return {string} The name of the getter function.