code
stringlengths
24
2.07M
docstring
stringlengths
25
85.3k
func_name
stringlengths
1
92
language
stringclasses
1 value
repo
stringlengths
5
64
path
stringlengths
4
172
url
stringlengths
44
218
license
stringclasses
7 values
componentUpdated (el, binding, vnode) { if (vnode.tag === 'select') { setSelected(el, binding, vnode.context); // in case the options rendered by v-for have changed, // it's possible that the value is out-of-sync with the rendered options. // detect such cases and filter out values that no l...
Not type checking this file because flow doesn't like attaching properties to Elements.
componentUpdated
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function setSelected (el, binding, vm) { actuallySetSelected(el, binding, vm); /* istanbul ignore if */ if (isIE || isEdge) { setTimeout(() => { actuallySetSelected(el, binding, vm); }, 0); } }
Not type checking this file because flow doesn't like attaching properties to Elements.
setSelected
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function actuallySetSelected (el, binding, vm) { const value = binding.value; const isMultiple = el.multiple; if (isMultiple && !Array.isArray(value)) { "development" !== 'production' && warn( `<select multiple v-model="${binding.expression}"> ` + `expects an Array value for its binding, but got $...
Not type checking this file because flow doesn't like attaching properties to Elements.
actuallySetSelected
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function hasNoMatchingOption (value, options) { return options.every(o => !looseEqual(o, value)) }
Not type checking this file because flow doesn't like attaching properties to Elements.
hasNoMatchingOption
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function getValue (option) { return '_value' in option ? option._value : option.value }
Not type checking this file because flow doesn't like attaching properties to Elements.
getValue
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function onCompositionStart (e) { e.target.composing = true; }
Not type checking this file because flow doesn't like attaching properties to Elements.
onCompositionStart
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function onCompositionEnd (e) { // prevent triggering an input event for no reason if (!e.target.composing) return e.target.composing = false; trigger(e.target, 'input'); }
Not type checking this file because flow doesn't like attaching properties to Elements.
onCompositionEnd
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function trigger (el, type) { const e = document.createEvent('HTMLEvents'); e.initEvent(type, true, true); el.dispatchEvent(e); }
Not type checking this file because flow doesn't like attaching properties to Elements.
trigger
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function locateNode (vnode) { return vnode.componentInstance && (!vnode.data || !vnode.data.transition) ? locateNode(vnode.componentInstance._vnode) : vnode }
Not type checking this file because flow doesn't like attaching properties to Elements.
locateNode
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
bind (el, { value }, vnode) { vnode = locateNode(vnode); const transition$$1 = vnode.data && vnode.data.transition; const originalDisplay = el.__vOriginalDisplay = el.style.display === 'none' ? '' : el.style.display; if (value && transition$$1) { vnode.data.show = true; enter(vnode, ()...
Not type checking this file because flow doesn't like attaching properties to Elements.
bind
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
update (el, { value, oldValue }, vnode) { /* istanbul ignore if */ if (value === oldValue) return vnode = locateNode(vnode); const transition$$1 = vnode.data && vnode.data.transition; if (transition$$1) { vnode.data.show = true; if (value) { enter(vnode, () => { el.styl...
Not type checking this file because flow doesn't like attaching properties to Elements.
update
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
unbind ( el, binding, vnode, oldVnode, isDestroy ) { if (!isDestroy) { el.style.display = el.__vOriginalDisplay; } }
Not type checking this file because flow doesn't like attaching properties to Elements.
unbind
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function getRealChild (vnode) { const compOptions = vnode && vnode.componentOptions; if (compOptions && compOptions.Ctor.options.abstract) { return getRealChild(getFirstComponentChild(compOptions.children)) } else { return vnode } }
Not type checking this file because flow doesn't like attaching properties to Elements.
getRealChild
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function extractTransitionData (comp) { const data = {}; const options = comp.$options; // props for (const key in options.propsData) { data[key] = comp[key]; } // events. // extract listeners and pass them directly to the transition methods const listeners = options._parentListeners; for (const k...
Not type checking this file because flow doesn't like attaching properties to Elements.
extractTransitionData
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function placeholder (h, rawChild) { if (/\d-keep-alive$/.test(rawChild.tag)) { return h('keep-alive', { props: rawChild.componentOptions.propsData }) } }
Not type checking this file because flow doesn't like attaching properties to Elements.
placeholder
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function hasParentTransition (vnode) { while ((vnode = vnode.parent)) { if (vnode.data.transition) { return true } } }
Not type checking this file because flow doesn't like attaching properties to Elements.
hasParentTransition
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function isSameChild (child, oldChild) { return oldChild.key === child.key && oldChild.tag === child.tag }
Not type checking this file because flow doesn't like attaching properties to Elements.
isSameChild
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
render (h) { let children = this.$slots.default; if (!children) { return } // filter out text nodes (possible whitespaces) children = children.filter((c) => c.tag || isAsyncPlaceholder(c)); /* istanbul ignore if */ if (!children.length) { return } // warn multiple eleme...
Not type checking this file because flow doesn't like attaching properties to Elements.
render
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
render (h) { const tag = this.tag || this.$vnode.data.tag || 'span'; const map = Object.create(null); const prevChildren = this.prevChildren = this.children; const rawChildren = this.$slots.default || []; const children = this.children = []; const transitionData = extractTransitionData(this); ...
Not type checking this file because flow doesn't like attaching properties to Elements.
render
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
beforeUpdate () { // force removing pass this.__patch__( this._vnode, this.kept, false, // hydrating true // removeOnly (!important, avoids unnecessary moves) ); this._vnode = this.kept; }
Not type checking this file because flow doesn't like attaching properties to Elements.
beforeUpdate
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
updated () { const children = this.prevChildren; const moveClass = this.moveClass || ((this.name || 'v') + '-move'); if (!children.length || !this.hasMove(children[0].elm, moveClass)) { return } // we divide the work into three loops to avoid mixing DOM reads and writes // in each iterati...
Not type checking this file because flow doesn't like attaching properties to Elements.
updated
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
hasMove (el, moveClass) { /* istanbul ignore if */ if (!hasTransition) { return false } /* istanbul ignore if */ if (this._hasMove) { return this._hasMove } // Detect whether an element with the move class applied has // CSS transitions. Since the element ...
Not type checking this file because flow doesn't like attaching properties to Elements.
hasMove
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function callPendingCbs (c) { /* istanbul ignore if */ if (c.elm._moveCb) { c.elm._moveCb(); } /* istanbul ignore if */ if (c.elm._enterCb) { c.elm._enterCb(); } }
Not type checking this file because flow doesn't like attaching properties to Elements.
callPendingCbs
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function recordPosition (c) { c.data.newPos = c.elm.getBoundingClientRect(); }
Not type checking this file because flow doesn't like attaching properties to Elements.
recordPosition
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function applyTranslation (c) { const oldPos = c.data.pos; const newPos = c.data.newPos; const dx = oldPos.left - newPos.left; const dy = oldPos.top - newPos.top; if (dx || dy) { c.data.moved = true; const s = c.elm.style; s.transform = s.WebkitTransform = `translate(${dx}px,${dy}px)`; s.trans...
Not type checking this file because flow doesn't like attaching properties to Elements.
applyTranslation
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function parseText ( text, delimiters ) { const tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE; if (!tagRE.test(text)) { return } const tokens = []; let lastIndex = tagRE.lastIndex = 0; let match, index; while ((match = tagRE.exec(text))) { index = match.index; // push text tok...
Not type checking this file because flow doesn't like attaching properties to Elements.
parseText
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function transformNode (el, options) { const warn = options.warn || baseWarn; const staticClass = getAndRemoveAttr(el, 'class'); if ("development" !== 'production' && staticClass) { const expression = parseText(staticClass, options.delimiters); if (expression) { warn( `class="${staticClass}"...
Not type checking this file because flow doesn't like attaching properties to Elements.
transformNode
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function genData (el) { let data = ''; if (el.staticClass) { data += `staticClass:${el.staticClass},`; } if (el.classBinding) { data += `class:${el.classBinding},`; } return data }
Not type checking this file because flow doesn't like attaching properties to Elements.
genData
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function transformNode$1 (el, options) { const warn = options.warn || baseWarn; const staticStyle = getAndRemoveAttr(el, 'style'); if (staticStyle) { /* istanbul ignore if */ { const expression = parseText(staticStyle, options.delimiters); if (expression) { warn( `style="${st...
Not type checking this file because flow doesn't like attaching properties to Elements.
transformNode$1
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function genData$1 (el) { let data = ''; if (el.staticStyle) { data += `staticStyle:${el.staticStyle},`; } if (el.styleBinding) { data += `style:(${el.styleBinding}),`; } return data }
Not type checking this file because flow doesn't like attaching properties to Elements.
genData$1
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
decode (html) { decoder = decoder || document.createElement('div'); decoder.innerHTML = html; return decoder.textContent }
Not type checking this file because flow doesn't like attaching properties to Elements.
decode
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function decodeAttr (value, shouldDecodeNewlines) { const re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr; return value.replace(re, match => decodingMap[match]) }
Not type-checking this file because it's mostly vendor code.
decodeAttr
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function parseHTML (html, options) { const stack = []; const expectHTML = options.expectHTML; const isUnaryTag$$1 = options.isUnaryTag || no; const canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no; let index = 0; let last, lastTag; while (html) { last = html; // Make sure we're not in a plaint...
Not type-checking this file because it's mostly vendor code.
parseHTML
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function advance (n) { index += n; html = html.substring(n); }
Not type-checking this file because it's mostly vendor code.
advance
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function parseStartTag () { const start = html.match(startTagOpen); if (start) { const match = { tagName: start[1], attrs: [], start: index }; advance(start[0].length); let end, attr; while (!(end = html.match(startTagClose)) && (attr = html.match(attribute)...
Not type-checking this file because it's mostly vendor code.
parseStartTag
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function handleStartTag (match) { const tagName = match.tagName; const unarySlash = match.unarySlash; if (expectHTML) { if (lastTag === 'p' && isNonPhrasingTag(tagName)) { parseEndTag(lastTag); } if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) { parseEndTag(tagNam...
Not type-checking this file because it's mostly vendor code.
handleStartTag
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function parseEndTag (tagName, start, end) { let pos, lowerCasedTagName; if (start == null) start = index; if (end == null) end = index; if (tagName) { lowerCasedTagName = tagName.toLowerCase(); } // Find the closest opened tag of the same type if (tagName) { for (pos = stack.l...
Not type-checking this file because it's mostly vendor code.
parseEndTag
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function createASTElement ( tag, attrs, parent ) { return { type: 1, tag, attrsList: attrs, attrsMap: makeAttrsMap(attrs), parent, children: [] } }
Not type-checking this file because it's mostly vendor code.
createASTElement
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function preTransformNode (el, options) { if (el.tag === 'input') { const map = el.attrsMap; if (map['v-model'] && (map['v-bind:type'] || map[':type'])) { const typeBinding = getBindingAttr(el, 'type'); const ifCondition = getAndRemoveAttr(el, 'v-if', true); const ifConditionExtra = ifCondit...
Expand input[v-model] with dyanmic type bindings into v-if-else chains Turn this: <input v-model="data[type]" :type="type"> into this: <input v-if="type === 'checkbox'" type="checkbox" v-model="data[type]"> <input v-else-if="type === 'radio'" type="radio" v-model="data[type]"> <input v-else :type="type" v-model...
preTransformNode
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function cloneASTElement (el) { return createASTElement(el.tag, el.attrsList.slice(), el.parent) }
Expand input[v-model] with dyanmic type bindings into v-if-else chains Turn this: <input v-model="data[type]" :type="type"> into this: <input v-if="type === 'checkbox'" type="checkbox" v-model="data[type]"> <input v-else-if="type === 'radio'" type="radio" v-model="data[type]"> <input v-else :type="type" v-model...
cloneASTElement
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function addRawAttr (el, name, value) { el.attrsMap[name] = value; el.attrsList.push({ name, value }); }
Expand input[v-model] with dyanmic type bindings into v-if-else chains Turn this: <input v-model="data[type]" :type="type"> into this: <input v-if="type === 'checkbox'" type="checkbox" v-model="data[type]"> <input v-else-if="type === 'radio'" type="radio" v-model="data[type]"> <input v-else :type="type" v-model...
addRawAttr
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function text (el, dir) { if (dir.value) { addProp(el, 'textContent', `_s(${dir.value})`); } }
Expand input[v-model] with dyanmic type bindings into v-if-else chains Turn this: <input v-model="data[type]" :type="type"> into this: <input v-if="type === 'checkbox'" type="checkbox" v-model="data[type]"> <input v-else-if="type === 'radio'" type="radio" v-model="data[type]"> <input v-else :type="type" v-model...
text
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function html (el, dir) { if (dir.value) { addProp(el, 'innerHTML', `_s(${dir.value})`); } }
Expand input[v-model] with dyanmic type bindings into v-if-else chains Turn this: <input v-model="data[type]" :type="type"> into this: <input v-if="type === 'checkbox'" type="checkbox" v-model="data[type]"> <input v-else-if="type === 'radio'" type="radio" v-model="data[type]"> <input v-else :type="type" v-model...
html
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function optimize (root, options) { if (!root) return isStaticKey = genStaticKeysCached(options.staticKeys || ''); isPlatformReservedTag = options.isReservedTag || no; // first pass: mark all non-static nodes. markStatic$1(root); // second pass: mark static roots. markStaticRoots(root, false); }
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
optimize
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function genStaticKeys$1 (keys) { return makeMap( 'type,tag,attrsList,attrsMap,plain,parent,children,attrs' + (keys ? ',' + keys : '') ) }
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
genStaticKeys$1
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function markStatic$1 (node) { node.static = isStatic(node); if (node.type === 1) { // do not make component slot content static. this avoids // 1. components not able to mutate slot nodes // 2. static slot content fails for hot-reloading if ( !isPlatformReservedTag(node.tag) && node.tag...
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
markStatic$1
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function markStaticRoots (node, isInFor) { if (node.type === 1) { if (node.static || node.once) { node.staticInFor = isInFor; } // For a node to qualify as a static root, it should have children that // are not just static text. Otherwise the cost of hoisting out will // outweigh the benefit...
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
markStaticRoots
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function isStatic (node) { if (node.type === 2) { // expression return false } if (node.type === 3) { // text return true } return !!(node.pre || ( !node.hasBindings && // no dynamic bindings !node.if && !node.for && // not v-if or v-for or v-else !isBuiltInTag(node.tag) && // not a built-...
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
isStatic
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function isDirectChildOfTemplateFor (node) { while (node.parent) { node = node.parent; if (node.tag !== 'template') { return false } if (node.for) { return true } } return false }
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
isDirectChildOfTemplateFor
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function genHandlers ( events, isNative, warn ) { let res = isNative ? 'nativeOn:{' : 'on:{'; for (const name in events) { res += `"${name}":${genHandler(name, events[name])},`; } return res.slice(0, -1) + '}' }
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
genHandlers
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function genHandler ( name, handler ) { if (!handler) { return 'function(){}' } if (Array.isArray(handler)) { return `[${handler.map(handler => genHandler(name, handler)).join(',')}]` } const isMethodPath = simplePathRE.test(handler.value); const isFunctionExpression = fnExpRE.test(handler.val...
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
genHandler
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function genKeyFilter (keys) { return `if(!('button' in $event)&&${keys.map(genFilterCode).join('&&')})return null;` }
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
genKeyFilter
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function genFilterCode (key) { const keyVal = parseInt(key, 10); if (keyVal) { return `$event.keyCode!==${keyVal}` } const code = keyCodes[key]; return ( `_k($event.keyCode,` + `${JSON.stringify(key)},` + `${JSON.stringify(code)},` + `$event.key)` ) }
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
genFilterCode
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function on (el, dir) { if ("development" !== 'production' && dir.modifiers) { warn(`v-on without argument does not support modifiers.`); } el.wrapListeners = (code) => `_g(${code},${dir.value})`; }
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
on
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function bind$1 (el, dir) { el.wrapData = (code) => { return `_b(${code},'${el.tag}',${dir.value},${ dir.modifiers && dir.modifiers.prop ? 'true' : 'false' }${ dir.modifiers && dir.modifiers.sync ? ',true' : '' })` }; }
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
bind$1
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
constructor (options) { this.options = options; this.warn = options.warn || baseWarn; this.transforms = pluckModuleFunction(options.modules, 'transformCode'); this.dataGenFns = pluckModuleFunction(options.modules, 'genData'); this.directives = extend(extend({}, baseDirectives), options.directives); ...
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
constructor
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function generate ( ast, options ) { const state = new CodegenState(options); const code = ast ? genElement(ast, state) : '_c("div")'; return { render: `with(this){return ${code}}`, staticRenderFns: state.staticRenderFns } }
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
generate
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function genElement (el, state) { if (el.staticRoot && !el.staticProcessed) { return genStatic(el, state) } else if (el.once && !el.onceProcessed) { return genOnce(el, state) } else if (el.for && !el.forProcessed) { return genFor(el, state) } else if (el.if && !el.ifProcessed) { return genIf(el,...
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
genElement
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function genStatic (el, state, once$$1) { el.staticProcessed = true; state.staticRenderFns.push(`with(this){return ${genElement(el, state)}}`); return `_m(${ state.staticRenderFns.length - 1 },${ el.staticInFor ? 'true' : 'false' },${ once$$1 ? 'true' : 'false' })` }
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
genStatic
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function genOnce (el, state) { el.onceProcessed = true; if (el.if && !el.ifProcessed) { return genIf(el, state) } else if (el.staticInFor) { let key = ''; let parent = el.parent; while (parent) { if (parent.for) { key = parent.key; break } parent = parent.parent; ...
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
genOnce
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function genIf ( el, state, altGen, altEmpty ) { el.ifProcessed = true; // avoid recursion return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty) }
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
genIf
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function genIfConditions ( conditions, state, altGen, altEmpty ) { if (!conditions.length) { return altEmpty || '_e()' } const condition = conditions.shift(); if (condition.exp) { return `(${condition.exp})?${ genTernaryExp(condition.block) }:${ genIfConditions(conditions, state...
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
genIfConditions
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function genTernaryExp (el) { return altGen ? altGen(el, state) : el.once ? genOnce(el, state) : genElement(el, state) }
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
genTernaryExp
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function genFor ( el, state, altGen, altHelper ) { const exp = el.for; const alias = el.alias; const iterator1 = el.iterator1 ? `,${el.iterator1}` : ''; const iterator2 = el.iterator2 ? `,${el.iterator2}` : ''; if ("development" !== 'production' && state.maybeComponent(el) && el.tag !== 'slot...
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
genFor
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function genData$2 (el, state) { let data = '{'; // directives first. // directives may mutate the el's other properties before they are generated. const dirs = genDirectives(el, state); if (dirs) data += dirs + ','; // key if (el.key) { data += `key:${el.key},`; } // ref if (el.ref) { dat...
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
genData$2
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function genDirectives (el, state) { const dirs = el.directives; if (!dirs) return let res = 'directives:['; let hasRuntime = false; let i, l, dir, needRuntime; for (i = 0, l = dirs.length; i < l; i++) { dir = dirs[i]; needRuntime = true; const gen = state.directives[dir.name]; if (gen) { ...
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
genDirectives
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function genInlineTemplate (el, state) { const ast = el.children[0]; if ("development" !== 'production' && ( el.children.length !== 1 || ast.type !== 1 )) { state.warn('Inline-template components must have exactly one child element.'); } if (ast.type === 1) { const inlineRenderFns = generate(ast, ...
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
genInlineTemplate
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function genScopedSlots ( slots, state ) { return `scopedSlots:_u([${ Object.keys(slots).map(key => { return genScopedSlot(key, slots[key], state) }).join(',') }])` }
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
genScopedSlots
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function genScopedSlot ( key, el, state ) { if (el.for && !el.forProcessed) { return genForScopedSlot(key, el, state) } const fn = `function(${String(el.slotScope)}){` + `return ${el.tag === 'template' ? el.if ? `${el.if}?${genChildren(el, state) || 'undefined'}:undefined` : ge...
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
genScopedSlot
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function genForScopedSlot ( key, el, state ) { const exp = el.for; const alias = el.alias; const iterator1 = el.iterator1 ? `,${el.iterator1}` : ''; const iterator2 = el.iterator2 ? `,${el.iterator2}` : ''; el.forProcessed = true; // avoid recursion return `_l((${exp}),` + `function(${alias}${iter...
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
genForScopedSlot
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function genChildren ( el, state, checkSkip, altGenElement, altGenNode ) { const children = el.children; if (children.length) { const el = children[0]; // optimize single v-for if (children.length === 1 && el.for && el.tag !== 'template' && el.tag !== 'slot' ) { ret...
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
genChildren
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function getNormalizationType ( children, maybeComponent ) { let res = 0; for (let i = 0; i < children.length; i++) { const el = children[i]; if (el.type !== 1) { continue } if (needsNormalization(el) || (el.ifConditions && el.ifConditions.some(c => needsNormalization(c.block)))) {...
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
getNormalizationType
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function needsNormalization (el) { return el.for !== undefined || el.tag === 'template' || el.tag === 'slot' }
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
needsNormalization
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function genNode (node, state) { if (node.type === 1) { return genElement(node, state) } if (node.type === 3 && node.isComment) { return genComment(node) } else { return genText(node) } }
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
genNode
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function genText (text) { return `_v(${text.type === 2 ? text.expression // no need for () because already wrapped in _s() : transformSpecialNewlines(JSON.stringify(text.text)) })` }
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
genText
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function genComment (comment) { return `_e(${JSON.stringify(comment.text)})` }
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
genComment
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function genSlot (el, state) { const slotName = el.slotName || '"default"'; const children = genChildren(el, state); let res = `_t(${slotName}${children ? `,${children}` : ''}`; const attrs = el.attrs && `{${el.attrs.map(a => `${camelize(a.name)}:${a.value}`).join(',')}}`; const bind$$1 = el.attrsMap['v-bind'...
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
genSlot
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function genComponent ( componentName, el, state ) { const children = el.inlineTemplate ? null : genChildren(el, state, true); return `_c(${componentName},${genData$2(el, state)}${ children ? `,${children}` : '' })` }
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
genComponent
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function genProps (props) { let res = ''; for (let i = 0; i < props.length; i++) { const prop = props[i]; res += `"${prop.name}":${transformSpecialNewlines(prop.value)},`; } return res.slice(0, -1) }
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
genProps
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function transformSpecialNewlines (text) { return text .replace(/\u2028/g, '\\u2028') .replace(/\u2029/g, '\\u2029') }
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
transformSpecialNewlines
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function detectErrors (ast) { const errors = []; if (ast) { checkNode(ast, errors); } return errors }
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
detectErrors
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function checkNode (node, errors) { if (node.type === 1) { for (const name in node.attrsMap) { if (dirRE.test(name)) { const value = node.attrsMap[name]; if (value) { if (name === 'v-for') { checkFor(node, `v-for="${value}"`, errors); } else if (onRE.test(name...
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
checkNode
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function checkEvent (exp, text, errors) { const stipped = exp.replace(stripStringRE, ''); const keywordMatch = stipped.match(unaryOperatorsRE); if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') { errors.push( `avoid using JavaScript unary operator as property name: ` + `"${keywor...
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
checkEvent
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function checkFor (node, text, errors) { checkExpression(node.for || '', text, errors); checkIdentifier(node.alias, 'v-for alias', text, errors); checkIdentifier(node.iterator1, 'v-for iterator', text, errors); checkIdentifier(node.iterator2, 'v-for iterator', text, errors); }
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
checkFor
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function checkIdentifier ( ident, type, text, errors ) { if (typeof ident === 'string') { try { new Function(`var ${ident}=_`); } catch (e) { errors.push(`invalid ${type} "${ident}" in expression: ${text.trim()}`); } } }
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
checkIdentifier
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function checkExpression (exp, text, errors) { try { new Function(`return ${exp}`); } catch (e) { const keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE); if (keywordMatch) { errors.push( `avoid using JavaScript keyword as property name: ` + `"${keywordMatch[...
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
checkExpression
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function createFunction (code, errors) { try { return new Function(code) } catch (err) { errors.push({ err, code }); return noop } }
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
createFunction
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function createCompileToFunctionFn (compile) { const cache = Object.create(null); return function compileToFunctions ( template, options, vm ) { options = extend({}, options); const warn$$1 = options.warn || warn; delete options.warn; /* istanbul ignore if */ { // detect po...
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
createCompileToFunctionFn
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function createCompilerCreator (baseCompile) { return function createCompiler (baseOptions) { function compile ( template, options ) { const finalOptions = Object.create(baseOptions); const errors = []; const tips = []; finalOptions.warn = (msg, tip) => { (tip ? tip...
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
createCompilerCreator
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function compile ( template, options ) { const finalOptions = Object.create(baseOptions); const errors = []; const tips = []; finalOptions.warn = (msg, tip) => { (tip ? tips : errors).push(msg); }; if (options) { // merge custom modules if (op...
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
compile
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function getShouldDecode (href) { div = div || document.createElement('div'); div.innerHTML = href ? `<a href="\n"/>` : `<div a="\n"/>`; return div.innerHTML.indexOf('&#10;') > 0 }
Goal of the optimizer: walk the generated template AST tree and detect sub-trees that are purely static, i.e. parts of the DOM that never needs to change. Once we detect these sub-trees, we can: 1. Hoist them into constants, so that we no longer need to create fresh nodes for them on each re-render; 2. Completely ...
getShouldDecode
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function getOuterHTML (el) { if (el.outerHTML) { return el.outerHTML } else { const container = document.createElement('div'); container.appendChild(el.cloneNode(true)); return container.innerHTML } }
Get outerHTML of elements, taking care of SVG elements in IE as well.
getOuterHTML
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.browser.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.browser.js
MIT
function toRawType (value) { return _toString.call(value).slice(8, -1) }
Get the raw type string of a value, e.g., [object Object].
toRawType
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.js
MIT
function isPlainObject (obj) { return _toString.call(obj) === '[object Object]' }
Strict object type check. Only returns true for plain JavaScript objects.
isPlainObject
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.js
MIT
function isRegExp (v) { return _toString.call(v) === '[object RegExp]' }
Strict object type check. Only returns true for plain JavaScript objects.
isRegExp
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.js
MIT
function isValidArrayIndex (val) { var n = parseFloat(String(val)); return n >= 0 && Math.floor(n) === n && isFinite(val) }
Check if val is a valid array index.
isValidArrayIndex
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.js
MIT
function toString (val) { return val == null ? '' : typeof val === 'object' ? JSON.stringify(val, null, 2) : String(val) }
Convert a value to a string that is actually rendered.
toString
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.js
MIT
function toNumber (val) { var n = parseFloat(val); return isNaN(n) ? val : n }
Convert an input value to a number for persistence. If the conversion fails, return original string.
toNumber
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.js
MIT
function makeMap ( str, expectsLowerCase ) { var map = Object.create(null); var list = str.split(','); for (var i = 0; i < list.length; i++) { map[list[i]] = true; } return expectsLowerCase ? function (val) { return map[val.toLowerCase()]; } : function (val) { return map[val]; } }
Make a map and return a function for checking if a key is in that map.
makeMap
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.js
MIT
function remove (arr, item) { if (arr.length) { var index = arr.indexOf(item); if (index > -1) { return arr.splice(index, 1) } } }
Remove an item from an array.
remove
javascript
syzoj/syzoj
static/cdnjs/vue/2.5.21/vue.esm.js
https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.esm.js
MIT