]> source.dussan.org Git - jquery-ui.git/commitdiff
Core: Move form method into its own module
authorAlexander Schmitz <arschmitz@gmail.com>
Thu, 16 Jul 2015 13:14:58 +0000 (09:14 -0400)
committerAlexander Schmitz <arschmitz@gmail.com>
Sat, 8 Aug 2015 04:29:36 +0000 (00:29 -0400)
Ref #9647

tests/unit/core/core.js
ui/core.js
ui/form-reset-mixin.js
ui/form.js [new file with mode: 0644]

index ac9f28e00a13bb9a1901f7ff6296228f11f829ed..0d25e22d8b50dae37c26b6bed5e75268db0c9375 100644 (file)
@@ -1,7 +1,8 @@
 define( [
        "jquery",
        "lib/common",
-       "ui/core"
+       "ui/core",
+       "ui/form"
 ], function( $, common ) {
 
 module( "core - jQuery extensions" );
index fe627dea66e6905f394591b4d1bdaf4a8628e887..fc91c274220b68463f1791b23411b507284ffcdd 100644 (file)
@@ -24,6 +24,7 @@
                        "./disable-selection",
                        "./escape-selector",
                        "./focusable",
+                       "./form",
                        "./version"
                ], factory );
        } else {
@@ -131,13 +132,6 @@ $.fn.extend( {
                } );
        },
 
-       // Support: IE8 Only
-       // IE8 does not support the form attribute and when it is supplied. It overwrites the form prop
-       // with a string, so we need to find the proper form.
-       form: function() {
-               return typeof this[ 0 ].form === "string" ? this.closest( "form" ) : $( this[ 0 ].form );
-       },
-
        labels: function() {
                var ancestor, selector, id, labels, ancestors;
 
index 423a35538a4a6c0749e718d949758049fc391ec7..21704708e4c11c042e089f297fc5ef7bcbc36a83 100644 (file)
@@ -4,7 +4,7 @@
                // AMD. Register as an anonymous module.
                define( [
                        "jquery",
-                       "ui/core",
+                       "./form",
                        "./version"
                ], factory );
        } else {
diff --git a/ui/form.js b/ui/form.js
new file mode 100644 (file)
index 0000000..cfb4bd2
--- /dev/null
@@ -0,0 +1,20 @@
+( function( factory ) {
+       if ( typeof define === "function" && define.amd ) {
+
+               // AMD. Register as an anonymous module.
+               define( [ "jquery", "./version" ], factory );
+       } else {
+
+               // Browser globals
+               factory( jQuery );
+       }
+} ( function( $ ) {
+
+// Support: IE8 Only
+// IE8 does not support the form attribute and when it is supplied. It overwrites the form prop
+// with a string, so we need to find the proper form.
+return $.fn.form = function() {
+       return typeof this[ 0 ].form === "string" ? this.closest( "form" ) : $( this[ 0 ].form );
+};
+
+} ) );