/*\r
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.\r
For licensing, see LICENSE.html or http://ckeditor.com/license\r
*/\r
\r
\r
CKEDITOR.plugins.add( 'forms',\r
{\r
+ requires : [ 'dialog' ],\r
init : function( editor )\r
{\r
var lang = editor.lang;\r
\r
if ( name == 'input' )\r
{\r
- var type = element.getAttribute( 'type' );\r
+ switch( element.getAttribute( 'type' ) )\r
+ {\r
+ case 'button' :\r
+ case 'submit' :\r
+ case 'reset' :\r
+ return { button : CKEDITOR.TRISTATE_OFF };\r
\r
- if ( type == 'text' || type == 'password' )\r
- return { textfield : CKEDITOR.TRISTATE_OFF };\r
+ case 'checkbox' :\r
+ return { checkbox : CKEDITOR.TRISTATE_OFF };\r
\r
- if ( type == 'button' || type == 'submit' || type == 'reset' )\r
- return { button : CKEDITOR.TRISTATE_OFF };\r
+ case 'radio' :\r
+ return { radio : CKEDITOR.TRISTATE_OFF };\r
\r
- if ( type == 'checkbox' )\r
- return { checkbox : CKEDITOR.TRISTATE_OFF };\r
+ case 'image' :\r
+ return { imagebutton : CKEDITOR.TRISTATE_OFF };\r
\r
- if ( type == 'radio' )\r
- return { radio : CKEDITOR.TRISTATE_OFF };\r
-\r
- if ( type == 'image' )\r
- return { imagebutton : CKEDITOR.TRISTATE_OFF };\r
+ default :\r
+ return { textfield : CKEDITOR.TRISTATE_OFF };\r
+ }\r
}\r
\r
if ( name == 'img' && element.data( 'cke-real-element-type' ) == 'hiddenfield' )\r
evt.data.dialog = 'hiddenfield';\r
else if ( element.is( 'input' ) )\r
{\r
- var type = element.getAttribute( 'type' );\r
-\r
- switch ( type )\r
+ switch ( element.getAttribute( 'type' ) )\r
{\r
- case 'text' :\r
- case 'password' :\r
- evt.data.dialog = 'textfield';\r
- break;\r
case 'button' :\r
case 'submit' :\r
case 'reset' :\r
case 'image' :\r
evt.data.dialog = 'imagebutton';\r
break;\r
+ default :\r
+ evt.data.dialog = 'textfield';\r
+ break;\r
}\r
}\r
});\r
{\r
var attrs = input.attributes,\r
type = attrs.type;\r
+ // Old IEs don't provide type for Text inputs #5522\r
+ if ( !type )\r
+ attrs.type = 'text';\r
if ( type == 'checkbox' || type == 'radio' )\r
attrs.value == 'on' && delete attrs.value;\r
}\r
\r
if ( CKEDITOR.env.ie )\r
{\r
- CKEDITOR.dom.element.prototype.hasAttribute = function( name )\r
- {\r
- var $attr = this.$.attributes.getNamedItem( name );\r
-\r
- if ( this.getName() == 'input' )\r
+ CKEDITOR.dom.element.prototype.hasAttribute = CKEDITOR.tools.override( CKEDITOR.dom.element.prototype.hasAttribute,\r
+ function( original )\r
{\r
- switch ( name )\r
- {\r
- case 'class' :\r
- return this.$.className.length > 0;\r
- case 'checked' :\r
- return !!this.$.checked;\r
- case 'value' :\r
- var type = this.getAttribute( 'type' );\r
- if ( type == 'checkbox' || type == 'radio' )\r
- return this.$.value != 'on';\r
- break;\r
- default:\r
- }\r
- }\r
+ return function( name )\r
+ {\r
+ var $attr = this.$.attributes.getNamedItem( name );\r
+\r
+ if ( this.getName() == 'input' )\r
+ {\r
+ switch ( name )\r
+ {\r
+ case 'class' :\r
+ return this.$.className.length > 0;\r
+ case 'checked' :\r
+ return !!this.$.checked;\r
+ case 'value' :\r
+ var type = this.getAttribute( 'type' );\r
+ return type == 'checkbox' || type == 'radio' ? this.$.value != 'on' : this.$.value;\r
+ }\r
+ }\r
\r
- return !!( $attr && $attr.specified );\r
- };\r
+ return original.apply( this, arguments );\r
+ };\r
+ });\r
}\r