]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Add information about IE 11 compatibility.
authorJohann-S <johann.servoire@gmail.com>
Tue, 19 Feb 2019 13:16:20 +0000 (15:16 +0200)
committerXhmikosR <xhmikosr@gmail.com>
Wed, 20 Feb 2019 20:05:45 +0000 (22:05 +0200)
site/docs/4.3/getting-started/javascript.md

index a509bd4826dfd5681e0cc8db2e9d32c37550a945..ebe3842beae80f543d2301c1ae08d9afb5ba28c3 100644 (file)
@@ -209,3 +209,40 @@ $('#yourTooltip').tooltip({
   }
 })
 {% endhighlight %}
+
+## Compatibility with IE 11
+
+Bootstrap v5 isn't designed to work with Internet Explorer 11, but you can add the following polyfills to make it work:
+
+{% highlight html %}
+<!-- Polyfill.io will load polyfills your browser needs -->
+<script crossorigin="anonymous" src="https://polyfill.io/v3/polyfill.min.js"></script>
+<script>
+  // Fix preventDefault for IE
+  (function () {
+    var workingDefaultPrevented = (function () {
+      var e = document.createEvent('CustomEvent')
+      e.initEvent('Bootstrap', true, true)
+      e.preventDefault()
+      return e.defaultPrevented
+    })()
+
+    if (!workingDefaultPrevented) {
+      var origPreventDefault = Event.prototype.preventDefault
+      Event.prototype.preventDefault = function () {
+        if (!this.cancelable) {
+          return
+        }
+
+        origPreventDefault.call(this)
+        Object.defineProperty(this, 'defaultPrevented', {
+          get: function () {
+            return true
+          },
+          configurable: true
+        })
+      }
+    }
+  })()
+</script>
+{% endhighlight %}