]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
removing this.$element as it is a superfluous copy of this.$scrollElement
authorMike Greiling <mike@pixelcog.com>
Thu, 29 May 2014 07:36:53 +0000 (02:36 -0500)
committerChris Rebert <code@rebertia.com>
Sun, 8 Jun 2014 01:09:53 +0000 (18:09 -0700)
js/scrollspy.js

index db493d7ed5b9167ccee55149f273b32c5d0be5bb..94171bb1badced1f0fc81fe68fc500d4670f5234 100644 (file)
   function ScrollSpy(element, options) {
     var process  = $.proxy(this.process, this)
 
-    this.$element       = $(element).is('body') ? $(window) : $(element)
     this.$body          = $('body')
-    this.$scrollElement = this.$element.on('scroll.bs.scrollspy', process)
+    this.$scrollElement = $(element).is('body') ? $(window) : $(element)
     this.options        = $.extend({}, ScrollSpy.DEFAULTS, options)
     this.selector       = (this.options.target || '') + ' .nav li > a'
     this.offsets        = []
     this.targets        = []
     this.activeTarget   = null
 
+    this.$scrollElement.on('scroll.bs.scrollspy', process)
     this.refresh()
     this.process()
   }
@@ -36,7 +36,7 @@
   }
 
   ScrollSpy.prototype.refresh = function () {
-    var offsetMethod = this.$element[0] == window ? 'offset' : 'position'
+    var offsetMethod = this.$scrollElement[0] == window ? 'offset' : 'position'
 
     this.offsets = []
     this.targets = []