-
-
Notifications
You must be signed in to change notification settings - Fork 79k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tooltip.js: getBoundingClientRect method existence check is unnecessary? #14093
Comments
i feel like that was there for svg elements or something weird |
Might've been due to iOS v3 not supporting it?: thebird/Swipe#71 |
Running Sauce cross-browser test with the existence check removed: |
@cvrebert Sauce timed out, mind rerunning? |
ah yeah that might have been it. feel free to remove if tests pass |
Sauce tests still pass with the check removed (see above). |
Hi, I am the one who introduced this test: see #6737 : there are unrelated discussions in the PR but the point is it won't work with IE8 if you don't have this test. IE8 does have getBoundingClientRect but it's broken, it's just an empty placeholder. It would be better to revert this IMHO. |
...and add the function test I added in openwide-java@b7764d8 . el.getBoundingClientRect is defined but is not a function in IE8. |
So what we really need to do is backtrace to see when the is-a-function test was changed to a simple truthiness test, and why. |
Whatever the root IE8 quirk here is, it's in dire need of being documented on the MDN page (https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect). |
I can assure you the code didn't work in 2.3.0 and we fixed the behavior by adding the test. Calling getBoundingClientRect returned an empty object which didn't contain anything useful. As you can see in zeroclipboard/zeroclipboard@be45735 (it's referenced by @hnrch02 in the PR) , they removed the test BUT they added a workaround as the "method" might return something empty. This was our case and that's why we fixed it like that. Considering the way tooltip was coded at the time, adding the function test was the right thing to do as it triggers the workaround. |
I mentioned why I changed it to a simple truthiness check here: #14090 (comment). It's documented on the MDN page for the |
I've documented the "IE8 |
Okay, I propose we fix this by doing the same thing as ZeroClipboard: #14492 |
sgtm |
Element.getBoundingClientRect()
seems extremely well-supported:https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect#Browser_compatibility
So then, is there a reason that there's a check in
tooltip.js
for whether this method exists?:bootstrap/js/tooltip.js
Line 324 in f9ffb49
To: @fat
X-Ref: #14090
The text was updated successfully, but these errors were encountered: