Permalink
Browse files

Core: Move form method into its own module

Ref #9647
  • Loading branch information...
1 parent 47188b7 commit 64076ecfb5870130d89733ff34668fdd18683f9b @arschmitz arschmitz committed Jul 16, 2015
Showing with 24 additions and 9 deletions.
  1. +2 −1 tests/unit/core/core.js
  2. +1 −7 ui/core.js
  3. +1 −1 ui/form-reset-mixin.js
  4. +20 −0 ui/form.js
@@ -1,7 +1,8 @@
define( [
"jquery",
"lib/common",
- "ui/core"
+ "ui/core",
+ "ui/form"
], function( $, common ) {
module( "core - jQuery extensions" );
View
@@ -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;
@@ -4,7 +4,7 @@
// AMD. Register as an anonymous module.
define( [
"jquery",
- "ui/core",
+ "./form",
"./version"
], factory );
} else {
View
@@ -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 );
+};
+
+} ) );

0 comments on commit 64076ec

Please sign in to comment.