Procházet zdrojové kódy

add conditional checks for ie11 for code differences

Keyur Shah před 5 roky
rodič
revize
6e8f18e0ca

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
dist/alpine-ie11.js


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
dist/alpine-ie11.js.map


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
dist/alpine.js


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
dist/alpine.js.map


+ 2 - 3
examples/index_ie11.html

@@ -38,7 +38,7 @@
         </thead>
         <tbody>
             <tr>
-                <td>Simple x-if</td>
+                <td>Simple x-if (not working in IE11)</td>
                 <td>
                     <div x-data="{ show: false }">
                         <template x-if="show">
@@ -210,7 +210,6 @@
                     </script>
                 </td>
             </tr>
-
             <tr>
                 <td>Transitions</td>
                 <td>
@@ -249,7 +248,7 @@
             </tr>
 
             <tr>
-                <td>Transitions (with x-if)</td>
+                <td>Transitions (with x-if) (not working in IE11)</td>
                 <td>
                     <div x-data="{ open: false }">
                         <button x-on:click="open= ! open">

+ 5 - 3
src/component.js

@@ -20,9 +20,11 @@ export default class Component {
 
         // For IE11, add our magic properties to the original data for access.
         // Since the polyfill proxy does not allow properties to be added after creation 
-        unobservedData.$el = null 
-        unobservedData.$refs = null 
-        unobservedData.$nextTick = null 
+        if (window.document.documentMode) {
+            unobservedData.$el = null 
+            unobservedData.$refs = null 
+            unobservedData.$nextTick = null 
+        }
 
         // Construct a Proxy-based observable. This will be used to handle reactivity.
         this.$data = this.wrapDataInObservable(unobservedData)

+ 2 - 1
src/directives/model.js

@@ -27,7 +27,8 @@ function generateModelAssignmentFunction(el, modifiers, expression) {
     }
 
     return (event, currentValue) => {
-        if (event instanceof CustomEvent && event.detail) {
+        //check for non IE11. due to an issue where IE11 handles the event as a CustomEvent. The event should be undefined
+        if (event instanceof CustomEvent && !window.document.documentMode) {
             return event.detail
         } else if (el.type === 'checkbox') {
             // If the data we are binding to is an array, toggle it's value inside the array.

Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů