From 9352c2db648da4d6227b866f853013ab3ab0bac2 Mon Sep 17 00:00:00 2001
From: DaxChen 
Date: Wed, 11 Oct 2017 13:55:19 +0800
Subject: [PATCH] add attributes:true to MutationObserver
---
 dist/index.js     | 40 +++++++++++++++++++++++-----------------
 dist/ssr.index.js | 40 +++++++++++++++++++++++-----------------
 src/Modal.vue     |  1 +
 3 files changed, 47 insertions(+), 34 deletions(-)
diff --git a/dist/index.js b/dist/index.js
index f45a42a..649c2d3 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -424,17 +424,22 @@
             },
             beforeMount: function() {
                 var _this2 = this;
-                _index2.default.event.$on("toggle", function(name, state, params) {
+                if (_index2.default.event.$on("toggle", function(name, state, params) {
                     name === _this2.name && (void 0 === state && (state = !_this2.visible), _this2.toggle(state, params));
                 }), window.addEventListener("resize", this.onWindowResize), this.onWindowResize(), 
-                this.scrollable && !this.isAutoHeight && console.warn('Modal "' + this.name + '" has scrollable flag set to true but height is not "auto" (' + this.height + ")");
-                var MutationObserver = function() {
-                    for (var prefixes = [ "", "WebKit", "Moz", "O", "Ms" ], i = 0; i < prefixes.length; i++) if (prefixes[i] + "MutationObserver" in window) return window[prefixes[i] + "MutationObserver"];
-                    return !1;
-                }();
-                this.isAutoHeight && MutationObserver && (this.mutationObserver = new MutationObserver(function(mutations) {
-                    _this2.updateRenderedHeight();
-                }));
+                this.scrollable && !this.isAutoHeight && console.warn('Modal "' + this.name + '" has scrollable flag set to true but height is not "auto" (' + this.height + ")"), 
+                this.isAutoHeight) {
+                    var MutationObserver = function() {
+                        for (var prefixes = [ "", "WebKit", "Moz", "O", "Ms" ], i = 0; i < prefixes.length; i++) {
+                            var name = prefixes[i] + "MutationObserver";
+                            if (name in window) return window[name];
+                        }
+                        return !1;
+                    }();
+                    MutationObserver && (this.mutationObserver = new MutationObserver(function(mutations) {
+                        _this2.updateRenderedHeight();
+                    }));
+                }
             },
             beforeDestroy: function() {
                 window.removeEventListener("resize", this.onWindowResize);
@@ -487,13 +492,13 @@
                     this.window.width = window.innerWidth, this.window.height = window.innerHeight;
                 },
                 genEventObject: function(params) {
-                    var data = {
+                    var eventData = {
                         name: this.name,
                         timestamp: Date.now(),
                         canceled: !1,
                         ref: this.$refs.modal
                     };
-                    return Object.assign(data, params || {});
+                    return Object.assign(eventData, params || {});
                 },
                 onModalResize: function(event) {
                     this.modal.widthType = "px", this.modal.width = event.size.width, this.modal.heightType = "px", 
@@ -556,7 +561,7 @@
                 },
                 removeDraggableListeners: function() {},
                 callAfterEvent: function(state) {
-                    state ? this.observe() : this.disconnectObserver();
+                    state ? this.connectObserver() : this.disconnectObserver();
                     var afterEventName = state ? "opened" : "closed", afterEvent = this.genEventObject({
                         state: state
                     });
@@ -565,9 +570,10 @@
                 updateRenderedHeight: function() {
                     this.modal.renderedHeight = this.$refs.modal.getBoundingClientRect().height;
                 },
-                observe: function() {
+                connectObserver: function() {
                     this.mutationObserver && this.mutationObserver.observe(this.$refs.modal, {
                         childList: !0,
+                        attributes: !0,
                         subtree: !0
                     });
                 },
@@ -706,13 +712,13 @@
             sourceRoot: "webpack://"
         } ]);
     }, function(module, exports, __webpack_require__) {
-        exports = module.exports = __webpack_require__(0)(), exports.push([ module.i, "\n.v--modal-block-scroll {\n  overflow: hidden;\n}\n.v--modal-overlay {\n  position: fixed;\n  box-sizing: border-box;\n  left: 0;\n  top: 0;\n  width: 100vw;\n  height: 100vh;\n  background: rgba(0, 0, 0, 0.2);\n  z-index: 999;\n  opacity: 1;\n}\n.v--modal-overlay.scrollable {\n  height: 100%;\n  min-height: 100vh;\n  overflow-y: auto;\n  padding-bottom: 10px;\n}\n.v--modal-overlay .v--modal-box {\n  position: relative;\n  overflow: hidden;\n  box-sizing: border-box;\n}\n.v--modal-overlay.scrollable .v--modal-box {\n  margin-bottom: 10px;\n  transition: top 0.2s ease;\n}\n.v--modal {\n  background-color: white;\n  text-align: left;\n  border-radius: 3px;\n  box-shadow: 0 20px 60px -2px rgba(27, 33, 58, .4);\n  padding: 0;\n}\n.v--modal.v--modal-fullscreen {\n  width: 100vw;\n  height: 100vh;\n  margin: 0;\n  left: 0;\n  top: 0;\n}\n.v--modal-top-right {\n  display: block;\n  position: absolute;\n  right: 0;\n  top: 0;\n}\n.overlay-fade-enter-active, .overlay-fade-leave-active {\n  transition: all 0.2s;\n}\n.overlay-fade-enter, .overlay-fade-leave-active {\n  opacity: 0;\n}\n.nice-modal-fade-enter-active, .nice-modal-fade-leave-active {\n  transition: all 0.4s;\n}\n.nice-modal-fade-enter, .nice-modal-fade-leave-active {\n  opacity: 0;\n  transform: translateY(-20px);\n}\n", "", {
+        exports = module.exports = __webpack_require__(0)(), exports.push([ module.i, "\n.v--modal-block-scroll {\n  overflow: hidden;\n}\n.v--modal-overlay {\n  position: fixed;\n  box-sizing: border-box;\n  left: 0;\n  top: 0;\n  width: 100vw;\n  height: 100vh;\n  background: rgba(0, 0, 0, 0.2);\n  z-index: 999;\n  opacity: 1;\n}\n.v--modal-overlay.scrollable {\n  height: 100%;\n  min-height: 100vh;\n  overflow-y: auto;\n  padding-bottom: 10px;\n}\n.v--modal-overlay .v--modal-box {\n  position: relative;\n  overflow: hidden;\n  box-sizing: border-box;\n}\n.v--modal-overlay.scrollable .v--modal-box {\n  margin-bottom: 2px;\n  /* transition: top 0.2s ease; */\n}\n.v--modal {\n  background-color: white;\n  text-align: left;\n  border-radius: 3px;\n  box-shadow: 0 20px 60px -2px rgba(27, 33, 58, .4);\n  padding: 0;\n}\n.v--modal.v--modal-fullscreen {\n  width: 100vw;\n  height: 100vh;\n  margin: 0;\n  left: 0;\n  top: 0;\n}\n.v--modal-top-right {\n  display: block;\n  position: absolute;\n  right: 0;\n  top: 0;\n}\n.overlay-fade-enter-active, .overlay-fade-leave-active {\n  transition: all 0.2s;\n}\n.overlay-fade-enter, .overlay-fade-leave-active {\n  opacity: 0;\n}\n.nice-modal-fade-enter-active, .nice-modal-fade-leave-active {\n  transition: all 0.4s;\n}\n.nice-modal-fade-enter, .nice-modal-fade-leave-active {\n  opacity: 0;\n  transform: translateY(-20px);\n}\n", "", {
             version: 3,
-            sources: [ "/./src/Modal.vue?177edc72" ],
+            sources: [ "/./src/Modal.vue?6d1f4078" ],
             names: [],
-            mappings: ";AA8kBA;EACA,iBAAA;CACA;AAEA;EACA,gBAAA;EACA,uBAAA;EACA,QAAA;EACA,OAAA;EACA,aAAA;EACA,cAAA;EACA,+BAAA;EACA,aAAA;EACA,WAAA;CACA;AAEA;EACA,aAAA;EACA,kBAAA;EACA,iBAAA;EACA,qBAAA;CACA;AAEA;EACA,mBAAA;EACA,iBAAA;EACA,uBAAA;CACA;AAEA;EACA,oBAAA;EACA,0BAAA;CACA;AAEA;EACA,wBAAA;EACA,iBAAA;EACA,mBAAA;EACA,kDAAA;EACA,WAAA;CACA;AAEA;EACA,aAAA;EACA,cAAA;EACA,UAAA;EACA,QAAA;EACA,OAAA;CACA;AAEA;EACA,eAAA;EACA,mBAAA;EACA,SAAA;EACA,OAAA;CACA;AAEA;EACA,qBAAA;CACA;AAEA;EACA,WAAA;CACA;AAEA;EACA,qBAAA;CACA;AAEA;EACA,WAAA;EACA,6BAAA;CACA",
+            mappings: ";AA8lBA;EACA,iBAAA;CACA;AAEA;EACA,gBAAA;EACA,uBAAA;EACA,QAAA;EACA,OAAA;EACA,aAAA;EACA,cAAA;EACA,+BAAA;EACA,aAAA;EACA,WAAA;CACA;AAEA;EACA,aAAA;EACA,kBAAA;EACA,iBAAA;EACA,qBAAA;CACA;AAEA;EACA,mBAAA;EACA,iBAAA;EACA,uBAAA;CACA;AAEA;EACA,mBAAA;EACA,gCAAA;CACA;AAEA;EACA,wBAAA;EACA,iBAAA;EACA,mBAAA;EACA,kDAAA;EACA,WAAA;CACA;AAEA;EACA,aAAA;EACA,cAAA;EACA,UAAA;EACA,QAAA;EACA,OAAA;CACA;AAEA;EACA,eAAA;EACA,mBAAA;EACA,SAAA;EACA,OAAA;CACA;AAEA;EACA,qBAAA;CACA;AAEA;EACA,WAAA;CACA;AAEA;EACA,qBAAA;CACA;AAEA;EACA,WAAA;EACA,6BAAA;CACA",
             file: "Modal.vue",
-            sourcesContent: [ "\n  \n    \n      
\n        \n      
\n      
\n        \n          \n          \n        
\n      \n