Skip to content
Permalink
Browse files

Merge branch 't/11945'

  • Loading branch information...
pjasiun committed Jun 16, 2014
2 parents 5e04106 + 3350a74 commit 6c83319d56b853b09ddc151a72ae635a51a8ce92
Showing with 62 additions and 47 deletions.
  1. +1 −0 CHANGES.md
  2. +35 −17 core/dom/element.js
  3. +0 −22 plugins/forms/plugin.js
  4. +4 −2 tests/core/dom/element/element.html
  5. +22 −6 tests/core/dom/element/element.js
@@ -33,6 +33,7 @@ Fixed Issues:
* [#11910](http://dev.ckeditor.com/ticket/11910): Fixed: [Enhanced Image](http://ckeditor.com/addon/image2) does not consider `config.baseHref` when updating image dimensions.
* [#11753](http://dev.ckeditor.com/ticket/11753): Fixed: Wrong [`checkDirty()`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-checkDirty) value after focusing or blurring widget.
* [#11830](http://dev.ckeditor.com/ticket/11830): Fixed: Impossible to pass some arguments to [CKBuilder](https://github.com/ckeditor/ckbuilder) when using `/dev/builder/build.sh` script.
* [#11945](http://dev.ckeditor.com/ticket/11945): Fixed: Forms plugin should not change core method.

## CKEditor 4.4.1

@@ -982,30 +982,48 @@ CKEDITOR.tools.extend( CKEDITOR.dom.element.prototype, {
* @returns {Boolean} `true` if the specified attribute is defined.
*/
hasAttribute: ( function() {
function standard( name ) {
function ieHasAttribute( name ) {
var $attr = this.$.attributes.getNamedItem( name );

if ( this.getName() == 'input' ) {
switch ( name ) {
case 'class':
return this.$.className.length > 0;
case 'checked':
return !!this.$.checked;
case 'value':
var type = this.getAttribute( 'type' );
return type == 'checkbox' || type == 'radio' ? this.$.value != 'on' : !!this.$.value;
}
}

if ( !$attr )
return false;
else if ( CKEDITOR.env.ie )
return $attr.specified;
else {

return $attr.specified;
}

if ( CKEDITOR.env.ie ) {
if ( CKEDITOR.env.version < 8 ) {
return function( name ) {
// On IE < 8 the name attribute cannot be retrieved
// right after the element creation and setting the
// name with setAttribute.
if ( name == 'name' )
return !!this.$.name;

return ieHasAttribute.call( this, name );
};
} else {
return ieHasAttribute;
}
} else {
return function( name ) {
// On other browsers specified property is deprecated and return always true,
// but fortunately $.attributes contains only specified attributes.
return true;
}
return !!this.$.attributes.getNamedItem( name );
};
}

return ( CKEDITOR.env.ie && CKEDITOR.env.version < 8 ) ?
function( name ) {
// On IE < 8 the name attribute cannot be retrieved
// right after the element creation and setting the
// name with setAttribute.
if ( name == 'name' )
return !!this.$.name;

return standard.call( this, name );
} : standard;
} )(),

/**
@@ -275,25 +275,3 @@ CKEDITOR.plugins.add( 'forms', {
}
}
} );

if ( CKEDITOR.env.ie ) {
CKEDITOR.dom.element.prototype.hasAttribute = CKEDITOR.tools.override( CKEDITOR.dom.element.prototype.hasAttribute, function( original ) {
return function( name ) {
var $attr = this.$.attributes.getNamedItem( name );

if ( this.getName() == 'input' ) {
switch ( name ) {
case 'class':
return this.$.className.length > 0;
case 'checked':
return !!this.$.checked;
case 'value':
var type = this.getAttribute( 'type' );
return type == 'checkbox' || type == 'radio' ? this.$.value != 'on' : !!this.$.value;
}
}

return original.apply( this, arguments );
};
} );
}
@@ -81,8 +81,10 @@
B</div>
<big>Test</big>
<small title="Testing">Test</small>
<input id="inputWithValue" type="text" name="inputName" value="inputValue">
<input id="inputWithNoValue" type="text" name="inputName">
<input id="inputWithAttrs" type="text" class="foo" name="foo" value="bar">
<input id="inputWithoutAttrs" type="text">
<input id="checkboxWithAttrs" type="checkbox" class="foo" name="foo" value="bar" checked>
<input id="checkboxWithoutAttrs" type="checkbox">

<div class="block1 scroll" id="block1"><div class="block2 scroll" id="block2"><div class="block3 scroll" id="block3"><div class="block4 scroll" id="block4"><div id="DocPositionTarget">target</div></div></div></div></div>
<span id="invisible1" class="invisible1">This is an invisible element</span>
@@ -494,15 +494,31 @@ bender.test( appendDomObjectTests(
assert.isFalse( td.hasAttribute( 'rowspan' ), 'rowspan' );
},

// Test for IE BUG: value attribute is never specified even if it exists.
test_hasAttribute_value : function() {
var inputWithValue = newElement( document.getElementById( 'inputWithValue' ) ),
inputWithNoValue = newElement( document.getElementById( 'inputWithNoValue' ) );
// Test for 2 IE bugs:
// - value attribute is never specified even if it exists.
// - input attributes needs to be checked different way than other attributes.
test_hasAttribute_input : function() {
var inputWithAttrs = newElement( document.getElementById( 'inputWithAttrs' ) ),
inputWithoutAttrs = newElement( document.getElementById( 'inputWithoutAttrs' ) ),
checkboxWithAttrs = newElement( document.getElementById( 'checkboxWithAttrs' ) ),
checkboxWithoutAttrs = newElement( document.getElementById( 'checkboxWithoutAttrs' ) );

assert.isTrue( inputWithValue.hasAttribute( 'value' ), 'inputWithValue' );
assert.isFalse( inputWithNoValue.hasAttribute( 'value' ), 'inputWithNoValue' );
assert.isTrue( inputWithAttrs.hasAttribute( 'value' ), 'inputWithValue value' );
assert.isTrue( inputWithAttrs.hasAttribute( 'class' ), 'inputWithValue class' );

assert.isFalse( inputWithoutAttrs.hasAttribute( 'value' ), 'inputWithNoValue value' );
assert.isFalse( inputWithoutAttrs.hasAttribute( 'class' ), 'inputWithNoValue class' );

assert.isTrue( checkboxWithAttrs.hasAttribute( 'value' ), 'checkboxWithAttrs value' );
assert.isTrue( checkboxWithAttrs.hasAttribute( 'class' ), 'checkboxWithAttrs class' );
assert.isTrue( checkboxWithAttrs.hasAttribute( 'checked' ), 'checkboxWithAttrs checked' );

assert.isFalse( checkboxWithoutAttrs.hasAttribute( 'value' ), 'checkboxWithoutAttrs value' );
assert.isFalse( checkboxWithoutAttrs.hasAttribute( 'class' ), 'checkboxWithoutAttrs class' );
assert.isFalse( checkboxWithoutAttrs.hasAttribute( 'checked' ), 'checkboxWithoutAttrs checked' );
},


test_getDocumentPosition : function() {
// Assign the page location of the element.
YUI().use( 'dom-screen', 'node', function( Y ) {

0 comments on commit 6c83319

Please sign in to comment.
You can’t perform that action at this time.