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 |
|---|---|---|---|---|---|---|---|
function isValidDuration (val) {
return typeof val === 'number' && !isNaN(val)
} | Remove class with compatibility for SVG since classList is not supported on
SVG elements in IE | isValidDuration | javascript | syzoj/syzoj | static/cdnjs/vue/2.5.21/vue.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function getHookArgumentsLength (fn) {
if (isUndef(fn)) {
return false
}
var invokerFns = fn.fns;
if (isDef(invokerFns)) {
// invoker
return getHookArgumentsLength(
Array.isArray(invokerFns)
? invokerFns[0]
: invokerFns
)
} else {
return (fn.... | Normalize a transition hook's argument length. The hook may be:
- a merged hook (invoker) with the original in .fns
- a wrapped component method (check ._length)
- a plain function (.length) | getHookArgumentsLength | javascript | syzoj/syzoj | static/cdnjs/vue/2.5.21/vue.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function _enter (_, vnode) {
if (vnode.data.show !== true) {
enter(vnode);
}
} | Normalize a transition hook's argument length. The hook may be:
- a merged hook (invoker) with the original in .fns
- a wrapped component method (check ._length)
- a plain function (.length) | _enter | javascript | syzoj/syzoj | static/cdnjs/vue/2.5.21/vue.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function setSelected (el, binding, vm) {
actuallySetSelected(el, binding, vm);
/* istanbul ignore if */
if (isIE || isEdge) {
setTimeout(function () {
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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function actuallySetSelected (el, binding, vm) {
var value = binding.value;
var isMultiple = el.multiple;
if (isMultiple && !Array.isArray(value)) {
warn(
"<select multiple v-model=\"" + (binding.expression) + "\"> " +
"expects an Array value for its binding, but got " + (Object.protot... | 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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function hasNoMatchingOption (value, options) {
return options.every(function (o) { return !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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function trigger (el, type) {
var 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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function getRealChild (vnode) {
var 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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function extractTransitionData (comp) {
var data = {};
var options = comp.$options;
// props
for (var key in options.propsData) {
data[key] = comp[key];
}
// events.
// extract listeners and pass them directly to the transition methods
var listeners = options._parentListeners;
... | 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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function applyTranslation (c) {
var oldPos = c.data.pos;
var newPos = c.data.newPos;
var dx = oldPos.left - newPos.left;
var dy = oldPos.top - newPos.top;
if (dx || dy) {
c.data.moved = true;
var s = c.elm.style;
s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "p... | 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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function parseText (
text,
delimiters
) {
var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
if (!tagRE.test(text)) {
return
}
var tokens = [];
var rawTokens = [];
var lastIndex = tagRE.lastIndex = 0;
var match, index, tokenValue;
while ((match = tagRE.exec(t... | 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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function transformNode (el, options) {
var warn = options.warn || baseWarn;
var staticClass = getAndRemoveAttr(el, 'class');
if (staticClass) {
var res = parseText(staticClass, options.delimiters);
if (res) {
warn(
"class=\"" + staticClass + "\": " +
'Interpolation in... | 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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function genData (el) {
var 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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function transformNode$1 (el, options) {
var warn = options.warn || baseWarn;
var staticStyle = getAndRemoveAttr(el, 'style');
if (staticStyle) {
/* istanbul ignore if */
{
var res = parseText(staticStyle, options.delimiters);
if (res) {
warn(
"style=\"" + s... | 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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function genData$1 (el) {
var 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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function decodeAttr (value, shouldDecodeNewlines) {
var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
return value.replace(re, function (match) { return decodingMap[match]; })
} | Not type-checking this file because it's mostly vendor code. | decodeAttr | javascript | syzoj/syzoj | static/cdnjs/vue/2.5.21/vue.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function parseHTML (html, options) {
var stack = [];
var expectHTML = options.expectHTML;
var isUnaryTag$$1 = options.isUnaryTag || no;
var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
var index = 0;
var last, lastTag;
while (html) {
last = html;
// Make sure we're not i... | Not type-checking this file because it's mostly vendor code. | parseHTML | javascript | syzoj/syzoj | static/cdnjs/vue/2.5.21/vue.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function parseStartTag () {
var start = html.match(startTagOpen);
if (start) {
var match = {
tagName: start[1],
attrs: [],
start: index
};
advance(start[0].length);
var end, attr;
while (!(end = html.match(startTagClose)) && (attr = html.... | Not type-checking this file because it's mostly vendor code. | parseStartTag | javascript | syzoj/syzoj | static/cdnjs/vue/2.5.21/vue.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function handleStartTag (match) {
var tagName = match.tagName;
var unarySlash = match.unarySlash;
if (expectHTML) {
if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
parseEndTag(lastTag);
}
if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
parseE... | Not type-checking this file because it's mostly vendor code. | handleStartTag | javascript | syzoj/syzoj | static/cdnjs/vue/2.5.21/vue.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function parseEndTag (tagName, start, end) {
var pos, lowerCasedTagName;
if (start == null) { start = index; }
if (end == null) { end = index; }
// Find the closest opened tag of the same type
if (tagName) {
lowerCasedTagName = tagName.toLowerCase();
for (pos = stack.lengt... | Not type-checking this file because it's mostly vendor code. | parseEndTag | javascript | syzoj/syzoj | static/cdnjs/vue/2.5.21/vue.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function createASTElement (
tag,
attrs,
parent
) {
return {
type: 1,
tag: tag,
attrsList: attrs,
attrsMap: makeAttrsMap(attrs),
parent: parent,
children: []
}
} | Not type-checking this file because it's mostly vendor code. | createASTElement | javascript | syzoj/syzoj | static/cdnjs/vue/2.5.21/vue.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.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, f... | 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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.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) &&
... | 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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.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
// outwei... | 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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.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... | 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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function genHandlers (
events,
isNative
) {
var res = isNative ? 'nativeOn:{' : 'on:{';
for (var 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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function genHandler (
name,
handler
) {
if (!handler) {
return 'function(){}'
}
if (Array.isArray(handler)) {
return ("[" + (handler.map(function (handler) { return genHandler(name, handler); }).join(',')) + "]")
}
var isMethodPath = simplePathRE.test(handler.value);
var ... | 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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function genFilterCode (key) {
var keyVal = parseInt(key, 10);
if (keyVal) {
return ("$event.keyCode!==" + keyVal)
}
var keyCode = keyCodes[key];
var keyName = keyNames[key];
return (
"_k($event.keyCode," +
(JSON.stringify(key)) + "," +
(JSON.stringify(keyCode)) + "," +
... | 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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function on (el, dir) {
if (dir.modifiers) {
warn("v-on without argument does not support modifiers.");
}
el.wrapListeners = function (code) { return ("_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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function bind$1 (el, dir) {
el.wrapData = function (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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
CodegenState = function CodegenState (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({}, baseDirective... | 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 ... | CodegenState | javascript | syzoj/syzoj | static/cdnjs/vue/2.5.21/vue.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function generate (
ast,
options
) {
var state = new CodegenState(options);
var 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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function genElement (el, state) {
if (el.parent) {
el.pre = el.pre || el.parent.pre;
}
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... | 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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function genStatic (el, state) {
el.staticProcessed = true;
// Some elements (templates) need to behave differently inside of a v-pre
// node. All pre nodes are static roots, so we can use this as a location to
// wrap a state change and reset it upon exiting the pre node.
var originalPreState = st... | 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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function genOnce (el, state) {
el.onceProcessed = true;
if (el.if && !el.ifProcessed) {
return genIf(el, state)
} else if (el.staticInFor) {
var key = '';
var parent = el.parent;
while (parent) {
if (parent.for) {
key = parent.key;
break
}
... | 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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function genIfConditions (
conditions,
state,
altGen,
altEmpty
) {
if (!conditions.length) {
return altEmpty || '_e()'
}
var condition = conditions.shift();
if (condition.exp) {
return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfCondition... | 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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function genFor (
el,
state,
altGen,
altHelper
) {
var exp = el.for;
var alias = el.alias;
var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
if (state.maybeComponent(el) &&
el.tag !== 'slot' &&
el.ta... | 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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function genData$2 (el, state) {
var data = '{';
// directives first.
// directives may mutate the el's other properties before they are generated.
var dirs = genDirectives(el, state);
if (dirs) { data += dirs + ','; }
// key
if (el.key) {
data += "key:" + (el.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 ... | genData$2 | javascript | syzoj/syzoj | static/cdnjs/vue/2.5.21/vue.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function genDirectives (el, state) {
var dirs = el.directives;
if (!dirs) { return }
var res = 'directives:[';
var hasRuntime = false;
var i, l, dir, needRuntime;
for (i = 0, l = dirs.length; i < l; i++) {
dir = dirs[i];
needRuntime = true;
var gen = state.directives[dir.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 ... | genDirectives | javascript | syzoj/syzoj | static/cdnjs/vue/2.5.21/vue.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function genInlineTemplate (el, state) {
var ast = el.children[0];
if (el.children.length !== 1 || ast.type !== 1) {
state.warn('Inline-template components must have exactly one child element.');
}
if (ast.type === 1) {
var inlineRenderFns = generate(ast, state.options);
return ("inlin... | 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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function genScopedSlots (
slots,
state
) {
return ("scopedSlots:_u([" + (Object.keys(slots).map(function (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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function genScopedSlot (
key,
el,
state
) {
if (el.for && !el.forProcessed) {
return genForScopedSlot(key, el, state)
}
var fn = "function(" + (String(el.slotScope)) + "){" +
"return " + (el.tag === 'template'
? el.if
? ("(" + (el.if) + ")?" + (genChildren(el, sta... | 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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function genForScopedSlot (
key,
el,
state
) {
var exp = el.for;
var alias = el.alias;
var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
el.forProcessed = true; // avoid recursion
return "_l((" + exp + ")," +
... | 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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function genChildren (
el,
state,
checkSkip,
altGenElement,
altGenNode
) {
var children = el.children;
if (children.length) {
var el$1 = children[0];
// optimize single v-for
if (children.length === 1 &&
el$1.for &&
el$1.tag !== 'template' &&
el$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 ... | genChildren | javascript | syzoj/syzoj | static/cdnjs/vue/2.5.21/vue.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function getNormalizationType (
children,
maybeComponent
) {
var res = 0;
for (var i = 0; i < children.length; i++) {
var el = children[i];
if (el.type !== 1) {
continue
}
if (needsNormalization(el) ||
(el.ifConditions && el.ifConditions.some(function (c) { re... | 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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function genNode (node, state) {
if (node.type === 1) {
return genElement(node, state)
} else 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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function genSlot (el, state) {
var slotName = el.slotName || '"default"';
var children = genChildren(el, state);
var res = "_t(" + slotName + (children ? ("," + children) : '');
var attrs = el.attrs && ("{" + (el.attrs.map(function (a) { return ((camelize(a.name)) + ":" + (a.value)); }).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 ... | genSlot | javascript | syzoj/syzoj | static/cdnjs/vue/2.5.21/vue.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function genComponent (
componentName,
el,
state
) {
var 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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function genProps (props) {
var res = '';
for (var i = 0; i < props.length; i++) {
var prop = props[i];
/* istanbul ignore if */
{
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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function detectErrors (ast) {
var 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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function checkNode (node, errors) {
if (node.type === 1) {
for (var name in node.attrsMap) {
if (dirRE.test(name)) {
var value = node.attrsMap[name];
if (value) {
if (name === 'v-for') {
checkFor(node, ("v-for=\"" + value + "\""), errors);
} 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 ... | checkNode | javascript | syzoj/syzoj | static/cdnjs/vue/2.5.21/vue.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function checkEvent (exp, text, errors) {
var stipped = exp.replace(stripStringRE, '');
var keywordMatch = stipped.match(unaryOperatorsRE);
if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
errors.push(
"avoid using JavaScript unary operator as property 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 ... | checkEvent | javascript | syzoj/syzoj | static/cdnjs/vue/2.5.21/vue.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function checkExpression (exp, text, errors) {
try {
new Function(("return " + exp));
} catch (e) {
var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
if (keywordMatch) {
errors.push(
"avoid using JavaScript keyword as property 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 ... | checkExpression | javascript | syzoj/syzoj | static/cdnjs/vue/2.5.21/vue.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function createFunction (code, errors) {
try {
return new Function(code)
} catch (err) {
errors.push({ err: err, code: 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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function createCompileToFunctionFn (compile) {
var cache = Object.create(null);
return function compileToFunctions (
template,
options,
vm
) {
options = extend({}, options);
var warn$$1 = options.warn || warn;
delete options.warn;
/* istanbul ignore if */
{
... | 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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function createCompilerCreator (baseCompile) {
return function createCompiler (baseOptions) {
function compile (
template,
options
) {
var finalOptions = Object.create(baseOptions);
var errors = [];
var tips = [];
finalOptions.warn = function (msg, 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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function compile (
template,
options
) {
var finalOptions = Object.create(baseOptions);
var errors = [];
var tips = [];
finalOptions.warn = function (msg, tip) {
(tip ? tips : errors).push(msg);
};
if (options) {
// merge custom ... | 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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function getShouldDecode (href) {
div = div || document.createElement('div');
div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
return div.innerHTML.indexOf(' ') > 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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.js | MIT |
function getOuterHTML (el) {
if (el.outerHTML) {
return el.outerHTML
} else {
var 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.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.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.runtime.common.dev.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.runtime.common.dev.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.runtime.common.dev.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.runtime.common.dev.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.runtime.common.dev.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.runtime.common.dev.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.runtime.common.dev.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.runtime.common.dev.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.runtime.common.dev.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.runtime.common.dev.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.runtime.common.dev.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.runtime.common.dev.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.runtime.common.dev.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.runtime.common.dev.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.runtime.common.dev.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.runtime.common.dev.js | MIT |
function hasOwn (obj, key) {
return hasOwnProperty.call(obj, key)
} | Check whether an object has the property. | hasOwn | javascript | syzoj/syzoj | static/cdnjs/vue/2.5.21/vue.runtime.common.dev.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.runtime.common.dev.js | MIT |
function cached (fn) {
var cache = Object.create(null);
return (function cachedFn (str) {
var hit = cache[str];
return hit || (cache[str] = fn(str))
})
} | Create a cached version of a pure function. | cached | javascript | syzoj/syzoj | static/cdnjs/vue/2.5.21/vue.runtime.common.dev.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.runtime.common.dev.js | MIT |
function polyfillBind (fn, ctx) {
function boundFn (a) {
var l = arguments.length;
return l
? l > 1
? fn.apply(ctx, arguments)
: fn.call(ctx, a)
: fn.call(ctx)
}
boundFn._length = fn.length;
return boundFn
} | Simple bind polyfill for environments that do not support it,
e.g., PhantomJS 1.x. Technically, we don't need this anymore
since native bind is now performant enough in most browsers.
But removing it would mean breaking code that was able to run in
PhantomJS 1.x, so this must be kept for backward compatibility. | polyfillBind | javascript | syzoj/syzoj | static/cdnjs/vue/2.5.21/vue.runtime.common.dev.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.runtime.common.dev.js | MIT |
function boundFn (a) {
var l = arguments.length;
return l
? l > 1
? fn.apply(ctx, arguments)
: fn.call(ctx, a)
: fn.call(ctx)
} | Simple bind polyfill for environments that do not support it,
e.g., PhantomJS 1.x. Technically, we don't need this anymore
since native bind is now performant enough in most browsers.
But removing it would mean breaking code that was able to run in
PhantomJS 1.x, so this must be kept for backward compatibility. | boundFn | javascript | syzoj/syzoj | static/cdnjs/vue/2.5.21/vue.runtime.common.dev.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.runtime.common.dev.js | MIT |
function nativeBind (fn, ctx) {
return fn.bind(ctx)
} | Simple bind polyfill for environments that do not support it,
e.g., PhantomJS 1.x. Technically, we don't need this anymore
since native bind is now performant enough in most browsers.
But removing it would mean breaking code that was able to run in
PhantomJS 1.x, so this must be kept for backward compatibility. | nativeBind | javascript | syzoj/syzoj | static/cdnjs/vue/2.5.21/vue.runtime.common.dev.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.runtime.common.dev.js | MIT |
function toArray (list, start) {
start = start || 0;
var i = list.length - start;
var ret = new Array(i);
while (i--) {
ret[i] = list[i + start];
}
return ret
} | Convert an Array-like object to a real Array. | toArray | javascript | syzoj/syzoj | static/cdnjs/vue/2.5.21/vue.runtime.common.dev.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.runtime.common.dev.js | MIT |
function toObject (arr) {
var res = {};
for (var i = 0; i < arr.length; i++) {
if (arr[i]) {
extend(res, arr[i]);
}
}
return res
} | Merge an Array of Objects into a single Object. | toObject | javascript | syzoj/syzoj | static/cdnjs/vue/2.5.21/vue.runtime.common.dev.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.runtime.common.dev.js | MIT |
function looseEqual (a, b) {
if (a === b) { return true }
var isObjectA = isObject(a);
var isObjectB = isObject(b);
if (isObjectA && isObjectB) {
try {
var isArrayA = Array.isArray(a);
var isArrayB = Array.isArray(b);
if (isArrayA && isArrayB) {
return a.length === b.length && a.ev... | Check if two values are loosely equal - that is,
if they are plain objects, do they have the same shape? | looseEqual | javascript | syzoj/syzoj | static/cdnjs/vue/2.5.21/vue.runtime.common.dev.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.runtime.common.dev.js | MIT |
function looseIndexOf (arr, val) {
for (var i = 0; i < arr.length; i++) {
if (looseEqual(arr[i], val)) { return i }
}
return -1
} | Return the first index at which a loosely equal value can be
found in the array (if value is a plain object, the array must
contain an object of the same shape), or -1 if it is not present. | looseIndexOf | javascript | syzoj/syzoj | static/cdnjs/vue/2.5.21/vue.runtime.common.dev.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.runtime.common.dev.js | MIT |
function once (fn) {
var called = false;
return function () {
if (!called) {
called = true;
fn.apply(this, arguments);
}
}
} | Ensure a function is called only once. | once | javascript | syzoj/syzoj | static/cdnjs/vue/2.5.21/vue.runtime.common.dev.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.runtime.common.dev.js | MIT |
function isReserved (str) {
var c = (str + '').charCodeAt(0);
return c === 0x24 || c === 0x5F
} | Check if a string starts with $ or _ | isReserved | javascript | syzoj/syzoj | static/cdnjs/vue/2.5.21/vue.runtime.common.dev.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.runtime.common.dev.js | MIT |
Dep = function Dep () {
this.id = uid++;
this.subs = [];
} | A dep is an observable that can have multiple
directives subscribing to it. | Dep | javascript | syzoj/syzoj | static/cdnjs/vue/2.5.21/vue.runtime.common.dev.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/vue/2.5.21/vue.runtime.common.dev.js | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.