1
0
Эх сурвалжийг харах

Fix "Invalid invocation" error when referencing $refs

Caleb Porzio 5 жил өмнө
parent
commit
486a37261a

+ 1 - 1
README.md

@@ -12,7 +12,7 @@ Think of it like [Tailwind](https://tailwindcss.com/) for JavaScript.
 
 
 **From CDN:** Add the following script to the end of your `<head>` section.
 **From CDN:** Add the following script to the end of your `<head>` section.
 ```html
 ```html
-<script src="https://cdn.jsdelivr.net/gh/alpinejs/alpine@v1.3.0/dist/alpine.js" defer></script>
+<script src="https://cdn.jsdelivr.net/gh/alpinejs/alpine@v1.3.1/dist/alpine.js" defer></script>
 ```
 ```
 
 
 That's it. It will initialize itself.
 That's it. It will initialize itself.

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist/alpine.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist/alpine.js.map


+ 1 - 1
package.json

@@ -1,7 +1,7 @@
 {
 {
   "main": "dist/alpine.js",
   "main": "dist/alpine.js",
   "name": "alpinejs",
   "name": "alpinejs",
-  "version": "1.3.0",
+  "version": "1.3.1",
   "repository": {
   "repository": {
     "type": "git",
     "type": "git",
     "url": "git://github.com/alpinejs/alpine.git"
     "url": "git://github.com/alpinejs/alpine.git"

+ 7 - 0
src/component.js

@@ -41,6 +41,11 @@ export default class Component {
                 return setWasSuccessful
                 return setWasSuccessful
             },
             },
             get(target, key) {
             get(target, key) {
+                if (key === 'isProxy') return true
+
+                // If the property we are trying to get is a proxy, just return it.
+                if (target[key] && target[key].isProxy) return target[key]
+
                 if (typeof target[key] === 'object' && target[key] !== null) {
                 if (typeof target[key] === 'object' && target[key] !== null) {
                     const propertyName = keyPrefix ? `${keyPrefix}.${key}` : key
                     const propertyName = keyPrefix ? `${keyPrefix}.${key}` : key
 
 
@@ -421,6 +426,8 @@ export default class Component {
         // For this reason, I'm using an "on-demand" proxy to fake a "$refs" object.
         // For this reason, I'm using an "on-demand" proxy to fake a "$refs" object.
         return new Proxy({}, {
         return new Proxy({}, {
             get(object, property) {
             get(object, property) {
+                if (property === 'isProxy') return true
+
                 var ref
                 var ref
 
 
                 // We can't just query the DOM because it's hard to filter out refs in
                 // We can't just query the DOM because it's hard to filter out refs in

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно