]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
there is no need for this.offsets and this.targets to be jQuery objects
authorMike Greiling <mike@pixelcog.com>
Thu, 29 May 2014 07:24:41 +0000 (02:24 -0500)
committerChris Rebert <code@rebertia.com>
Sun, 8 Jun 2014 01:09:53 +0000 (18:09 -0700)
js/scrollspy.js

index cddde45adaba57de8cff5dc35ba3ffcb196914a2..de4f98707660120c27ee00e19a1efd56b4a31e98 100644 (file)
@@ -24,8 +24,8 @@
     this.selector       = (this.options.target
       || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
       || '') + ' .nav li > a'
-    this.offsets        = $([])
-    this.targets        = $([])
+    this.offsets        = []
+    this.targets        = []
     this.activeTarget   = null
 
     this.refresh()
@@ -41,8 +41,9 @@
   ScrollSpy.prototype.refresh = function () {
     var offsetMethod = this.$element[0] == window ? 'offset' : 'position'
 
-    this.offsets = $([])
-    this.targets = $([])
+    this.offsets = []
+    this.targets = []
+
     var self     = this
 
     this.$body
@@ -75,7 +76,7 @@
     var i
 
     if (scrollTop >= maxScroll) {
-      return activeTarget != (i = targets.last()[0]) && this.activate(i)
+      return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)
     }
 
     if (activeTarget && scrollTop <= offsets[0]) {