Browse Source

Fix tests

Simone Todaro 5 years ago
parent
commit
9cb7ff61fe
1 changed files with 22 additions and 18 deletions
  1. 22 18
      src/component.js

+ 22 - 18
src/component.js

@@ -19,12 +19,14 @@ export default class Component {
         const unobservedData = saferEval(dataExpression, {})
 
         /* IE11-ONLY:START */
-        // 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
-        /* IE11-ONLY:END */
+        if (window.document.documentMode) {
+            // 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
+            /* IE11-ONLY:END */
+        }
 
         // Construct a Proxy-based observable. This will be used to handle reactivity.
         this.$data = this.wrapDataInObservable(unobservedData)
@@ -332,18 +334,20 @@ export default class Component {
         var refObj = {}
 
         /* IE11-ONLY:START */
-        //add any properties that might be necessary for ie11 proxy
-        refObj.$isRefsProxy = false;
-        refObj.$isAlpineProxy = false;
-
-        // If we are in IE, since the polyfill needs all properties to be defined before building the proxy,
-        // we just loop on the element, look for any x-ref and create a the property on a fake object.
-        // We don't need to put a real value since it will be resolved by the proxy class
-        this.walkAndSkipNestedComponents(self.$el, el => {
-            if (el.hasAttribute('x-ref')) {
-                refObj[el.getAttribute('x-ref')] = true
-            }
-        })
+        if (window.document.documentMode) {
+            //add any properties that might be necessary for ie11 proxy
+            refObj.$isRefsProxy = false;
+            refObj.$isAlpineProxy = false;
+
+            // If we are in IE, since the polyfill needs all properties to be defined before building the proxy,
+            // we just loop on the element, look for any x-ref and create a the property on a fake object.
+            // We don't need to put a real value since it will be resolved by the proxy class
+            this.walkAndSkipNestedComponents(self.$el, el => {
+                if (el.hasAttribute('x-ref')) {
+                    refObj[el.getAttribute('x-ref')] = true
+                }
+            })
+        }
         /* IE11-ONLY:END */