Skip to content

Commit

Permalink
jslint fixes for the RC release.
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.ckeditor.com/CKEditor/trunk@3711 da63caf2-3823-0410-a1e8-d69ccee00dfb
  • Loading branch information
fredck committed Jun 19, 2009
1 parent 503f0f1 commit 7fc172c
Show file tree
Hide file tree
Showing 19 changed files with 74 additions and 61 deletions.
2 changes: 1 addition & 1 deletion _source/core/_bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
hcDetect.appendTo( CKEDITOR.document.getHead() );

// Update CKEDITOR.env.
if ( CKEDITOR.env.hc = ( hcDetect.getComputedStyle( 'background-image' ) == 'none' ) )
if ( ( CKEDITOR.env.hc = ( hcDetect.getComputedStyle( 'background-image' ) == 'none' ) ) )
CKEDITOR.env.cssClass += ' cke_hc';

hcDetect.remove();
Expand Down
10 changes: 6 additions & 4 deletions _source/core/dom/range.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ CKEDITOR.dom.range = function( document ) {
function elementBoundaryEval( node ) {
// Reject any text node unless it's being bookmark.
return node.type != CKEDITOR.NODE_TEXT && node.getName() in CKEDITOR.dtd.$removeEmpty || node.getParent().hasAttribute( '_fck_bookmark' );
};
}

CKEDITOR.dom.range.prototype = {
clone: function() {
Expand Down Expand Up @@ -987,8 +987,10 @@ CKEDITOR.dom.range = function( document ) {
case CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS:

// Enlarging the start boundary.
var walkerRange = new CKEDITOR.dom.range( this.document ),
body = this.document.getBody();
var walkerRange = new CKEDITOR.dom.range( this.document );

body = this.document.getBody();

walkerRange.setStartAt( body, CKEDITOR.POSITION_AFTER_START );
walkerRange.setEnd( this.startContainer, this.startOffset );

Expand Down Expand Up @@ -1034,7 +1036,7 @@ CKEDITOR.dom.range = function( document ) {
walker.guard = ( unit == CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS ) ? tailBrGuard : boundaryGuard;
blockBoundary = null;
// End the range right before the block boundary node.
;

if ( ( enlargeable = walker.lastForward() ) ) {
// It's the body which stop the enlaring if no block boundary found.
blockBoundary = blockBoundary || body;
Expand Down
3 changes: 1 addition & 2 deletions _source/plugins/dialog/plugin.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

/*
/*
Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
Expand Down
4 changes: 2 additions & 2 deletions _source/plugins/domiterator/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ CKEDITOR.plugins.add( 'domiterator' );
range = null;
}

var currentNode = this._.nextNode,
lastNode = this._.lastNode;
var currentNode = this._.nextNode;
lastNode = this._.lastNode;

this._.nextNode = null;
while ( currentNode ) {
Expand Down
1 change: 1 addition & 0 deletions _source/plugins/find/dialogs/find.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
this._.state = this._.overlap[ this._.state ];
}

return null;
},

reset: function() {
Expand Down
4 changes: 2 additions & 2 deletions _source/plugins/htmldataprocessor/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
var defaultDataBlockFilterRules = {
elements: {} };

for ( var i in blockLikeTags )
for ( i in blockLikeTags )
defaultDataBlockFilterRules.elements[ i ] = extendBlockForDisplay;

/**
Expand Down Expand Up @@ -153,7 +153,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
var defaultHtmlBlockFilterRules = {
elements: {} };

for ( var i in blockLikeTags )
for ( i in blockLikeTags )
defaultHtmlBlockFilterRules.elements[ i ] = extendBlockForOutput;

if ( CKEDITOR.env.ie ) {
Expand Down
2 changes: 1 addition & 1 deletion _source/plugins/resize/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ CKEDITOR.plugins.add( 'resize', {
}

var mouseDownFn = CKEDITOR.tools.addFunction( function( $event ) {
if ( container == null )
if ( !container )
container = editor.getResizable();

startSize = { width: container.$.offsetWidth || 0, height: container.$.offsetHeight || 0 };
Expand Down
5 changes: 2 additions & 3 deletions _source/plugins/richcombo/plugin.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

/*
/*
Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
Expand Down Expand Up @@ -235,7 +234,7 @@ CKEDITOR.ui.richCombo = CKEDITOR.tools.createClass({
panel.getBlock( this.id ).onHide = function() {
me._.on = 0;
me.setState( CKEDITOR.TRISTATE_OFF );
}
};

if ( this.init )
this.init();
Expand Down
29 changes: 17 additions & 12 deletions _source/plugins/scayt/dialogs/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ CKEDITOR.dialog.add( 'scaytcheck', function( editor ) {
i;

// Add buttons titles
for ( var i in buttons ) {
for ( i in buttons ) {
var button = buttons[ i ];
doc.getById( button ).setHtml( '<span class="cke_dialog_ui_button">' + captions[ 'button_' + button ] + '</span>' );
}
Expand Down Expand Up @@ -96,7 +96,7 @@ CKEDITOR.dialog.add( 'scaytcheck', function( editor ) {
}

// user dictionary handlers
dic = {};
var dic = {};
dic.dic_create = function( el, dic_name, dic_buttons ) {
// comma separated button's ids include repeats if exists
var all_buttons = dic_buttons[ 0 ] + ',' + dic_buttons[ 1 ];
Expand All @@ -117,7 +117,7 @@ CKEDITOR.dialog.add( 'scaytcheck', function( editor ) {
dic_error_message( err_massage + "( " + ( arg.message || "" ) + ")" );
});

}
};

dic.dic_rename = function( el, dic_name, dic_buttons ) {
//
Expand All @@ -135,9 +135,9 @@ CKEDITOR.dialog.add( 'scaytcheck', function( editor ) {
//console.info( "dic_rename errorback called with args" , arg )
err_massage = err_massage.replace( "%s", arg.dname );
set_dic_name( dic_name );
dic_error_message( err_massage + "( " + ( arg.message || "" ) + " )" )
dic_error_message( err_massage + "( " + ( arg.message || "" ) + " )" );
});
}
};

dic.dic_delete = function( el, dic_name, dic_buttons ) {
var all_buttons = dic_buttons[ 0 ] + ',' + dic_buttons[ 1 ];
Expand All @@ -158,7 +158,8 @@ CKEDITOR.dialog.add( 'scaytcheck', function( editor ) {
err_massage = err_massage.replace( "%s", arg.dname );
dic_error_message( err_massage );
});
}
};

dic.dic_restore = dialog.dic_restore ||
function( el, dic_name, dic_buttons ) {
// try to restore existing dictionary
Expand All @@ -177,9 +178,12 @@ CKEDITOR.dialog.add( 'scaytcheck', function( editor ) {
err_massage = err_massage.replace( "%s", arg.dname );
dic_error_message( err_massage );
});
}
};

// ** bind event listeners
var arr_buttons = ( dic_buttons[ 0 ] + ',' + dic_buttons[ 1 ] ).split( ',' );
var arr_buttons = ( dic_buttons[ 0 ] + ',' + dic_buttons[ 1 ] ).split( ',' ),
l;

for ( i = 0, l = arr_buttons.length; i < l; i += 1 ) {
var dic_button = doc.getById( arr_buttons[ i ] );

Expand All @@ -191,6 +195,8 @@ CKEDITOR.dialog.add( 'scaytcheck', function( editor ) {
}
//apply handler
dic[ this.getId() ].apply( null, [ this, dic_name, dic_buttons ] );

return true;
});
}
};
Expand Down Expand Up @@ -227,8 +233,7 @@ CKEDITOR.dialog.add( 'scaytcheck', function( editor ) {
doc.getById( 'dic_name' ).setValue( "" );
});

dic_success_message( "" )
var dic_flag = 0;
dic_success_message( "" );
};

function dic_error_message( m ) {
Expand All @@ -253,7 +258,7 @@ CKEDITOR.dialog.add( 'scaytcheck', function( editor ) {
sIds = new String( sIds );
var aIds = sIds.split( ',' );
for ( var i = 0, l = aIds.length; i < l; i += 1 ) {
doc.getById( aIds[ i ] ).$.style.display = "none"
doc.getById( aIds[ i ] ).$.style.display = "none";
}
}

Expand Down Expand Up @@ -299,7 +304,7 @@ CKEDITOR.dialog.add( 'scaytcheck', function( editor ) {

// Set up options if any was set.
for ( var oN in this.options ) {
if ( o[ oN ] != this.options[ oN ] && c == 0 ) {
if ( o[ oN ] != this.options[ oN ] && c === 0 ) {
scayt_control.option( this.options );
c++;
}
Expand Down
22 changes: 13 additions & 9 deletions _source/plugins/scayt/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
editor.on( 'contentDom', createInstance );
editor.on( 'contentDomUnload', function() {
// Remove scripts.
var scripts = CKEDITOR.document.getElementsByTag( 'script' );
scaytIdRegex = /^dojoIoScript(\d+)$/i;
scaytSrcRegex = /^https?:\/\/svc\.spellchecker\.net\/spellcheck\/script\/ssrv\.cgi/i;
var scripts = CKEDITOR.document.getElementsByTag( 'script' ),
scaytIdRegex = /^dojoIoScript(\d+)$/i,
scaytSrcRegex = /^https?:\/\/svc\.spellchecker\.net\/spellcheck\/script\/ssrv\.cgi/i;

for ( var i = 0; i < scripts.count(); i++ ) {
var script = scripts.getItem( i ),
id = script.getId(),
Expand Down Expand Up @@ -134,16 +135,16 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
// assign diojo configurable vars
var parseUrl = function( data ) {
var m = data.match( /(.*)[\/\\]([^\/\\]+\.\w+)$/ );
return { path: m[ 1 ], file: m[ 2 ] }
}
return { path: m[ 1 ], file: m[ 2 ] };
};

// compose scayt url
// compose scayt url
var protocol = document.location.protocol;
var baseUrl = "svc.spellchecker.net/spellcheck/lf/scayt/scayt.js";
var scaytUrl = editor.config.scaytParams.srcScayt || ( protocol + "//" + baseUrl );
var scaytConfigBaseUrl = parseUrl( scaytUrl ).path + "/";

djScaytConfig = {
var djScaytConfig = {
baseUrl: scaytConfigBaseUrl,
addOnLoad: [
function()
Expand All @@ -160,6 +161,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
src: scaytUrl
}
}));

return null;
}
};

Expand Down Expand Up @@ -297,7 +300,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
var sLang = scayt_control.getLang(),
_r = {},
items_suggestion = scayt.getSuggestion( word, sLang );
if ( !items_suggestion || !items_suggestion.length || items_suggestion.length == 0 )
if ( !items_suggestion || !items_suggestion.length )
return null;
// Remove unused commands and menuitems
for ( i in moreSuggestions ) {
Expand All @@ -310,7 +313,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
}
moreSuggestions = {}; // Reset items.
mainSuggestions = {};
moreSuggestionsUnable = false;

var moreSuggestionsUnable = false;

for ( var i = 0, l = items_suggestion.length; i < l; i += 1 ) {
var commandName = 'scayt_suggestion_' + items_suggestion[ i ].replace( ' ', '_' );
Expand Down
8 changes: 4 additions & 4 deletions _source/plugins/selection/plugin.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

/*
/*
Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
Expand Down Expand Up @@ -751,8 +750,9 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
for ( var i = 0; i < length; i++ ) {
retval.push( bookmark = ranges[ i ].createBookmark( serializable, true ) );

var serializable = bookmark.serializable,
bookmarkStart = serializable ? this.document.getById( bookmark.startNode ) : bookmark.startNode,
serializable = bookmark.serializable;

var bookmarkStart = serializable ? this.document.getById( bookmark.startNode ) : bookmark.startNode,
bookmarkEnd = serializable ? this.document.getById( bookmark.endNode ) : bookmark.endNode;

// Updating the offset values for rest of ranges which have been mangled(#3256).
Expand Down
2 changes: 1 addition & 1 deletion _source/plugins/styles/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ CKEDITOR.STYLE_OBJECT = 3;
// new range.
if ( boundaryElement ) {
var clonedElement = startNode;
for ( var i = 0;; i++ ) {
for ( i = 0;; i++ ) {
var newElement = startPath.elements[ i ];
if ( newElement.equals( boundaryElement ) )
break;
Expand Down
12 changes: 6 additions & 6 deletions _source/plugins/uicolor/dialogs/uicolor.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ CKEDITOR.dialog.add( 'uicolor', function( editor ) {
picker.setValue( color, true );
// Refresh picker UI.
picker.refresh( 'cke_uicolor_picker' );
};
}

function setNewUiColor( color, force ) {
if ( force || dialog._.contents.tab1.livePeview.getValue() )
editor.setUiColor( color );
// Write new config string into textbox.
dialog._.contents.tab1.configBox.setValue( 'config.uiColor = "#' + picker.get( "hex" ) + '"'
);
};
}

pickerContents = {
id: 'yuiColorPicker',
Expand Down Expand Up @@ -113,7 +113,7 @@ CKEDITOR.dialog.add( 'uicolor', function( editor ) {
[ '' ],
[ 'Light blue', '#9AB8F3' ],
[ 'Sand', '#D2B48C' ],
[ 'Metallic', '#949AAA', ],
[ 'Metallic', '#949AAA' ],
[ 'Purple', '#C2A3C7' ],
[ 'Olive', '#A2C980' ],
[ 'Happy green', '#9BD446' ],
Expand All @@ -130,7 +130,7 @@ CKEDITOR.dialog.add( 'uicolor', function( editor ) {
[ 'Down', '#BCBCA4' ],
[ 'Mark Twain', '#CFE91D' ],
[ 'Specks of dust', '#D1B596' ],
[ 'Lollipop', '#F6CE23' ],
[ 'Lollipop', '#F6CE23' ]
],
onChange: function() {
var color = this.getValue();
Expand Down Expand Up @@ -169,8 +169,8 @@ CKEDITOR.dialog.add( 'uicolor', function( editor ) {
}
}
]
},
]
}
]
}
],
buttons: [ CKEDITOR.dialog.okButton ]
Expand Down
1 change: 1 addition & 0 deletions _source/plugins/uicolor/yui/yui.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*jsl:ignoreall*/
/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
Expand Down
4 changes: 2 additions & 2 deletions _source/plugins/undo/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license

// Create the first image.
editor.fire( 'saveSnapshot' );
}
};
}
});

Expand Down Expand Up @@ -321,7 +321,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
// IE BUG: If I don't set the selection to *somewhere* after setting
// document contents, then IE would create an empty paragraph at the bottom
// the next time the document is modified.
$range = this.editor.document.getBody().$.createTextRange();
var $range = this.editor.document.getBody().$.createTextRange();
$range.collapse( true );
$range.select();
}
Expand Down
4 changes: 2 additions & 2 deletions _source/plugins/wsc/dialogs/tmpFrameset.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
return true ;
}

function tryLoad ()
function tryLoad()
{
opener = window.parent;
var opener = window.parent;

// get access to global parameters
var oParams = window.opener.oldFramesetPageParams ;
Expand Down
Loading

0 comments on commit 7fc172c

Please sign in to comment.