Skip to content

[Code style update] improve mutli-line && code style to keep consistence #5625

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/compiler/codegen/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ export function genHandlers (
const handler = events[name]
// #5330: warn click.right, since right clicks do not actually fire click events.
if (process.env.NODE_ENV !== 'production' &&
name === 'click' &&
handler && handler.modifiers && handler.modifiers.right
) {
name === 'click' &&
handler && handler.modifiers && handler.modifiers.right
) {
warn(
`Use "contextmenu" instead of "click.right" since right clicks ` +
`do not actually fire "click" events.`
Expand Down
7 changes: 4 additions & 3 deletions src/compiler/codegen/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,10 @@ function genChildren (el: ASTElement, checkSkip?: boolean): string | void {
const el: any = children[0]
// optimize single v-for
if (children.length === 1 &&
el.for &&
el.tag !== 'template' &&
el.tag !== 'slot') {
el.for &&
el.tag !== 'template' &&
el.tag !== 'slot'
) {
return genElement(el)
}
const normalizationType = checkSkip ? getNormalizationType(children) : 0
Expand Down
5 changes: 3 additions & 2 deletions src/compiler/parser/html-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,9 @@ export function parseHTML (html, options) {
// Close all the open elements, up the stack
for (let i = stack.length - 1; i >= pos; i--) {
if (process.env.NODE_ENV !== 'production' &&
(i > pos || !tagName) &&
options.warn) {
(i > pos || !tagName) &&
options.warn
) {
options.warn(
`tag <${stack[i].tag}> has no matching end tag.`
)
Expand Down
5 changes: 3 additions & 2 deletions src/compiler/parser/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,9 @@ export function parse (
// IE textarea placeholder bug
/* istanbul ignore if */
if (isIE &&
currentParent.tag === 'textarea' &&
currentParent.attrsMap.placeholder === text) {
currentParent.tag === 'textarea' &&
currentParent.attrsMap.placeholder === text
) {
return
}
const children = currentParent.children
Expand Down
3 changes: 2 additions & 1 deletion src/core/instance/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import { warn } from '../util/index'

function Vue (options) {
if (process.env.NODE_ENV !== 'production' &&
!(this instanceof Vue)) {
!(this instanceof Vue)
) {
warn('Vue is a constructor and should be called with the `new` keyword')
}
this._init(options)
Expand Down
3 changes: 2 additions & 1 deletion src/core/instance/render-helpers/resolve-slots.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ export function resolveSlots (
// named slots should only be respected if the vnode was rendered in the
// same context.
if ((child.context === context || child.functionalContext === context) &&
child.data && child.data.slot != null) {
child.data && child.data.slot != null
) {
const name = child.data.slot
const slot = (slots[name] || (slots[name] = []))
if (child.tag === 'template') {
Expand Down
3 changes: 2 additions & 1 deletion src/core/util/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ function getPropDefaultValue (vm: ?Component, prop: PropOptions, key: string): a
// return previous default value to avoid unnecessary watcher trigger
if (vm && vm.$options.propsData &&
vm.$options.propsData[key] === undefined &&
vm._props[key] !== undefined) {
vm._props[key] !== undefined
) {
return vm._props[key]
}
// call factory function for non-Function types
Expand Down
3 changes: 2 additions & 1 deletion src/core/vdom/create-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ export function _createElement (
}
// support single function children as default scoped slot
if (Array.isArray(children) &&
typeof children[0] === 'function') {
typeof children[0] === 'function'
) {
data = data || {}
data.scopedSlots = { default: children[0] }
children.length = 0
Expand Down
17 changes: 10 additions & 7 deletions src/core/vdom/patch.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,9 @@ export function createPatchFunction (backend) {
}
// for slot content they should also get the scopeId from the host instance.
if (isDef(i = activeInstance) &&
i !== vnode.context &&
isDef(i = i.$options._scopeId)) {
i !== vnode.context &&
isDef(i = i.$options._scopeId)
) {
nodeOps.setAttribute(vnode.elm, i, '')
}
}
Expand Down Expand Up @@ -438,9 +439,10 @@ export function createPatchFunction (backend) {
// if the new node is not cloned it means the render functions have been
// reset by the hot-reload-api and we need to do a proper re-render.
if (isTrue(vnode.isStatic) &&
isTrue(oldVnode.isStatic) &&
vnode.key === oldVnode.key &&
(isTrue(vnode.isCloned) || isTrue(vnode.isOnce))) {
isTrue(oldVnode.isStatic) &&
vnode.key === oldVnode.key &&
(isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
) {
vnode.elm = oldVnode.elm
vnode.componentInstance = oldVnode.componentInstance
return
Expand Down Expand Up @@ -529,8 +531,9 @@ export function createPatchFunction (backend) {
// longer than the virtual children list.
if (!childrenMatch || childNode) {
if (process.env.NODE_ENV !== 'production' &&
typeof console !== 'undefined' &&
!bailed) {
typeof console !== 'undefined' &&
!bailed
) {
bailed = true
console.warn('Parent: ', elm)
console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children)
Expand Down
3 changes: 2 additions & 1 deletion src/platforms/web/runtime/components/transition.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ export default {

// warn invalid mode
if (process.env.NODE_ENV !== 'production' &&
mode && mode !== 'in-out' && mode !== 'out-in') {
mode && mode !== 'in-out' && mode !== 'out-in'
) {
warn(
'invalid <transition> mode: ' + mode,
this.$parent
Expand Down
5 changes: 3 additions & 2 deletions src/platforms/web/runtime/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ setTimeout(() => {
}
}
if (process.env.NODE_ENV !== 'production' &&
config.productionTip !== false &&
inBrowser && typeof console !== 'undefined') {
config.productionTip !== false &&
inBrowser && typeof console !== 'undefined'
) {
console[console.info ? 'info' : 'log'](
`You are running Vue in development mode.\n` +
`Make sure to turn on production mode when deploying for production.\n` +
Expand Down
3 changes: 2 additions & 1 deletion src/platforms/web/runtime/modules/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ function updateStyle (oldVnode: VNodeWithData, vnode: VNodeWithData) {
const oldData = oldVnode.data

if (isUndef(data.staticStyle) && isUndef(data.style) &&
isUndef(oldData.staticStyle) && isUndef(oldData.style)) {
isUndef(oldData.staticStyle) && isUndef(oldData.style)
) {
return
}

Expand Down
5 changes: 3 additions & 2 deletions src/platforms/web/runtime/modules/transition.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,9 @@ export function enter (vnode: VNodeWithData, toggleDisplay: ?() => void) {
const parent = el.parentNode
const pendingNode = parent && parent._pending && parent._pending[vnode.key]
if (pendingNode &&
pendingNode.tag === vnode.tag &&
pendingNode.elm._leaveCb) {
pendingNode.tag === vnode.tag &&
pendingNode.elm._leaveCb
) {
pendingNode.elm._leaveCb()
}
enterHook && enterHook(el, cb)
Expand Down
6 changes: 4 additions & 2 deletions src/platforms/web/runtime/transition-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ export let animationEndEvent = 'animationend'
if (hasTransition) {
/* istanbul ignore if */
if (window.ontransitionend === undefined &&
window.onwebkittransitionend !== undefined) {
window.onwebkittransitionend !== undefined
) {
transitionProp = 'WebkitTransition'
transitionEndEvent = 'webkitTransitionEnd'
}
if (window.onanimationend === undefined &&
window.onwebkitanimationend !== undefined) {
window.onwebkitanimationend !== undefined
) {
animationProp = 'WebkitAnimation'
animationEndEvent = 'webkitAnimationEnd'
}
Expand Down
5 changes: 3 additions & 2 deletions src/platforms/web/server/modules/dom-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ export default function renderDOMProps (node: VNodeWithData): string {
} else {
const attr = propsToAttrMap[key] || key.toLowerCase()
if (isRenderableAttr(attr) &&
// avoid rendering double-bound props/attrs twice
!(isDef(attrs) && isDef(attrs[attr]))) {
// avoid rendering double-bound props/attrs twice
!(isDef(attrs) && isDef(attrs[attr]))
) {
res += renderAttr(attr, props[key])
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/platforms/weex/runtime/modules/class.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ function updateClass (oldVnode: VNodeWithData, vnode: VNodeWithData) {

const data: VNodeData = vnode.data
const oldData: VNodeData = oldVnode.data
if (!data.staticClass && !data.class &&
(!oldData || (!oldData.staticClass && !oldData.class))) {
if (!data.staticClass &&
!data.class &&
(!oldData || (!oldData.staticClass && !oldData.class))
) {
return
}

Expand Down
7 changes: 4 additions & 3 deletions src/platforms/weex/runtime/modules/transition.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,10 @@ function enter (_, vnode) {
const parent = el.parentNode
const pendingNode = parent && parent._pending && parent._pending[vnode.key]
if (pendingNode &&
pendingNode.context === vnode.context &&
pendingNode.tag === vnode.tag &&
pendingNode.elm._leaveCb) {
pendingNode.context === vnode.context &&
pendingNode.tag === vnode.tag &&
pendingNode.elm._leaveCb
) {
pendingNode.elm._leaveCb()
}
enterHook && enterHook(el, cb)
Expand Down
5 changes: 3 additions & 2 deletions src/server/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,9 @@ function renderStartingTag (node: VNode, context) {
let scopeId
const activeInstance = context.activeInstance
if (isDef(activeInstance) &&
activeInstance !== node.context &&
isDef(scopeId = activeInstance.$options._scopeId)) {
activeInstance !== node.context &&
isDef(scopeId = activeInstance.$options._scopeId)
) {
markup += ` ${(scopeId: any)}`
}
while (isDef(node)) {
Expand Down