]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
all unit tests passing in ie7
authorJacob Thornton <jacobthornton@gmail.com>
Sat, 28 Jan 2012 09:35:13 +0000 (01:35 -0800)
committerJacob Thornton <jacobthornton@gmail.com>
Sat, 28 Jan 2012 09:35:13 +0000 (01:35 -0800)
js/bootstrap-alert.js
js/bootstrap-carousel.js
js/bootstrap-collapse.js
js/bootstrap-dropdown.js
js/bootstrap-modal.js
js/bootstrap-scrollspy.js
js/bootstrap-tab.js
js/tests/unit/bootstrap-popover.js
js/tests/unit/bootstrap-tab.js
js/tests/unit/bootstrap-transition.js

index 2df64c6e1d6c54ca9ad64b3ca81b08e539fc2876..4a65b135abd0309cfd0ec60bebbf5c35b755d079 100644 (file)
 
   , close: function ( e ) {
       var $this = $(this)
-        , selector = $this.attr('data-target') || $this.attr('href')
-        , $parent = $(selector)
+        , selector = $this.attr('data-target')
+        , $parent
 
+      if (!selector) {
+        selector = $this.attr('href')
+        selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
+      }
+
+      $parent = $(selector)
       $parent.trigger('close')
 
       e && e.preventDefault()
index 47d832c821d2db30c1ba882a8cf3761a7f3472e6..2f47edb8dc82ef1b1245867aecdd675fcf596aca 100644 (file)
 
   $(function () {
     $('body').on('click.carousel.data-api', '[data-slide]', function ( e ) {
-      var $this = $(this)
-        , $target = $($this.attr('data-target') || $this.attr('href'))
+      var $this = $(this), href
+        , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
         , options = !$target.data('modal') && $.extend({}, $target.data(), $this.data())
       $target.carousel(options)
       e.preventDefault()
index e33dadedff737ca9dc5d3eade76b0e9935c3bfe1..ee36840d2a52215c2d0be7b3a268b16fc9296857 100644 (file)
 
   $(function () {
     $('body').on('click.collapse.data-api', '[data-toggle=collapse]', function ( e ) {
-      var $this = $(this)
-        , target = $this.attr('data-target') || e.preventDefault() || $this.attr('href')
+      var $this = $(this), href
+        , target = $this.attr('data-target')
+          || e.preventDefault()
+          || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
         , option = $(target).data('collapse') ? 'toggle' : $this.data()
       $(target).collapse(option)
     })
index 1ae317b44c649a456a5590fc789b418d662da005..38b6e054fcd728c789961a4952cbaca436650659 100644 (file)
 
   , toggle: function ( e ) {
       var $this = $(this)
-        , selector = $this.attr('data-target') || $this.attr('href')
-        , $parent = $(selector)
+        , selector = $this.attr('data-target')
+        , $parent
         , isActive
 
+      if (!selector) {
+        selector = $this.attr('href')
+        selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
+      }
+
+      $parent = $(selector)
       $parent.length || ($parent = $this.parent())
+
       isActive = $parent.hasClass('open')
 
       clearMenus()
@@ -76,7 +83,7 @@
    * =================================== */
 
   $(function () {
-    $(window).on('click.dropdown.data-api', clearMenus)
+    $('html').on('click.dropdown.data-api', clearMenus)
     $('body').on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle)
   })
 
index eea1938d0f85a6634b4939d34a84639bd7418378..91daa8af6711aa9284a6a4844a77c4fab9e61411 100644 (file)
 
   $(function () {
     $('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
-      var $this = $(this)
-        , $target = $($this.attr('data-target') || $this.attr('href'))
+      var $this = $(this), href
+        , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
         , option = $target.data('modal') ? 'toggle' : $.extend({}, $target.data(), $this.data())
 
       e.preventDefault()
index dcb52456e0e4a65298a4f6bc760f9e95e22eb359..e8bd0715c6da1d9c025bc9fd2db9eb7c7ef2ed4d 100644 (file)
   function ScrollSpy( element, options) {
     var process = $.proxy(this.process, this)
       , $element = $(element).is('body') ? $(window) : $(element)
+      , href
     this.options = $.extend({}, $.fn.scrollspy.defaults, options)
     this.$scrollElement = $element.on('scroll.scroll.data-api', process)
     this.selector = (this.options.target
-      || $(element).attr('href')
+      || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
       || '') + ' .nav li > a'
     this.$body = $('body').on('click.scroll.data-api', this.selector, process)
     this.refresh()
index 95698d23e523ed48c96a0cd68e7b49fd2f13a074..f19db5da1e37fa3dab2384c333ef125deebc5776 100644 (file)
   , show: function () {
       var $this = this.element
         , $ul = $this.closest('ul:not(.dropdown-menu)')
-        , href = $this.attr('data-target') || $this.attr('href')
+        , selector = $this.attr('data-target')
         , previous
-        , $href
+        , $target
+
+      if (!selector) {
+        selector = $this.attr('href')
+        selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
+      }
 
       if ( $this.parent('li').hasClass('active') ) return
 
       , relatedTarget: previous
       })
 
-      $href = $(href)
+      $target = $(selector)
 
       this.activate($this.parent('li'), $ul)
-      this.activate($href, $href.parent(), function () {
+      this.activate($target, $target.parent(), function () {
         $this.trigger({
           type: 'shown'
         , relatedTarget: previous
index 462db8b3e1baf77d180e970d6429f9321c77bffe..08cabae42c0c9ae67fe5370eb4dffa28d64f5f51 100644 (file)
@@ -82,7 +82,7 @@ $(function () {
           })
         
         popover.popover('show')
-        console.log(popover)
+
         ok($('.popover').length, 'popover was inserted')
         ok($('.popover').hasClass('foobar'), 'custom class is present')
 
index f326490786251b3c8130beed4b45aa800a7e827f..18f490fa5e454500b1137dc934ddb720c5250e31 100644 (file)
@@ -17,7 +17,6 @@ $(function () {
           + '<li><a href="#profile">Profile</a></li>'
           + '</ul>'
 
-
         $('<ul><li id="home"></li><li id="profile"></li></ul>').appendTo("#qunit-fixture")
 
         $(tabsHTML).find('li:last a').tab('show')
index ff4a0f0c34965c989d914cc5fc226a22811783ca..3f28d2676ddd02d44df11a50b02ba39841d5b807 100644 (file)
@@ -7,7 +7,7 @@ $(function () {
       })
 
       test("should provide an end object", function () {
-        ok($.support.transition.end, 'end string is defined')
+        ok($.support.transition ? $.support.transition.end : true, 'end string is defined')
       })
 
 })
\ No newline at end of file