Skip to content

Commit

Permalink
Merge branch 'master' into major
Browse files Browse the repository at this point in the history
Conflicts:
	core/editable.js
	tests/core/tools.js
	tests/plugins/forms/textarea.js
  • Loading branch information
Reinmar committed Dec 3, 2014
2 parents 18d651a + f026965 commit d06d1f5
Show file tree
Hide file tree
Showing 53 changed files with 1,165 additions and 1,105 deletions.
46 changes: 20 additions & 26 deletions .jscsrc
Expand Up @@ -15,8 +15,9 @@
"requireCurlyBraces": [
"switch", "try", "catch"
],
"requireSpaceBeforeKeywords": true,
"requireSpaceAfterKeywords": [
"if", "else", "for", "while", "do", "switch", "return", "try", "catch"
"do", "for", "if", "else", "switch", "case", "try", "catch", "void", "while", "with", "return", "typeof"
],
"requireSpaceBeforeBlockStatements": true,
"requireParenthesesAroundIIFE": true,
Expand All @@ -26,47 +27,40 @@
"afterConsequent": true,
"beforeAlternate": true
},
"requireSpacesInFunctionExpression": {
"requireSpacesInFunction": {
"beforeOpeningCurlyBrace": true
},
"disallowSpacesInFunctionExpression": {
"disallowSpacesInFunction": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInCallExpression": true,
"requireBlocksOnNewline": true,
"requireSpacesInsideObjectBrackets": "all",
"requireSpacesInsideArrayBrackets": "all",
"requireSpacesInsideParentheses": "all",
"disallowSpaceAfterObjectKeys": true,
"requireSpaceBeforeObjectValues": true,
"requireCommaBeforeLineBreak": true,
"requireOperatorBeforeLineBreak": [
"?", "=", "+", "-", "/", "*", "==", "===", "!=", "!==", ">", ">=", "<", "<=", "|", "||", "&", "&&", "^", "+=", "*=",
"-=", "/=", "^="
],
"requireSpaceBeforeBinaryOperators": [
"+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<=", "|", "||", "&", "&&", "^", "+=", "*=", "-=",
"/=", "^="
],
"requireSpaceAfterBinaryOperators": [
"+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<=", "|", "||", "&", "&&", "^", "+=", "*=", "-=",
"/=", "^="
],
"disallowSpaceAfterPrefixUnaryOperators": [
"++", "--", "+", "-", "~", "!"
],
"disallowSpaceBeforePostfixUnaryOperators": [
"++", "--"
],
"requireOperatorBeforeLineBreak": true,
"disallowSpaceAfterPrefixUnaryOperators": true,
"disallowSpaceBeforePostfixUnaryOperators": true,
"requireSpaceBeforeBinaryOperators": true,
"requireSpaceAfterBinaryOperators": true,
"disallowKeywords": [
"with"
],
"disallowMultipleLineStrings": true,
"disallowMixedSpacesAndTabs": true,
"disallowTrailingWhitespace": true,
"maximumLineLength": 200,
"requireDotNotation": true,
"requireDotNotation": true,
"disallowYodaConditions": true,
"disallowNewlineBeforeBlockStatements": true,
"validateLineBreaks": "LF",
"validateQuoteMarks": {
"mark": "'",
"escape": true
},
"validateIndentation": "\t",
"disallowMixedSpacesAndTabs": true,
"disallowTrailingWhitespace": true,
"maximumLineLength": 200,
"disallowYodaConditions": true
"validateIndentation": "\t"
}
3 changes: 1 addition & 2 deletions core/creators/themedui.js
Expand Up @@ -65,8 +65,7 @@ CKEDITOR.replaceClass = 'ckeditor';
* @param {String} [data] Since 3.3. Initial value for the instance.
* @returns {CKEDITOR.editor} The editor instance created.
*/
CKEDITOR.appendTo = function( element, config, data )
{
CKEDITOR.appendTo = function( element, config, data ) {
return createInstance( element, config, data, CKEDITOR.ELEMENT_MODE_APPENDTO );
};

Expand Down
4 changes: 2 additions & 2 deletions core/dom/element.js
Expand Up @@ -1107,8 +1107,8 @@ CKEDITOR.dom.element.clearMarkers = function( database, element, removeFromDatab
}

return function( inlineOnly ) {
if ( !( inlineOnly === false || CKEDITOR.dtd.$removeEmpty[ this.getName() ] || this.is( 'a' ) ) ) // Merge empty links and anchors also. (#5567)
{
// Merge empty links and anchors also. (#5567)
if ( !( inlineOnly === false || CKEDITOR.dtd.$removeEmpty[ this.getName() ] || this.is( 'a' ) ) ) {
return;
}

Expand Down
41 changes: 21 additions & 20 deletions core/dom/range.js
Expand Up @@ -317,8 +317,8 @@ CKEDITOR.dom.range = function( root ) {
clone = levelClone;
}

if ( action == 2 ) // 2 = Clone.
{
// 2 = Clone.
if ( action == 2 ) {
// No changes in the DOM should be done, so fix the split text (if any).

var startTextNode = range.startContainer;
Expand Down Expand Up @@ -754,8 +754,8 @@ CKEDITOR.dom.range = function( root ) {
* @param {Object} bookmark
*/
moveToBookmark: function( bookmark ) {
if ( bookmark.is2 ) // Created with createBookmark2().
{
// Created with createBookmark2().
if ( bookmark.is2 ) {
// Get the start information.
var startContainer = this.document.getByAddress( bookmark.start, bookmark.normalized ),
startOffset = bookmark.startOffset;
Expand All @@ -772,8 +772,9 @@ CKEDITOR.dom.range = function( root ) {
this.setEnd( endContainer, endOffset );
else
this.collapse( true );
} else // Created with createBookmark().
{
}
// Created with createBookmark().
else {
var serializable = bookmark.serializable,
startNode = serializable ? this.document.getById( bookmark.startNode ) : bookmark.startNode,
endNode = serializable ? this.document.getById( bookmark.endNode ) : bookmark.endNode;
Expand Down Expand Up @@ -812,12 +813,13 @@ CKEDITOR.dom.range = function( root ) {

if ( startNode.type == CKEDITOR.NODE_ELEMENT ) {
childCount = startNode.getChildCount();
if ( childCount > startOffset )
if ( childCount > startOffset ) {
startNode = startNode.getChild( startOffset );
else if ( childCount < 1 )
} else if ( childCount < 1 ) {
startNode = startNode.getPreviousSourceNode();
else // startOffset > childCount but childCount is not 0
{
}
// startOffset > childCount but childCount is not 0
else {
// Try to take the node just after the current position.
startNode = startNode.$;
while ( startNode.lastChild )
Expand All @@ -830,14 +832,16 @@ CKEDITOR.dom.range = function( root ) {
startNode = startNode.getNextSourceNode() || startNode;
}
}

if ( endNode.type == CKEDITOR.NODE_ELEMENT ) {
childCount = endNode.getChildCount();
if ( childCount > endOffset )
if ( childCount > endOffset ) {
endNode = endNode.getChild( endOffset ).getPreviousSourceNode( true );
else if ( childCount < 1 )
} else if ( childCount < 1 ) {
endNode = endNode.getPreviousSourceNode();
else // endOffset > childCount but childCount is not 0
{
}
// endOffset > childCount but childCount is not 0.
else {
// Try to take the node just before the current position.
endNode = endNode.$;
while ( endNode.lastChild )
Expand Down Expand Up @@ -2091,8 +2095,7 @@ CKEDITOR.dom.range = function( root ) {
walkerRange.collapse( checkStart );

// Expand the range to element boundary.
walkerRange[ checkStart ? 'setStartAt' : 'setEndAt' ]
( element, checkStart ? CKEDITOR.POSITION_AFTER_START : CKEDITOR.POSITION_BEFORE_END );
walkerRange[ checkStart ? 'setStartAt' : 'setEndAt' ]( element, checkStart ? CKEDITOR.POSITION_AFTER_START : CKEDITOR.POSITION_BEFORE_END );

// Create the walker, which will check if we have anything useful
// in the range.
Expand All @@ -2115,8 +2118,7 @@ CKEDITOR.dom.range = function( root ) {

// [IE] Special handling for range start in text with a leading NBSP,
// we it to be isolated, for bogus check.
if ( CKEDITOR.env.ie && startOffset && startContainer.type == CKEDITOR.NODE_TEXT )
{
if ( CKEDITOR.env.ie && startOffset && startContainer.type == CKEDITOR.NODE_TEXT ) {
var textBefore = CKEDITOR.tools.ltrim( startContainer.substring( 0, startOffset ) );
if ( nbspRegExp.test( textBefore ) )
this.trim( 0, 1 );
Expand Down Expand Up @@ -2155,8 +2157,7 @@ CKEDITOR.dom.range = function( root ) {

// [IE] Special handling for range end in text with a following NBSP,
// we it to be isolated, for bogus check.
if ( CKEDITOR.env.ie && endContainer.type == CKEDITOR.NODE_TEXT )
{
if ( CKEDITOR.env.ie && endContainer.type == CKEDITOR.NODE_TEXT ) {
var textAfter = CKEDITOR.tools.rtrim( endContainer.substring( endOffset ) );
if ( nbspRegExp.test( textAfter ) )
this.trim( 1, 0 );
Expand Down
10 changes: 3 additions & 7 deletions core/dom/text.js
Expand Up @@ -97,18 +97,14 @@ CKEDITOR.tools.extend( CKEDITOR.dom.text.prototype, {
var doc = this.getDocument();
var retval = new CKEDITOR.dom.text( this.$.splitText( offset ), doc );

if ( parent.childNodes.length == count )
{
if ( parent.childNodes.length == count ) {
// If the offset is after the last char, IE creates the text node
// on split, but don't include it into the DOM. So, we have to do
// that manually here.
if ( offset >= length )
{
if ( offset >= length ) {
retval = doc.createText( '' );
retval.insertAfter( this );
}
else
{
} else {
// IE BUG: IE8+ does not update the childNodes array in DOM after splitText(),
// we need to make some DOM changes to make it update. (#3436)
var workaround = doc.createText( '' );
Expand Down
8 changes: 4 additions & 4 deletions core/editable.js
Expand Up @@ -1911,8 +1911,8 @@
// This means that caret is between these nodes.
startPath.contains( previousNode ) && // Elements path of start of selection has
endPath.contains( nextNode ) && // to contain prevNode and vice versa.
nextNode.isIdentical( previousNode ) ) // Check if elements are identical.
{
nextNode.isIdentical( previousNode ) // Check if elements are identical.
) {
// Merge blocks and repeat.
nextNode.moveChildren( previousNode );
nextNode.remove();
Expand Down Expand Up @@ -1978,8 +1978,8 @@
if ( dataWrapper.getChildCount() == 1 && // Only one node bein inserted.
checkIfElement( block = dataWrapper.getFirst() ) && // And it's an element.
block.is( stripSingleBlockTags ) && // That's <p> or <div> or header.
!block.hasAttribute( 'contenteditable' ) ) // It's not a non-editable block or nested editable.
{
!block.hasAttribute( 'contenteditable' ) // It's not a non-editable block or nested editable.
) {
// Check children not containing block.
children = block.getElementsByTag( '*' );
for ( var i = 0, child, count = children.count(); i < count; i++ ) {
Expand Down
2 changes: 1 addition & 1 deletion core/loader.js
Expand Up @@ -145,7 +145,7 @@ if ( !CKEDITOR.loader ) {
// We must guarantee the execution order of the scripts, so we
// need to load them one by one. (#4145)
// The following if/else block has been taken from the scriptloader core code.
if ( typeof( script.onreadystatechange ) !== 'undefined' ) {
if ( typeof script.onreadystatechange !== 'undefined' ) {
/** @ignore */
script.onreadystatechange = function() {
if ( script.readyState == 'loaded' || script.readyState == 'complete' ) {
Expand Down
6 changes: 3 additions & 3 deletions core/tools.js
Expand Up @@ -126,7 +126,7 @@
}

// "Static" types.
if ( obj === null || ( typeof( obj ) != 'object' ) || ( obj instanceof String ) || ( obj instanceof Number ) || ( obj instanceof Boolean ) || ( obj instanceof Date ) || ( obj instanceof RegExp ) )
if ( obj === null || ( typeof obj != 'object' ) || ( obj instanceof String ) || ( obj instanceof Number ) || ( obj instanceof Boolean ) || ( obj instanceof Date ) || ( obj instanceof RegExp ) )
return obj;

// DOM objects and window.
Expand Down Expand Up @@ -188,9 +188,9 @@
var argsLength = arguments.length,
overwrite, propertiesList;

if ( typeof( overwrite = arguments[ argsLength - 1 ] ) == 'boolean' )
if ( typeof ( overwrite = arguments[ argsLength - 1 ] ) == 'boolean' )
argsLength--;
else if ( typeof( overwrite = arguments[ argsLength - 2 ] ) == 'boolean' ) {
else if ( typeof ( overwrite = arguments[ argsLength - 2 ] ) == 'boolean' ) {
propertiesList = arguments[ argsLength - 1 ];
argsLength -= 2;
}
Expand Down
4 changes: 2 additions & 2 deletions plugins/a11yhelp/plugin.js
Expand Up @@ -16,9 +16,9 @@
requires: 'dialog',

// List of available localizations.
// jscs:disable maximumLineLength
// jscs:disable
availableLangs: { af:1,ar:1,bg:1,ca:1,cs:1,cy:1,da:1,de:1,el:1,en:1,'en-gb':1,eo:1,es:1,et:1,fa:1,fi:1,fr:1,'fr-ca':1,gl:1,gu:1,he:1,hi:1,hr:1,hu:1,id:1,it:1,ja:1,km:1,ko:1,ku:1,lt:1,lv:1,mk:1,mn:1,nb:1,nl:1,no:1,pl:1,pt:1,'pt-br':1,ro:1,ru:1,si:1,sk:1,sl:1,sq:1,sr:1,'sr-latn':1,sv:1,th:1,tr:1,tt:1,ug:1,uk:1,vi:1,zh:1,'zh-cn':1 },
// jscs:enable maximumLineLength
// jscs:enable

init: function( editor ) {
var plugin = this;
Expand Down
18 changes: 9 additions & 9 deletions plugins/dialog/plugin.js
Expand Up @@ -351,7 +351,7 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3;
iterContents( function( item ) {
if ( item.validate ) {
var retval = item.validate( this ),
invalid = typeof( retval ) == 'string' || retval === false;
invalid = ( typeof retval == 'string' ) || retval === false;

if ( invalid ) {
evt.data.hide = false;
Expand Down Expand Up @@ -1087,7 +1087,7 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3;
enabledFields++;

contentMap[ cursor.id ] = cursor;
if ( typeof( cursor.getChild ) == 'function' )
if ( typeof cursor.getChild == 'function' )
children.push.apply( children, cursor.getChild() );
}

Expand Down Expand Up @@ -2324,23 +2324,23 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3;
( this._ || ( this._ = {} ) ).dialog = dialog;

// Override isChanged if it is defined in element definition.
if ( typeof( elementDefinition.isChanged ) == 'boolean' )
if ( typeof elementDefinition.isChanged == 'boolean' )
this.isChanged = function() {
return elementDefinition.isChanged;
};
if ( typeof( elementDefinition.isChanged ) == 'function' )
if ( typeof elementDefinition.isChanged == 'function' )
this.isChanged = elementDefinition.isChanged;

// Overload 'get(set)Value' on definition.
if ( typeof( elementDefinition.setValue ) == 'function' ) {
if ( typeof elementDefinition.setValue == 'function' ) {
this.setValue = CKEDITOR.tools.override( this.setValue, function( org ) {
return function( val ) {
org.call( this, elementDefinition.setValue.call( this, val ) );
};
} );
}

if ( typeof( elementDefinition.getValue ) == 'function' ) {
if ( typeof elementDefinition.getValue == 'function' ) {
this.getValue = CKEDITOR.tools.override( this.getValue, function( org ) {
return function() {
return elementDefinition.getValue.call( this, org.call( this ) );
Expand Down Expand Up @@ -2930,18 +2930,18 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3;
i;

for ( i = 0; i < args.length; i++ ) {
if ( typeof( args[ i ] ) == 'function' )
if ( typeof args[ i ] == 'function' )
functions.push( args[ i ] );
else
break;
}

if ( i < args.length && typeof( args[ i ] ) == 'string' ) {
if ( i < args.length && typeof args[ i ] == 'string' ) {
msg = args[ i ];
i++;
}

if ( i < args.length && typeof( args[ i ] ) == 'number' )
if ( i < args.length && typeof args[ i ] == 'number' )
relation = args[ i ];

var passed = ( relation == CKEDITOR.VALIDATE_AND ? true : false );
Expand Down
7 changes: 1 addition & 6 deletions plugins/dialogui/plugin.js
Expand Up @@ -653,7 +653,6 @@ CKEDITOR.plugins.add( 'dialogui', {
var innerHTML = function() {
_.frameId = CKEDITOR.tools.getNextId() + '_fileInput';

// jscs:disable validateIndentation
var html = [
'<iframe' +
' frameborder="0"' +
Expand All @@ -676,9 +675,7 @@ CKEDITOR.plugins.add( 'dialogui', {
'0'
);

html.push( ')">' +
'</iframe>' );
// jscs:enable validateIndentation
html.push( ')"></iframe>' );

return html.join( '' );
};
Expand Down Expand Up @@ -1331,7 +1328,6 @@ CKEDITOR.plugins.add( 'dialogui', {

var inputId = _.frameId + '_input';

// jscs:disable validateIndentation
frameDocument.$.write( [
'<html dir="' + langDir + '" lang="' + langCode + '"><head><title></title></head><body style="margin: 0; overflow: hidden; background: transparent;">',
'<form enctype="multipart/form-data" method="POST" dir="' + langDir + '" lang="' + langCode + '" action="',
Expand All @@ -1357,7 +1353,6 @@ CKEDITOR.plugins.add( 'dialogui', {
'window.onbeforeunload = function() {window.parent.CKEDITOR.tools.callFunction(' + unloadNumber + ')}',
'</script>'
].join( '' ) );
// jscs:enable validateIndentation

frameDocument.$.close();

Expand Down

0 comments on commit d06d1f5

Please sign in to comment.