JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.5.1
[ckeditor.git] / _source / plugins / forms / plugin.js
index b66a31d..3be5c3b 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
 For licensing, see LICENSE.html or http://ckeditor.com/license\r
 */\r
 \r
@@ -149,22 +149,25 @@ CKEDITOR.plugins.add( 'forms',
 \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
@@ -187,14 +190,8 @@ CKEDITOR.plugins.add( 'forms',
                                        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
@@ -209,6 +206,9 @@ CKEDITOR.plugins.add( 'forms',
                                                case 'image' :\r
                                                        evt.data.dialog = 'imagebutton';\r
                                                        break;\r
+                                               default :\r
+                                                       evt.data.dialog = 'textfield';\r
+                                                       break;\r
                                        }\r
                                }\r
                        });\r
@@ -231,6 +231,9 @@ CKEDITOR.plugins.add( 'forms',
                                        {\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
@@ -272,10 +275,7 @@ if ( CKEDITOR.env.ie )
                                        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
+                                       return type == 'checkbox' || type == 'radio' ? this.$.value != 'on' : this.$.value;\r
                        }\r
                }\r
 \r