Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Vanduynslager <pierre.denis.vanduynslager@gmail.com>2017-03-19 04:24:54 +0300
committerMark Otto <markd.otto@gmail.com>2017-03-19 04:24:54 +0300
commit275821bbb081890ffe232d50d4778eb15bdb1d7b (patch)
tree79d6a99cb89d449f75a26cf401a1dac6913eeda9 /js/src/scrollspy.js
parentf2f2e39a45039658c3ed7a39af834ca8dd802bdc (diff)
HTMLElement.offset* by getBoundingClientRect() (#21788)
* Replace element.offet* by getBoundingClientRect() * Use variable to store BoundingClientRect * Fix cc issue...
Diffstat (limited to 'js/src/scrollspy.js')
-rw-r--r--js/src/scrollspy.js17
1 files changed, 10 insertions, 7 deletions
diff --git a/js/src/scrollspy.js b/js/src/scrollspy.js
index 66b6080c84..15541b8fff 100644
--- a/js/src/scrollspy.js
+++ b/js/src/scrollspy.js
@@ -133,12 +133,15 @@ const ScrollSpy = (($) => {
target = $(targetSelector)[0]
}
- if (target && (target.offsetWidth || target.offsetHeight)) {
- // todo (fat): remove sketch reliance on jQuery position/offset
- return [
- $(target)[offsetMethod]().top + offsetBase,
- targetSelector
- ]
+ if (target) {
+ const targetBCR = target.getBoundingClientRect()
+ if (targetBCR.width || targetBCR.height) {
+ // todo (fat): remove sketch reliance on jQuery position/offset
+ return [
+ $(target)[offsetMethod]().top + offsetBase,
+ targetSelector
+ ]
+ }
}
return null
})
@@ -198,7 +201,7 @@ const ScrollSpy = (($) => {
_getOffsetHeight() {
return this._scrollElement === window ?
- window.innerHeight : this._scrollElement.offsetHeight
+ window.innerHeight : this._scrollElement.getBoundingClientRect().height
}
_process() {