| 9045 | } |
| 9046 | |
| 9047 | function domAPI (Vue) { |
| 9048 | /** |
| 9049 | * Convenience on-instance nextTick. The callback is |
| 9050 | * auto-bound to the instance, and this avoids component |
| 9051 | * modules having to rely on the global Vue. |
| 9052 | * |
| 9053 | * @param {Function} fn |
| 9054 | */ |
| 9055 | |
| 9056 | Vue.prototype.$nextTick = function (fn) { |
| 9057 | nextTick(fn, this); |
| 9058 | }; |
| 9059 | |
| 9060 | /** |
| 9061 | * Append instance to target |
| 9062 | * |
| 9063 | * @param {Node} target |
| 9064 | * @param {Function} [cb] |
| 9065 | * @param {Boolean} [withTransition] - defaults to true |
| 9066 | */ |
| 9067 | |
| 9068 | Vue.prototype.$appendTo = function (target, cb, withTransition) { |
| 9069 | return insert(this, target, cb, withTransition, append, appendWithTransition); |
| 9070 | }; |
| 9071 | |
| 9072 | /** |
| 9073 | * Prepend instance to target |
| 9074 | * |
| 9075 | * @param {Node} target |
| 9076 | * @param {Function} [cb] |
| 9077 | * @param {Boolean} [withTransition] - defaults to true |
| 9078 | */ |
| 9079 | |
| 9080 | Vue.prototype.$prependTo = function (target, cb, withTransition) { |
| 9081 | target = query(target); |
| 9082 | if (target.hasChildNodes()) { |
| 9083 | this.$before(target.firstChild, cb, withTransition); |
| 9084 | } else { |
| 9085 | this.$appendTo(target, cb, withTransition); |
| 9086 | } |
| 9087 | return this; |
| 9088 | }; |
| 9089 | |
| 9090 | /** |
| 9091 | * Insert instance before target |
| 9092 | * |
| 9093 | * @param {Node} target |
| 9094 | * @param {Function} [cb] |
| 9095 | * @param {Boolean} [withTransition] - defaults to true |
| 9096 | */ |
| 9097 | |
| 9098 | Vue.prototype.$before = function (target, cb, withTransition) { |
| 9099 | return insert(this, target, cb, withTransition, beforeWithCb, beforeWithTransition); |
| 9100 | }; |
| 9101 | |
| 9102 | /** |
| 9103 | * Insert instance after target |
| 9104 | * |