]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Remove non-namespaced JS events 6313/head
authorJavier Cejudo <javier@javiercejudo.com>
Fri, 20 Feb 2015 14:52:14 +0000 (01:52 +1100)
committerJavier Cejudo <javier@javiercejudo.com>
Fri, 20 Feb 2015 14:52:14 +0000 (01:52 +1100)
16 files changed:
doc/pages/components/abide.html
doc/pages/components/equalizer.html
doc/pages/components/offcanvas.html
doc/pages/components/range_slider.html
doc/pages/components/reveal.html
js/foundation/foundation.abide.js
js/foundation/foundation.alert.js
js/foundation/foundation.clearing.js
js/foundation/foundation.dropdown.js
js/foundation/foundation.equalizer.js
js/foundation/foundation.interchange.js
js/foundation/foundation.offcanvas.js
js/foundation/foundation.reveal.js
js/foundation/foundation.slider.js
js/foundation/foundation.topbar.js
spec/abide/abide.js

index 389edd29eefbc8f046b87af610e45d9cf2a8370f..b3fb69fd413c43981b47db3ffda87e84a6ca8d59 100644 (file)
@@ -83,7 +83,7 @@ If a submit event is fired, a `valid.fndtn.abide` event is triggered when the fo
 
 <div class="panel">
   <p><strong>Deprecation Notice</strong></p>
-  <p>Previous versions of the abide plugin emitted un-namespaced `valid` and `invalid` events, however, these have been replaced by the namespaced `valid.fndtn.abide` and `invalid.fndtn.abide` events. The un-namespaced events will be fully deprecated when Foundation 5.4 is released.</p>
+  <p>Previous versions of the abide plugin emitted un-namespaced `valid` and `invalid` events, however, these have been replaced by the namespaced `valid.fndtn.abide` and `invalid.fndtn.abide` events. The un-namespaced events have been fully deprecated.</p>
 </div>
 
 You can bind to these events and fire your own callback:
index 8ec8cc82f27ea59c78aa856ea576f24335bce268..fb175b1356216a0f5da2615adbeb56e6de7ce395 100644 (file)
@@ -75,13 +75,13 @@ Perhaps you need to create items that are positioned at the bottom of your input
     <ul class="pricing-table" data-equalizer-watch>
       ...
       <li class="cta-button"><a class="button" href="#">Buy Now</a></li>
-    </ul>    
+    </ul>
   </div>
   <div class="large-6 columns">
     <ul class="pricing-table" data-equalizer-watch>
       ...
       <li class="cta-button"><a class="button" href="#">Buy Now</a></li>
-    </ul>    
+    </ul>
   </div>
 </div>
 ```
@@ -97,7 +97,7 @@ Perhaps you need to create items that are positioned at the bottom of your input
       <li class="bullet-item">5GB Storage</li>
       <li class="bullet-item">20 Users</li>
       <li class="cta-button"><a class="button floor" href="#">Buy Now</a></li>
-    </ul>    
+    </ul>
   </div>
   <div class="small-6 columns">
     <ul class="pricing-table" data-equalizer-watch>
@@ -109,7 +109,7 @@ Perhaps you need to create items that are positioned at the bottom of your input
       <li class="bullet-item">SSL Support</li>
       <li class="bullet-item">24/7 Support</li>
       <li class="cta-button"><a class="button" href="#">Buy Now</a></li>
-    </ul>    
+    </ul>
   </div>
 </div>
 
@@ -149,7 +149,7 @@ There are two ways to bind to callbacks in your equalizers.
 
 <div class="panel">
   <p><strong>Deprecation Notice</strong></p>
-  <p>Previous versions of the equalizer plugin emitted un-namespaced `before-height-change` and `after-height-change` events, however, these have been replaced by the namespaced `before-height-change.fndtn.equalizer` and `after-height-change.fndtn.equalizer` events. The un-namespaced events will be fully deprecated when Foundation 5.4 is released.</p>
+  <p>Previous versions of the equalizer plugin emitted un-namespaced `before-height-change` and `after-height-change` events, however, these have been replaced by the namespaced `before-height-change.fndtn.equalizer` and `after-height-change.fndtn.equalizer` events. The un-namespaced events have been fully deprecated.</p>
 </div>
 
 <div class="row">
@@ -194,7 +194,7 @@ If you add new content after the page has been loaded, you will need to reinitia
 
 {{#markdown}}
 ```javascript
-$(document).foundation(); 
+$(document).foundation();
 ```
 {{/markdown}}
 
index 3acbe3f6fab1cb8e4bb3d1bffa3b9ca6d5a7a6ab..d9df9053a44c43512c7e8b9412252af21a284815 100644 (file)
@@ -343,7 +343,7 @@ There are a series of events that you can bind to for triggering callbacks:
 
 <div class="panel">
   <p><strong>Deprecation Notice</strong></p>
-  <p>Previous versions of the off-canvas plugin emitted un-namespaced `open` and `close` events, however, these have been replaced by the namespaced `open.fndtn.offcanvas` and `close.fndtn.offcanvas` events. The un-namespaced events will be fully deprecated when Foundation 5.4 is released.</p>
+  <p>Previous versions of the off-canvas plugin emitted un-namespaced `open` and `close` events, however, these have been replaced by the namespaced `open.fndtn.offcanvas` and `close.fndtn.offcanvas` events. The un-namespaced events have been fully deprecated.</p>
 </div>
 
 ```js
@@ -389,7 +389,7 @@ If you add new content after the page has been loaded, you will need to reinitia
 
 {{#markdown}}
 ```javascript
-$(document).foundation(); 
+$(document).foundation();
 ```
 {{/markdown}}
 
index 33d0f342773e218390a2c5f2197e768105b52bbb..a5335dd6c2563da994e2c2ad67e57dceabbe4f42 100644 (file)
@@ -178,7 +178,7 @@ You can add a border radius to the range slider by adding the `radius` class to
       <span class="range-slider-handle" role="slider" tabindex="0"></span>
       <span class="range-slider-active-segment"></span>
       <input type="hidden">
-    </div> 
+    </div>
     <br><br>
     <div class="range-slider round" data-slider>
       <span class="range-slider-handle" role="slider" tabindex="0"></span>
@@ -266,7 +266,7 @@ There are two ways to bind to callbacks in your sliders.
 
 <div class="panel">
   <p><strong>Deprecation Notice</strong></p>
-  <p>Previous versions of the slider plugin emitted an un-namespaced `change` event, however, this has been replaced by the namespaced `change.fndtn.slider` event. The un-namespaced event will be fully deprecated when Foundation 5.4 is released.</p>
+  <p>Previous versions of the slider plugin emitted an un-namespaced `change` event, however, this has been replaced by the namespaced `change.fndtn.slider` event. The un-namespaced event have been fully deprecated.</p>
 </div>
 
 <div class="row">
@@ -383,7 +383,7 @@ If you add new content after the page has been loaded, you will need to reinitia
 
 {{#markdown}}
 ```javascript
-$(document).foundation(); 
+$(document).foundation();
 ```
 {{/markdown}}
 
index 2612995098af33cd34ceb24128048cade7041363..e14a2b6215c6b17a375661748b5c95f5ccdf3c81 100644 (file)
@@ -99,7 +99,7 @@ There are a series of events that you can bind to for triggering callbacks:
 
 <div class="panel">
   <p><strong>Deprecation Notice</strong></p>
-  <p>Previous versions of the reveal plugin emitted un-namespaced `open`, `opened`, `close` and `closed` events, however, these have been replaced by the namespaced `open.fndtn.reveal`, `opened.fndtn.reveal`, `close.fndtn.reveal` and `closed.fndtn.reveal` events. The un-namespaced events will be fully deprecated when Foundation 5.4 is released.</p>
+  <p>Previous versions of the reveal plugin emitted un-namespaced `open`, `opened`, `close` and `closed` events, however, these have been replaced by the namespaced `open.fndtn.reveal`, `opened.fndtn.reveal`, `close.fndtn.reveal` and `closed.fndtn.reveal` events. The un-namespaced events have been fully deprecated.</p>
 </div>
 
 ```js
@@ -244,7 +244,7 @@ If you add new content after the page has been loaded, you will need to reinitia
 
 {{#markdown}}
 ```javascript
-$(document).foundation(); 
+$(document).foundation();
 ```
 {{/markdown}}
 
index 793a5aec15e04d630c3a8ada96fc53891dbeb48a..bcb7797d60fd338b311a95ddcb2000b9b4d35cc7 100644 (file)
           if (this.settings.focus_on_invalid) {
             els[i].focus();
           }
-          form.trigger('invalid').trigger('invalid.fndtn.abide');
+          form.trigger('invalid.fndtn.abide');
           this.S(els[i]).closest('form').attr(this.invalid_attr, '');
           return false;
         }
       }
 
       if (submit_event || is_ajax) {
-        form.trigger('valid').trigger('valid.fndtn.abide');
+        form.trigger('valid.fndtn.abide');
       }
 
       form.removeAttr(this.invalid_attr);
index 19d6da62641d9cf375fa3316d81f2ff589160b8b..209dcdccf0983de2904db176e8e1a9d12012d7dc 100644 (file)
         if (Modernizr.csstransitions) {
           alertBox.addClass('alert-close');
           alertBox.on('transitionend webkitTransitionEnd oTransitionEnd', function (e) {
-            S(this).trigger('close').trigger('close.fndtn.alert').remove();
+            S(this).trigger('close.fndtn.alert').remove();
             settings.callback();
           });
         } else {
           alertBox.fadeOut(300, function () {
-            S(this).trigger('close').trigger('close.fndtn.alert').remove();
+            S(this).trigger('close.fndtn.alert').remove();
             settings.callback();
           });
         }
index a9ab074f0bf62111be95d5f1826624d63327cfed..a78027eec5e5f83c7b2a887ba1373ea9595c57a6 100644 (file)
         this.go(clearing, 'prev');
       }
       if (e.which === ESC_KEY) {
-        this.S('a.clearing-close').trigger('click').trigger('click.fndtn.clearing');
+        this.S('a.clearing-close').trigger('click.fndtn.clearing');
       }
     },
 
 
       if (target.length) {
         this.S('img', target)
-          .trigger('click', [current, target]).trigger('click.fndtn.clearing', [current, target])
+          .trigger('click.fndtn.clearing', [current, target])
           .trigger('change.fndtn.clearing');
       }
     },
index 86749d0e3fb9dafe6876173f1050d3761593d042..b162a878bc7296e2a33aa1ab03d6a19625bd9202 100644 (file)
             .removeClass(self.settings.active_class)
             .removeData('target');
 
-          self.S(this).trigger('closed').trigger('closed.fndtn.dropdown', [dropdown]);
+          self.S(this).trigger('closed.fndtn.dropdown', [dropdown]);
         }
       });
       dropdown.removeClass('f-open-' + this.attr_name(true));
         .css(dropdown
         .addClass(this.settings.active_class), target);
       dropdown.prev('[' + this.attr_name() + ']').addClass(this.settings.active_class);
-      dropdown.data('target', target.get(0)).trigger('opened').trigger('opened.fndtn.dropdown', [dropdown, target]);
+      dropdown.data('target', target.get(0)).trigger('opened.fndtn.dropdown', [dropdown, target]);
       dropdown.attr('aria-hidden', 'false');
       target.attr('aria-expanded', 'true');
       dropdown.focus();
index 23fff94f16103b6a0d399e02e937d925eb6e82fb..435c1b5ef5d579c3a590fc1ec4d723a1b451a2e3 100644 (file)
@@ -35,7 +35,7 @@
       }
       var firstTopOffset = vals.first().offset().top;
       settings.before_height_change();
-      equalizer.trigger('before-height-change').trigger('before-height-change.fndth.equalizer');
+      equalizer.trigger('before-height-change.fndth.equalizer');
       vals.height('inherit');
       vals.each(function () {
         var el = $(this);
@@ -60,7 +60,7 @@
         vals.css('height', min);
       }
       settings.after_height_change();
-      equalizer.trigger('after-height-change').trigger('after-height-change.fndtn.equalizer');
+      equalizer.trigger('after-height-change.fndtn.equalizer');
     },
 
     reflow : function () {
index 6fee23fe9b36c98725781984a758d0233bead74f..471c538fb7e47682a1bd87d1601d325c0f20b320 100644 (file)
           if (passed) {
             this.settings.directives[passed
               .scenario[1]].call(this, passed.el, passed.scenario[0], (function (passed) {
-                if (arguments[0] instanceof Array) { 
+                if (arguments[0] instanceof Array) {
                   var args = arguments[0];
                 } else {
                   var args = Array.prototype.slice.call(arguments, 0);
         this.object($(this['cached_' + type][i]));
       }
 
-      return $(window).trigger('resize').trigger('resize.fndtn.interchange');
+      return $(window).trigger('resize.fndtn.interchange');
     },
 
     convert_directive : function (directive) {
index ec2707d263805f09fdceda10b30e646c596781a3..f9cc39cf71853375c5a865bfad584750e0f32556 100644 (file)
 
     show : function (class_name, $off_canvas) {
       $off_canvas = $off_canvas || this.get_wrapper();
-      $off_canvas.trigger('open').trigger('open.fndtn.offcanvas');
+      $off_canvas.trigger('open.fndtn.offcanvas');
       $off_canvas.addClass(class_name);
     },
 
     hide : function (class_name, $off_canvas) {
       $off_canvas = $off_canvas || this.get_wrapper();
-      $off_canvas.trigger('close').trigger('close.fndtn.offcanvas');
+      $off_canvas.trigger('close.fndtn.offcanvas');
       $off_canvas.removeClass(class_name);
     },
 
index bbc42ce976c96f606c0a4f320a237f31c43d1146..7509bc8e6ebc1748189bc36f8c3ff74c3676e719 100644 (file)
         modal.attr('tabindex','0').attr('aria-hidden','false');
 
         this.key_up_on(modal);    // PATCH #3: turning on key up capture only when a reveal window is open
-        
+
         // Prevent namespace event from triggering twice
         modal.on('open.fndtn.reveal', function(e) {
           if (e.namespace !== 'fndtn.reveal') return;
 
         this.locked = true;
         this.key_up_off(modal);   // PATCH #3: turning on key up capture only when a reveal window is open
-        modal.trigger('close').trigger('close.fndtn.reveal');
-        
+        modal.trigger('close.fndtn.reveal');
+
         if ((settings.multiple_opened && open_modals.length === 1) || !settings.multiple_opened || modal.length > 1) {
           self.toggle_bg(modal, false);
           self.to_front(modal);
         }
-        
+
         if (settings.multiple_opened) {
           self.hide(modal, settings.css.close, settings);
           self.to_front($($.makeArray(open_modals).reverse()[1]));
               .css(css)
               .animate(end_css, settings.animation_speed, 'linear', function () {
                 context.locked = false;
-                el.trigger('opened').trigger('opened.fndtn.reveal');
+                el.trigger('opened.fndtn.reveal');
               })
               .addClass('open');
           }, settings.animation_speed / 2);
               .css(css)
               .animate(end_css, settings.animation_speed, 'linear', function () {
                 context.locked = false;
-                el.trigger('opened').trigger('opened.fndtn.reveal');
+                el.trigger('opened.fndtn.reveal');
               })
               .addClass('open');
           }, settings.animation_speed / 2);
         }
 
-        return el.css(css).show().css({opacity : 1}).addClass('open').trigger('opened').trigger('opened.fndtn.reveal');
+        return el.css(css).show().css({opacity : 1}).addClass('open').trigger('opened.fndtn.reveal');
       }
 
       var settings = this.settings;
 
       return el.show();
     },
-    
+
     to_back : function(el) {
       el.addClass('toback');
     },
-    
+
     to_front : function(el) {
       el.removeClass('toback');
     },
             return el
               .animate(end_css, settings.animation_speed, 'linear', function () {
                 context.locked = false;
-                el.css(css).trigger('closed').trigger('closed.fndtn.reveal');
+                el.css(css).trigger('closed.fndtn.reveal');
               })
               .removeClass('open');
           }, settings.animation_speed / 2);
             return el
               .animate(end_css, settings.animation_speed, 'linear', function () {
                 context.locked = false;
-                el.css(css).trigger('closed').trigger('closed.fndtn.reveal');
+                el.css(css).trigger('closed.fndtn.reveal');
               })
               .removeClass('open');
           }, settings.animation_speed / 2);
         }
 
-        return el.hide().css(css).removeClass('open').trigger('closed').trigger('closed.fndtn.reveal');
+        return el.hide().css(css).removeClass('open').trigger('closed.fndtn.reveal');
       }
 
       var settings = this.settings;
index 1437286e1d8dce80d59087b5a134c9dfe84e79ac..fce3ab913124e42f14dd680f8049e6e4f293e413 100644 (file)
         $handle.siblings('.range-slider-active-segment').css('width', progress_bar_length + '%');
       }
 
-      $handle_parent.attr(this.attr_name(), value).trigger('change').trigger('change.fndtn.slider');
+      $handle_parent.attr(this.attr_name(), value).trigger('change.fndtn.slider');
 
       $hidden_inputs.val(value);
       if (settings.trigger_input_change) {
index 16664c15c7e3992328d245db1c23c7c92a271747..ff2fa8e9e6cb9b8ea2ad1f011d85e717d56186ae 100644 (file)
@@ -66,7 +66,7 @@
       var smallMatch = matchMedia(Foundation.media_queries.small).matches;
       var medMatch   = matchMedia(Foundation.media_queries.medium).matches;
       var lrgMatch   = matchMedia(Foundation.media_queries.large).matches;
-      
+
        if (sticky && settings.sticky_on === 'all') {
           return true;
        }
@@ -84,7 +84,7 @@
        if (sticky && navigator.userAgent.match(/(iPad|iPhone|iPod)/g)) {
         return true;
        }
-       
+
        return false;
     },
 
 
       S(window).off('.topbar').on('resize.fndtn.topbar', self.throttle(function () {
           self.resize.call(self);
-      }, 50)).trigger('resize').trigger('resize.fndtn.topbar').load(function () {
+      }, 50)).trigger('resize.fndtn.topbar').load(function () {
           // Ensure that the offset is calculated after all of the pages resources have loaded
           S(this).trigger('resize.fndtn.topbar');
       });
index 05564ad4821651a4a5e0faef1716f6aa3187d5ac..ecf290b93a42310d2350ec5d92f7da10a3916078 100644 (file)
@@ -27,10 +27,8 @@ describe('abide:', function() {
     it('should trigger correct events for all required fields', function() {
       $(document).foundation();
 
-      var settings = Foundation.libs.abide.settings;
-
-      spyOnEvent('form', 'invalid');
-      spyOnEvent('form', 'valid');
+      spyOnEvent('form', 'invalid.fndtn.abide');
+      spyOnEvent('form', 'valid.fndtn.abide');
 
       spyOnEvent('input[name="user_name"]', 'invalid');
       spyOnEvent('input[name="user_name"]', 'valid');
@@ -40,11 +38,11 @@ describe('abide:', function() {
 
       $('form').submit();
 
-      expect('valid').not.toHaveBeenTriggeredOn('form');
+      expect('valid.fndtn.abide').not.toHaveBeenTriggeredOn('form');
       expect('valid').not.toHaveBeenTriggeredOn('input[name="user_name"]');
-      expect('valid').not.toHaveBeenTriggeredOn('input[name="user_email"]');      
+      expect('valid').not.toHaveBeenTriggeredOn('input[name="user_email"]');
 
-      expect('invalid').toHaveBeenTriggeredOn('form');
+      expect('invalid.fndtn.abide').toHaveBeenTriggeredOn('form');
       expect('invalid').toHaveBeenTriggeredOn('input[name="user_name"]');
       expect('invalid').toHaveBeenTriggeredOn('input[name="user_email"]');
     });
@@ -67,8 +65,8 @@ describe('abide:', function() {
     it('should pass validation when all fields are filled out correctly', function() {
       $(document).foundation();
 
-      spyOnEvent('form', 'invalid');
-      spyOnEvent('form', 'valid');
+      spyOnEvent('form', 'invalid.fndtn.abide');
+      spyOnEvent('form', 'valid.fndtn.abide');
 
       spyOnEvent('input[name="user_name"]', 'invalid');
       spyOnEvent('input[name="user_name"]', 'valid');
@@ -81,11 +79,11 @@ describe('abide:', function() {
 
       $('form').submit();
 
-      expect('valid').toHaveBeenTriggeredOn('form');
+      expect('valid.fndtn.abide').toHaveBeenTriggeredOn('form');
       expect('valid').toHaveBeenTriggeredOn('input[name="user_name"]');
-      expect('valid').toHaveBeenTriggeredOn('input[name="user_email"]');      
+      expect('valid').toHaveBeenTriggeredOn('input[name="user_email"]');
 
-      expect('invalid').not.toHaveBeenTriggeredOn('form');
+      expect('invalid.fndtn.abide').not.toHaveBeenTriggeredOn('form');
       expect('invalid').not.toHaveBeenTriggeredOn('input[name="user_name"]');
       expect('invalid').not.toHaveBeenTriggeredOn('input[name="user_email"]');
     });
@@ -146,12 +144,12 @@ describe('abide:', function() {
 
       $('input[name="user_password_confirmation"]').val("foobarbaz");
       // now they're equal
-      spyOnEvent('form', 'invalid');
-      spyOnEvent('form', 'valid');
+      spyOnEvent('form', 'invalid.fndtn.abide');
+      spyOnEvent('form', 'valid.fndtn.abide');
 
       $('form').submit();
 
-      expect('valid').toHaveBeenTriggeredOn('form');
+      expect('valid.fndtn.abide').toHaveBeenTriggeredOn('form');
       expect($('input[name="user_password"]')).not.toHaveAttr('data-invalid');
       expect($('input[name="user_password_confirmation"]')).not.toHaveAttr('data-invalid');
     });
@@ -189,12 +187,12 @@ describe('abide:', function() {
 
       // valid now
       $('input[name="user_end_num"]').val("12");
-      spyOnEvent('form', 'invalid');
-      spyOnEvent('form', 'valid');
+      spyOnEvent('form', 'invalid.fndtn.abide');
+      spyOnEvent('form', 'valid.fndtn.abide');
 
       $('form').submit();
 
-      expect('valid').toHaveBeenTriggeredOn('form');
+      expect('valid.fndtn.abide').toHaveBeenTriggeredOn('form');
       expect($('input[name="user_start_num"]')).not.toHaveAttr('data-invalid');
       expect($('input[name="user_end_num"]')).not.toHaveAttr('data-invalid');
     });